Commit 93ee55630c15509e4077b28a78aad35b33254f9d

Authored by Goutte
1 parent ebe77ce4

Add a loading animation to target buttons. It makes the whole page glitch on Chr…

…ome on linux and I do not know why, because it's a browser issue.
web/static/css/main.css
@@ -225,6 +225,23 @@ ul li { @@ -225,6 +225,23 @@ ul li {
225 } 225 }
226 } 226 }
227 227
  228 +@-ms-keyframes spin {
  229 + from { -ms-transform: rotate(0deg); }
  230 + to { -ms-transform: rotate(360deg); }
  231 +}
  232 +@-moz-keyframes spin {
  233 + from { -moz-transform: rotate(0deg); }
  234 + to { -moz-transform: rotate(360deg); }
  235 +}
  236 +@-webkit-keyframes spin {
  237 + from { -webkit-transform: rotate(0deg); }
  238 + to { -webkit-transform: rotate(360deg); }
  239 +}
  240 +@keyframes spin {
  241 + from { transform:rotate(0deg); }
  242 + to { transform:rotate(360deg); }
  243 +}
  244 +
228 /** MEDIA QUERIES *************************************************************/ 245 /** MEDIA QUERIES *************************************************************/
229 246
230 @media all and (max-width: 980px) { 247 @media all and (max-width: 980px) {
web/static/js/swapp.js
@@ -52,11 +52,15 @@ @@ -52,11 +52,15 @@
52 stopped_at = this.stopped_at.format("YYYY-MM-DDTHH:mm:ss"); 52 stopped_at = this.stopped_at.format("YYYY-MM-DDTHH:mm:ss");
53 console.info("Setting time interval from " + started_at + " to " + stopped_at + "…"); 53 console.info("Setting time interval from " + started_at + " to " + stopped_at + "…");
54 active_targets.forEach(function(target){ 54 active_targets.forEach(function(target){
  55 + var targetButton;
55 console.info("Loading CSV data of " + target.name + "…"); 56 console.info("Loading CSV data of " + target.name + "…");
  57 + targetButton = $(".orbiters_filters .target." + target.slug);
  58 + targetButton.addClass('loading');
56 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){ 59 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){
57 console.info("Loaded CSV data of " + target.name + "."); 60 console.info("Loaded CSV data of " + target.name + ".");
58 this$.createTimeSeries(target, data); 61 this$.createTimeSeries(target, data);
59 - return this$.orbits.initOrbiter(target.slug, target.config, data['hci']); 62 + this$.orbits.initOrbiter(target.slug, target.config, data['hci']);
  63 + return targetButton.removeClass('loading');
60 }, function(error){ 64 }, function(error){
61 return console.error('Failed to load CSV data.', error); 65 return console.error('Failed to load CSV data.', error);
62 }); 66 });
web/static/js/swapp.ls
@@ -73,11 +73,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @@ -73,11 +73,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
73 console.info "Setting time interval from #{started_at} to #{stopped_at}…" 73 console.info "Setting time interval from #{started_at} to #{stopped_at}…"
74 active_targets.forEach((target) ~> 74 active_targets.forEach((target) ~>
75 console.info "Loading CSV data of #{target.name}…" 75 console.info "Loading CSV data of #{target.name}…"
  76 + targetButton = $(".orbiters_filters .target.#{target.slug}")
  77 + targetButton.addClass('loading')
76 @loadData(target.slug, started_at, stopped_at).then( 78 @loadData(target.slug, started_at, stopped_at).then(
77 (data) ~> 79 (data) ~>
78 console.info "Loaded CSV data of #{target.name}." 80 console.info "Loaded CSV data of #{target.name}."
79 @createTimeSeries(target, data) 81 @createTimeSeries(target, data)
80 @orbits.initOrbiter(target.slug, target.config, data['hci']) 82 @orbits.initOrbiter(target.slug, target.config, data['hci'])
  83 + targetButton.removeClass('loading')
81 , 84 ,
82 (error) -> console.error('Failed to load CSV data.', error) 85 (error) -> console.error('Failed to load CSV data.', error)
83 ) 86 )
web/view/home.html.jinja2
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 src="{{ static('img/target/'~target.slug~'_128.png') }}" 9 src="{{ static('img/target/'~target.slug~'_128.png') }}"
10 title="{{ target.title }}" 10 title="{{ target.title }}"
11 alt="{{ target.name }}" 11 alt="{{ target.name }}"
12 - class="target {{ 'locked' if target.locked else 'active' }}" 12 + class="target {{ target.slug }} {{ 'locked' if target.locked else 'active' }}"
13 data-target-slug="{{ target.slug }}" 13 data-target-slug="{{ target.slug }}"
14 > 14 >
15 {%- endmacro %} 15 {%- endmacro %}
@@ -150,6 +150,28 @@ @@ -150,6 +150,28 @@
150 .orbiters_filters .target.locked { 150 .orbiters_filters .target.locked {
151 cursor: not-allowed; 151 cursor: not-allowed;
152 } 152 }
  153 + .orbiters_filters .target.loading {
  154 +{# margin: 20px;#}
  155 +{# width: 100px;#}
  156 +{# height: 100px;#}
  157 +{# background: #f00;#}
  158 + -webkit-animation-name: spin;
  159 + -webkit-animation-duration: 4000ms;
  160 + -webkit-animation-iteration-count: infinite;
  161 + -webkit-animation-timing-function: linear;
  162 + -moz-animation-name: spin;
  163 + -moz-animation-duration: 4000ms;
  164 + -moz-animation-iteration-count: infinite;
  165 + -moz-animation-timing-function: linear;
  166 + -ms-animation-name: spin;
  167 + -ms-animation-duration: 4000ms;
  168 + -ms-animation-iteration-count: infinite;
  169 + -ms-animation-timing-function: linear;
  170 + animation-name: spin;
  171 + animation-duration: 4000ms;
  172 + animation-iteration-count: infinite;
  173 + animation-timing-function: linear;
  174 + }
153 175
154 #orbits { 176 #orbits {
155 {# background-image: url('{{ static('img/orbitals_background.png') }}');#} 177 {# background-image: url('{{ static('img/orbitals_background.png') }}');#}