Blame view

web/view/home.html.jinja2 27.3 KB
9390ec89   Goutte   Initial experimen...
1
2
3
4
{% extends 'layout.html.jinja2' %}
{% set menu_section = 'home' %}
{% block title %}Home{% endblock %}

4900d232   Goutte   Add the time inte...
5
6
7
{# This is the main template file, along with the layout. #}
{# The engine is Jinja2, close to Twig (yet not as good) #}

9390ec89   Goutte   Initial experimen...
8
9
{% block content %}

4cf497e0   Goutte   Make the targets ...
10
{% macro target_button(target) -%}
1ab47144   Goutte   Add new menus, up...
11
    <div class="target {{ target.slug }} {{ 'locked' if target.locked else ('active' if target.default) }}"
80352490   Goutte   Multi model suppo...
12
13
         data-target-slug="{{ target.slug }}">
      <img width="64px" height="64px"
d1c44c51   Goutte   Enable Earth
14
           src="{{ static('img/target/'~target.slug~'_256.png') }}"
80352490   Goutte   Multi model suppo...
15
16
17
18
           title="{{ target.title }}"
           alt="{{ target.name }}">
      <img width="64px" height="64px"
           src="{{ static('img/target/empty_128.png') }}"
60b73eb1   Goutte   Change temperatur...
19
20
           title="No data at specified interval for {{ target.title }}."
           alt="NO DATA"
80352490   Goutte   Multi model suppo...
21
           class="decorator empty">
60b73eb1   Goutte   Change temperatur...
22
23
24
25
26
      <img width="64px" height="64px"
           src="{{ static('img/target/error_128.png') }}"
           title="There was an error with {{ target.title }}."
           alt="ERROR"
           class="decorator error">
80352490   Goutte   Multi model suppo...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
      <div class="decorator loading" title="Loading data for {{ target.title }}…">
        <div class="small-loader-container">
          <div class="small-loader-circle-1">
            <div class="small-loader-circle-2">
              <div class="small-loader-circle-3">
                <div class="small-loader-circle-4">
                  <div class="small-loader-circle-5">
                    <div class="small-loader-circle-6">
                      <div class="small-loader-circle-7">
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
4cf497e0   Goutte   Make the targets ...
46
47
{%- endmacro %}

1ab47144   Goutte   Add new menus, up...
48
49
50
{#############################################################################}

{% macro icon(name,solid=false) %}<i class="fa{{ 's' if solid }} fa-{{ name }}" aria-hidden="true"></i>{% endmacro %}
9c0c4509   Goutte   Add a loader to t...
51

dfa1f66e   Goutte   Move the layers b...
52
53
{#############################################################################}

9c0c4509   Goutte   Add a loader to t...
54
55
56
57
58
59
60
61
62
<div id="plots_loader">
  <p class="loader-text">Loading Heliopropa&hellip;<br>This might take a while.</p>
  <div id="plots_loader_img1" class="img"></div>
  <div id="plots_loader_img2" class="img"></div>
  <div id="plots_loader_img3" class="img"></div>
  <div id="plots_loader_img4" class="img"></div>
  <div id="plots_loader_img5" class="img"></div>
</div>

f6ed8d85   Goutte   Rework layout as ...
63
64
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">

f6ed8d85   Goutte   Rework layout as ...
65
  <div class="mdl-layout__drawer">
297a7dfc   Goutte   Add support for i...
66

dd8621f8   Goutte   Play some accordi...
67
68
69
70
71
72
73
    <details open>
      <summary>
        <span class="mdl-layout-title" title="Two years maximum.">{{ icon('calendar') }} Time Interval</span>
      </summary>

      <form id="form_time_interval" action="#">
        <div class="mdl-textfield mdl-js-textfield">
26733e9f   Goutte   Make the animatio...
74
75
          <input type="date" id="started_at" name="started_at" title="The UTC date of the beginning of the interval to observe." class="mdl-textfield__input">
          <input type="date" id="stopped_at" name="stopped_at" title="The UTC date of the end of the interval to observe. (exclusive)" class="mdl-textfield__input">
dd8621f8   Goutte   Play some accordi...
76
        </div>
26733e9f   Goutte   Make the animatio...
77
        <input type="submit" id="apply_new_interval" value="Load new interval" title="Two years maximum. This may take a while. UTC." class="mdl-button mdl-js-button mdl-js-ripple-effect">
dd8621f8   Goutte   Play some accordi...
78
79
      </form>
    </details>
1754789b   Goutte   Decorate and clea...
80

1754789b   Goutte   Decorate and clea...
81
    <hr class="clear">
4900d232   Goutte   Add the time inte...
82

dd8621f8   Goutte   Play some accordi...
83
84
    <details open>
      <summary>
1ab47144   Goutte   Add new menus, up...
85
        <span class="mdl-layout-title">{{ icon('globe-africa') }} Planets</span>
dd8621f8   Goutte   Play some accordi...
86
      </summary>
f6ed8d85   Goutte   Rework layout as ...
87

dd8621f8   Goutte   Play some accordi...
88
89
90
91
92
93
      <section class="targets-filters">
        {% for target in planets %}
          {{ target_button(target) }}
        {% endfor %}
      </section>
    </details>
a79c5268   Goutte   Add probes and co...
94

a79c5268   Goutte   Add probes and co...
95
96
    <hr class="clear">

befd6269   Goutte   Add Chris' changes.
97
98
{# The probes and comets are not displayed in the ESA version. #}
{% if not is_esa %}
dd8621f8   Goutte   Play some accordi...
99
100
101
102
103
104
105
106
107
108
109
110
111
112
    <details>
      <summary>
        <span class="mdl-layout-title">{{ icon('rocket') }} Probes &amp; Comets</span>
      </summary>

      <section class="targets-filters">
        {% for target in probes %}
          {{ target_button(target) }}
        {% endfor %}
        {% for target in comets %}
          {{ target_button(target) }}
        {% endfor %}
      </section>
    </details>
a79c5268   Goutte   Add probes and co...
113

575e380a   Goutte   Add disabled laye...
114
    <hr class="clear">
befd6269   Goutte   Add Chris' changes.
115
{% endif %}
cdf79b23   Goutte   Give the future d...
116

dd8621f8   Goutte   Play some accordi...
117
118
119
120
    <details>
      <summary>
        <span class="mdl-layout-title">{{ icon('flask') }} Parameters</span>
      </summary>
b550c2b0   Goutte   Rework the home s...
121

dd8621f8   Goutte   Play some accordi...
122
123
124
125
126
127
      <nav id="parameters" class="mdl-navigation">
        {% for p in parameters %}
          <a class="mdl-navigation__link parameter{{ ' active' if p.active }}" data-ts-slug="{{ p.slug }}" href="#" title="{{ p.title }} ({{ p.units }})">{{ p.name }}</a>
        {% endfor %}
      </nav>
    </details>
b550c2b0   Goutte   Rework the home s...
128

1ab47144   Goutte   Add new menus, up...
129
130
    <hr class="clear">

befd6269   Goutte   Add Chris' changes.
131
132
{# The following sections are not displayed in the ESA version. #}
{% if not is_esa %}
1ab47144   Goutte   Add new menus, up...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

    <details>
      <summary>
        <span class="mdl-layout-title">{{ icon('database') }} Inputs</span>
      </summary>

      <section class="section-drawer">
{% for input in config.inputs %}
        <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-input-{{ input.slug }}" title="{{ input.desc }}">
          <input type="radio" id="option-input-{{ input.slug }}" class="mdl-radio__button" name="input_slug" value="{{ input.slug }}" {{ 'checked' if input.slug == input_slug }}>
          <span class="mdl-radio__label">{{ input.name }}</span>
        </label>
        <br />
{% endfor %}
        <br />
        <input disabled type="button" id="apply_new_input" value="Reload for input" title="[COMING SOON] Reloading may take a while." class="mdl-button mdl-js-button mdl-js-ripple-effect">
      </section>
    </details>

    <hr class="clear">

    <details>
      <summary>
        <span class="mdl-layout-title">{{ icon('chart-area') }} Models</span>
      </summary>

      <section class="section-drawer">
        {% for layer in config.layers.models %}
          <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-layer-{{ layer.slug }}" title="{{ layer.desc }}">
            <input type="checkbox" id="option-layer-{{ layer.slug }}" class="mdl-radio__button option-layer" name="option-layer-{{ layer.slug }}" value="{{ layer.slug }}" {{ 'disabled' if not layer.data }}>
            <span class="mdl-radio__label">{{ layer.name }}</span>
          </label>
          <br />
        {% endfor %}
      </section>
    </details>


    <hr class="clear">

    <details>
      <summary>
        <span class="mdl-layout-title">{{ icon('align-right') }} Campaigns</span>
      </summary>

      <section class="section-drawer">
        {% for layer in config.layers.campaigns %}
          <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-layer-{{ layer.slug }}" title="{{ layer.desc }}">
            <input type="checkbox" id="option-layer-{{ layer.slug }}" class="mdl-radio__button option-layer" name="option-layer-{{ layer.slug }}" value="{{ layer.slug }}" {{ 'disabled' if not layer.data }}>
            <span class="mdl-radio__label">{{ layer.name }}</span>
          </label>
          <br />
        {% endfor %}
      </section>
    </details>

dfa1f66e   Goutte   Move the layers b...
189

dd8621f8   Goutte   Play some accordi...
190
    <hr class="clear">
dfa1f66e   Goutte   Move the layers b...
191

dd8621f8   Goutte   Play some accordi...
192
193
    <details>
      <summary>
1ab47144   Goutte   Add new menus, up...
194
        <span class="mdl-layout-title">{{ icon('atlas', true) }} Catalogs</span>
dd8621f8   Goutte   Play some accordi...
195
196
197
      </summary>

      <section class="section-drawer">
1ab47144   Goutte   Add new menus, up...
198
        {% for layer in config.layers.catalogs %}
dd8621f8   Goutte   Play some accordi...
199
          <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-layer-{{ layer.slug }}" title="{{ layer.desc }}">
0332f168   Goutte   Initial support f...
200
            <input type="checkbox" id="option-layer-{{ layer.slug }}" class="mdl-radio__button option-layer" name="option-layer-{{ layer.slug }}" value="{{ layer.slug }}" {{ 'disabled' if not layer.data }}>
dd8621f8   Goutte   Play some accordi...
201
202
203
204
205
206
            <span class="mdl-radio__label">{{ layer.name }}</span>
          </label>
          <br />
        {% endfor %}
      </section>
    </details>
dfa1f66e   Goutte   Move the layers b...
207

befd6269   Goutte   Add Chris' changes.
208
209
{% endif %}{# not is_esa #}

a4a9ef03   Goutte   Cache generated C...
210
211
    <div class="mdl-layout-spacer"></div>

c42fea3a   Goutte   Rework the CSS wi...
212
  </div>
80352490   Goutte   Multi model suppo...
213

befd6269   Goutte   Add Chris' changes.
214
{#############################################################################}
80352490   Goutte   Multi model suppo...
215

b7fe650c   Goutte   Misc bundle of ol...
216
  <main id="plots_wrapper" class="mdl-layout__content">
9390ec89   Goutte   Initial experimen...
217

b550c2b0   Goutte   Rework the home s...
218
    <div class="mdl-grid">
80352490   Goutte   Multi model suppo...
219
      <div class="mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">
b550c2b0   Goutte   Rework the home s...
220
        <section id="orbits"></section>
cad44b6d   Goutte   Finish adding the...
221
        <div class="plots-actions plots-buttons">
dfa1f66e   Goutte   Move the layers b...
222
223
          <button id="zoom_inner_heliosphere"
                  class="mdl-button mdl-button--raised mdl-button--primary"
3c2b15fc   Goutte   Make the Y-Axis o...
224
225
226
                  title="Zoom to the inner heliosphere.">
            Zoom in
          </button>
dfa1f66e   Goutte   Move the layers b...
227
228
          <button id="zoom_outer_heliosphere"
                  class="mdl-button mdl-button--raised mdl-button--primary"
3c2b15fc   Goutte   Make the Y-Axis o...
229
230
231
232
233
                  title="Zoom to the outer heliosphere.">
            Zoom out
          </button>
        </div>
        <div class="plots-actions plots-buttons">
dfa1f66e   Goutte   Move the layers b...
234
235
          <button id="download"
                  class="mdl-button mdl-button--raised mdl-button--primary"
dc0be992   Goutte   Support having no...
236
                  title="Download the raw data for each selected target and parameters.">
cad44b6d   Goutte   Finish adding the...
237
            Download
51d614e6   Goutte   Add a spinner to ...
238
            <div id="download_spinner" class="mdl-spinner mdl-js-spinner is-active"></div>
cad44b6d   Goutte   Finish adding the...
239
          </button>
befd6269   Goutte   Add Chris' changes.
240
{% if not is_esa %}
dfa1f66e   Goutte   Move the layers b...
241
242
          <button id="samp"
                  class="samp mdl-button mdl-button--raised mdl-button--primary mdl-button--disabled"
dd8621f8   Goutte   Play some accordi...
243
                  title="Send the data to a connected SAMP hub, such as TOPCAT.">
cad44b6d   Goutte   Finish adding the...
244
245
            SAMP
          </button>
ea45ebf9   Goutte   Add the mocks of ...
246
          <button id="email_alert"
dd8621f8   Goutte   Play some accordi...
247
248
249
                  class="mdl-button mdl-button--raised mdl-button--primary"
                  title="Set an alert to receive an email when the data validates pre-defined conditions."
                  data-href="http://alerts-psws.irap.omp.eu/tao">
ea45ebf9   Goutte   Add the mocks of ...
250
251
            Alert
          </button>
befd6269   Goutte   Add Chris' changes.
252
{% endif %}
cad44b6d   Goutte   Finish adding the...
253
        </div>
b550c2b0   Goutte   Rework the home s...
254
      </div>
80352490   Goutte   Multi model suppo...
255
      <div class="mdl-cell mdl-cell--8-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">
9c0c4509   Goutte   Add a loader to t...
256
257
258
        <section id="time_series">
          <p id="zoom_controls_help" class="help mdl-cell--8-col">Drag to zoom in, double click to zoom out.</p>
        </section>
b550c2b0   Goutte   Rework the home s...
259
260
261
      </div>
    </div>

f6ed8d85   Goutte   Rework layout as ...
262
263
  </main>
</div>
9390ec89   Goutte   Initial experimen...
264
265
266
{% endblock %}


80352490   Goutte   Multi model suppo...
267
{#### CSS ####################################################################}
7d6dee0f   Goutte   Continue refacto ...
268

9390ec89   Goutte   Initial experimen...
269
270
{% block styles %}
  <style>
dd8621f8   Goutte   Play some accordi...
271
272
273
274
    .mdl-layout__drawer hr {
      margin: 0.5em 0;
    }
    .mdl-layout__drawer .mdl-layout-title {
b500e561   Goutte   Invert the orbits...
275
      line-height: 42px;
dd8621f8   Goutte   Play some accordi...
276
      display: inline-block;
b500e561   Goutte   Invert the orbits...
277
    }
dd8621f8   Goutte   Play some accordi...
278
279
280
281
282
283
    .mdl-layout__drawer > details > summary {
      padding-left: 15px;
      cursor: pointer;
      outline: none;
    }
    .mdl-layout__drawer .mdl-layout-title:first-of-type {
b500e561   Goutte   Invert the orbits...
284
      line-height: 60px;
23110c4a   Goutte   Add icons to the ...
285
286
    }

cad44b6d   Goutte   Finish adding the...
287
288
    .plots-buttons {
      text-align: center;
65d1589b   Goutte   Fix the margins o...
289
      margin: 0 auto;
6b149919   Goutte   Add a Download bu...
290
    }
cad44b6d   Goutte   Finish adding the...
291
    .plots-buttons button {
65d1589b   Goutte   Fix the margins o...
292
      margin: 1em 1em;
cad44b6d   Goutte   Finish adding the...
293
    }
6b149919   Goutte   Add a Download bu...
294

80352490   Goutte   Multi model suppo...
295
296
297
    #time_series svg {
      cursor: crosshair;
    }
9c0c4509   Goutte   Add a loader to t...
298
299
300
301
302
303
304
305
306
307
308
    #time_series .help {
      position: absolute;
      text-align: center;
      font-size: 0.9em;
      font-style: italic;
      color: darkgrey;
      display: none;
    }
    #time_series:hover .help {
      display: block;
    }
f57c94fe   Goutte   Clean up.
309
310
311
312
    #time_series svg .brush .selection {
      fill: #efa02c;
      fill-opacity: 0.382;
    }
18f38374   Goutte   Crisp edges for a...
313
314
    .axis path, .axis line {
      fill: none;
f6ed8d85   Goutte   Rework layout as ...
315
{#      stroke: #f4f4f4;#}
18f38374   Goutte   Crisp edges for a...
316
317
318
      shape-rendering: crispEdges;
      stroke-width: 1px;
    }
9390ec89   Goutte   Initial experimen...
319
320
321
322
323
    path.line {
      fill: none;
      stroke: steelblue;
      stroke-width: 1px;
    }
cdf79b23   Goutte   Give the future d...
324
325
    path.predictive-line {
      fill: none;
dfa1f66e   Goutte   Move the layers b...
326
      stroke: #ff4081;
cdf79b23   Goutte   Give the future d...
327
328
      stroke-width: 2px;
    }
81c9b2e8   Goutte   Add the values to...
329
    circle.cursor-circle {
b550c2b0   Goutte   Rework the home s...
330
331
332
333
334
335
336
337
      fill: black;
      stroke: rgba(20, 20, 20, 0.48);
    }
    text.cursor-text {
{#      font-family: 'Ubuntu', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;#}
{#      font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;#}
      font-family: "Ubuntu Mono", 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
      text-align: right;
81c9b2e8   Goutte   Add the values to...
338
339
340
    }
    text.cursor-text-shadow {
      stroke: white;
b550c2b0   Goutte   Rework the home s...
341
342
      stroke-width: 5px;
      opacity: 0.777
81c9b2e8   Goutte   Add the values to...
343
    }
c42fea3a   Goutte   Rework the CSS wi...
344
    path.orbit.orbit_section {
2d2af24b   Goutte   Add a basic orbit...
345
346
      fill: none;
      stroke: steelblue;
1324cc91   Goutte   Make the footer i...
347
      stroke-width: 1.5px;
c42fea3a   Goutte   Rework the CSS wi...
348
349
350
351
352
353
354
    }
    ellipse.orbit.orbit_ellipse {
      fill: none;
      stroke: #a3a3a3;
      stroke-width: 1px;
      stroke-dasharray: 5px;
    }
1754789b   Goutte   Decorate and clea...
355
356
357
358
359
360
361
362
363
    #form_time_interval {
      padding-left: 30px;
    }
    #form_time_interval .mdl-textfield {
      padding-top: 0;
    }
    #started_at, #stopped_at {
      width: 85%;
    }
297a7dfc   Goutte   Add support for i...
364
365
366
    .section-drawer {
      padding-left: 3em;
    }
4900d232   Goutte   Add the time inte...
367
    .targets-filters {
a79c5268   Goutte   Add probes and co...
368
369
      padding-left: 17px;
    }
4900d232   Goutte   Add the time inte...
370
    .targets-filters .target {
c42fea3a   Goutte   Rework the CSS wi...
371
      float: left;
4cf497e0   Goutte   Make the targets ...
372
      cursor: pointer;
80352490   Goutte   Multi model suppo...
373
      position: relative;
c42fea3a   Goutte   Rework the CSS wi...
374
    }
4900d232   Goutte   Add the time inte...
375
    .targets-filters .target:not(.active) {
c42fea3a   Goutte   Rework the CSS wi...
376
377
378
      -webkit-filter: grayscale(100%);
         -moz-filter: grayscale(100%);
           -o-filter: grayscale(100%);
ddd9e89c   Goutte   Add metadata to S...
379
{#          -ms-filter: grayscale(100%);#}
c42fea3a   Goutte   Rework the CSS wi...
380
381
              filter: grayscale(100%);
    }
4900d232   Goutte   Add the time inte...
382
    .targets-filters .target.locked {
4cf497e0   Goutte   Make the targets ...
383
384
      cursor: not-allowed;
    }
4900d232   Goutte   Add the time inte...
385
    .targets-filters .target.loading {
6491a1f1   Goutte   Fix up the bugs l...
386
        -webkit-animation-name: keyframes_rotate;
93ee5563   Goutte   Add a loading ani...
387
388
389
        -webkit-animation-duration: 4000ms;
        -webkit-animation-iteration-count: infinite;
        -webkit-animation-timing-function: linear;
6491a1f1   Goutte   Fix up the bugs l...
390
        -moz-animation-name: keyframes_rotate;
93ee5563   Goutte   Add a loading ani...
391
392
393
        -moz-animation-duration: 4000ms;
        -moz-animation-iteration-count: infinite;
        -moz-animation-timing-function: linear;
6491a1f1   Goutte   Fix up the bugs l...
394
        -ms-animation-name: keyframes_rotate;
93ee5563   Goutte   Add a loading ani...
395
396
397
        -ms-animation-duration: 4000ms;
        -ms-animation-iteration-count: infinite;
        -ms-animation-timing-function: linear;
6491a1f1   Goutte   Fix up the bugs l...
398
        animation-name: keyframes_rotate;
93ee5563   Goutte   Add a loading ani...
399
400
401
402
        animation-duration: 4000ms;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
    }
c42fea3a   Goutte   Rework the CSS wi...
403

80352490   Goutte   Multi model suppo...
404
405
406
407
408
409
410
411
412
    .targets-filters .target .decorator {
      position: absolute;
      top: 0;
      left: 0;
      display: none;
    }
    .targets-filters .target.empty .decorator.empty {
      display: block;
    }
60b73eb1   Goutte   Change temperatur...
413
414
415
    .targets-filters .target.error .decorator.error {
      display: block;
    }
80352490   Goutte   Multi model suppo...
416
417
418
419
420
421
422
    .targets-filters .target .decorator.loading {
      top:  19px;
      left: 19px;
    }
    .targets-filters .target.loading .decorator.loading {
      display: block;
    }
6f9a3852   Goutte   Hide time series ...
423
424
425

    #parameters .parameter {
      outline: 0;
575e380a   Goutte   Add disabled laye...
426
427
428
      padding-top: 7px;
      padding-bottom: 7px;

6f9a3852   Goutte   Hide time series ...
429
430
431
432
    }
    #parameters .parameter.active {
      background-color: #c8d3e1;
    }
80352490   Goutte   Multi model suppo...
433

f57c94fe   Goutte   Clean up.
434
435
436

    {# CSS Spinners #}

51d614e6   Goutte   Add a spinner to ...
437
438
439
440
441
442
443
444
    #download_spinner {
      display: none;
      top:  2px;
      left: 4px;
      width:  14px;
      height: 14px;
    }

dfa1f66e   Goutte   Move the layers b...
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
    #plots_loader {
      position: fixed;
      top: 0; left: 0; bottom: 0; right: 0;
      height: 100%;
      width: 100%;
      background-color: #fff;
      z-index: 1000;
    }

    #plots_loader .loader-text {
      width: 200px;
      height: 30px;
      position: absolute;
      top: -240px; left: -32px; bottom: 0; right: 0;
      margin: auto;
      text-align: center;
      font-size: 1.0em;
      font-style: italic;
      color: darkgrey;
    }

    #plots_loader .img {
      width: 100px;
      height: 100px;
      border-radius: 100%;
      position: absolute;
      border: 1px solid #6978ff;
      animation: keyframes_rotate 1s;
      animation-iteration-count: infinite;
      transition: 2s;
      border-bottom: none;
      border-right: none;
      animation-timing-function: linear;
      margin-left: -70px;
      margin-top: -70px;
      left: 50%;
      top: 50%;
    }

    #plots_loader #plots_loader_img2 {
      width: 90px;
      height: 90px;
      left: 50.35%;
      top: 50.7%;
      animation-delay: .2s;
    }

    #plots_loader #plots_loader_img3 {
      width: 80px;
      height: 80px;
      left: 50.70%;
      top: 51.4%;
      animation-delay: .4s;
    }

    #plots_loader #plots_loader_img4 {
      width: 70px;
      height: 70px;
      left: 51.05%;
      top: 52.1%;
      animation-delay: .6s;
    }

    #plots_loader #plots_loader_img5 {
      width: 60px;
      height: 60px;
      left: 51.40%;
      top: 52.8%;
      animation-delay: .8s;
    }

    @keyframes keyframes_rotate {
      from {
        transform: rotate(0deg);
      }
      50% {
        transform: rotate(180deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }

604616e4   Goutte   Misc changes from...
528
529
530
531
532
533
    .small-loader-container {
      width: 27px;
      margin: 0 auto;
      background: none;
      pointer-events: none;
    }
604616e4   Goutte   Misc changes from...
534
535
536
537
538
    .small-loader-circle-1 {
      height: 27px;
      width: 27px;
      background: rgba(255, 238, 195, 0.72);
    }
604616e4   Goutte   Misc changes from...
539
540
541
542
    .small-loader-circle-2 {
      height: 22px;
      width: 22px;
      background: none;
604616e4   Goutte   Misc changes from...
543
    }
604616e4   Goutte   Misc changes from...
544
545
546
547
548
    .small-loader-circle-3 {
      height: 18px;
      width: 18px;
      background: rgba(29, 65, 255, 0.9);
    }
604616e4   Goutte   Misc changes from...
549
550
551
552
    .small-loader-circle-4 {
      height: 13px;
      width: 13px;
      background: none;
604616e4   Goutte   Misc changes from...
553
    }
604616e4   Goutte   Misc changes from...
554
555
556
557
558
    .small-loader-circle-5 {
      height: 9px;
      width: 9px;
      background: rgba(238, 238, 238, 0.8);
    }
604616e4   Goutte   Misc changes from...
559
560
561
562
    .small-loader-circle-6 {
      height: 4px;
      width: 4px;
      background: none;
604616e4   Goutte   Misc changes from...
563
    }
604616e4   Goutte   Misc changes from...
564
565
566
567
568
    .small-loader-circle-7 {
      height: 2px;
      width: 2px;
      background: rgb(110, 102, 255);
    }
604616e4   Goutte   Misc changes from...
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
    .small-loader-circle-1,
    .small-loader-circle-2,
    .small-loader-circle-3,
    .small-loader-circle-4,
    .small-loader-circle-5,
    .small-loader-circle-6,
    .small-loader-circle-7 {
      border-bottom: none;
      border-radius: 50%;
        -o-border-radius: 50%;
        -ms-border-radius: 50%;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
      box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
        -o-box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
        -ms-box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
        -webkit-box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
        -moz-box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
      animation-name: small-loader-spin;
        -o-animation-name: small-loader-spin;
        -ms-animation-name: small-loader-spin;
        -webkit-animation-name: small-loader-spin;
        -moz-animation-name: small-loader-spin;
      animation-duration: 4600ms;
        -o-animation-duration: 4600ms;
        -ms-animation-duration: 4600ms;
        -webkit-animation-duration: 4600ms;
        -moz-animation-duration: 4600ms;
      animation-iteration-count: infinite;
        -o-animation-iteration-count: infinite;
        -ms-animation-iteration-count: infinite;
        -webkit-animation-iteration-count: infinite;
        -moz-animation-iteration-count: infinite;
      animation-timing-function: linear;
        -o-animation-timing-function: linear;
        -ms-animation-timing-function: linear;
        -webkit-animation-timing-function: linear;
        -moz-animation-timing-function: linear;
    }

604616e4   Goutte   Misc changes from...
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
    @keyframes small-loader-spin {
      from {
        transform: rotate(0deg);
      }
      to {
        transform: rotate(360deg);
      }
    }

    @-o-keyframes small-loader-spin {
      from {
        -o-transform: rotate(0deg);
      }
      to {
        -o-transform: rotate(360deg);
      }
    }

    @-ms-keyframes small-loader-spin {
      from {
        -ms-transform: rotate(0deg);
      }
      to {
        -ms-transform: rotate(360deg);
      }
    }

    @-webkit-keyframes small-loader-spin {
      from {
        -webkit-transform: rotate(0deg);
      }
      to {
        -webkit-transform: rotate(360deg);
      }
    }

    @-moz-keyframes small-loader-spin {
      from {
        -moz-transform: rotate(0deg);
      }
      to {
        -moz-transform: rotate(360deg);
      }
    }
80352490   Goutte   Multi model suppo...
653
  
9390ec89   Goutte   Initial experimen...
654
655
656
657
  </style>
{% endblock %}


80352490   Goutte   Multi model suppo...
658
659
{#### JAVASCRIPT #############################################################}

9390ec89   Goutte   Initial experimen...
660
{% block scripts_footer %}
f7a10f28   Goutte   Make our custom m...
661
<script type="application/javascript" src="{{ static('js/vendor/d3-custom.js') }}"></script>
a4a9ef03   Goutte   Cache generated C...
662
<script type="application/javascript" src="{{ static('js/vendor/moment.min.js') }}"></script>
80352490   Goutte   Multi model suppo...
663
<script type="application/javascript" src="{{ static('js/vendor/samp.js') }}"></script>
db69e5a7   Goutte   Continue implemen...
664
<script type="application/javascript" src="{{ static('js/main.js') }}"></script>
9390ec89   Goutte   Initial experimen...
665
666
<script type="application/javascript">

ae0aa7d2   Goutte   Add an x axis lab...
667
668
669
var configuration = {
  time_series_container: '#time_series',
  orbits_container: '#orbits',
bde97e4d   Goutte   Add more changes ...
670
  api: {
297a7dfc   Goutte   Add support for i...
671
672
673
      'data_for_interval': "{{ request.url_root }}<target>_{{ input_slug }}_<started_at>_<stopped_at>.csv",
      'download':          "{{ request.url_root }}<targets>_{{ input_slug }}_<started_at>_<stopped_at>.cdf",
      'samp':              "{{ request.url_root }}<targets>_{{ input_slug }}_<started_at>_<stopped_at>.cdf"
f75faf5f   Goutte   WIP
674
  },
8bd715ad   Goutte   Use a pixel art i...
675
676
677
  sun: {
    img: '{{ static('img/sun_128.png') }}'
  },
bde97e4d   Goutte   Add more changes ...
678
  targets: {
0332f168   Goutte   Initial support f...
679
{% for target in targets %}
a21f81d9   Goutte   Enable Venus and ...
680
    '{{ target.slug }}': {
0332f168   Goutte   Initial support f...
681
682
      slug: "{{ target.slug | escapejs }}",
      name: "{{ target.name | escapejs }}",
1ab47144   Goutte   Add new menus, up...
683
      active: {{ 'true' if target.default else 'false' }},
25071e08   Goutte   Easy fix to suppo...
684
      orbit: { a: {{ target.orbit.semimajor or 0 }}, b: {{ target.orbit.semiminor or 0 }} },
0332f168   Goutte   Initial support f...
685
686
687
688
689
690
691
692
693
694
695
696
      img: '{{ static('img/target/'~target.slug~'_128.png') }}',
      layers: {
{% for catalog_slug, catalog_intervals in target.catalog_layers.iteritems() %}
        "{{ catalog_slug }}": [
{% for interval in catalog_intervals %}
{#        { start: "2018-03-28T00:00:00Z", stop: "2018-03-29T00:00:00Z" },   #}
          {# /!. All datetimes here MUST be suffixed by Z #}
          { start: "{{ interval.start }}", stop: "{{ interval.stop }}" }{{ ',' if not loop.last }}
{% endfor %}
        ]
{% endfor %}
      }
a0e5bc71   Goutte   Keep trying to fi...
697
    }{{ ',' if not loop.last }}
a21f81d9   Goutte   Enable Venus and ...
698
{% endfor %}
aba70d3a   Goutte   Refactor time ser...
699
  },
bde97e4d   Goutte   Add more changes ...
700
701
  parameters: [
{% for p in parameters %}
aba70d3a   Goutte   Refactor time ser...
702
    {
bde97e4d   Goutte   Add more changes ...
703
704
705
706
707
708
      id: "{{ p.slug | escapejs }}",
      title: "{{ p.name | escapejs }} ({{ p.units | escapejs }})",
      active: {{ 'true' if p.active else 'false' }},
      unit: "{{ p.units | escapejs }}"
    }{{ ',' if not loop.last }}
{% endfor %}
aba70d3a   Goutte   Refactor time ser...
709
  ]
0332f168   Goutte   Initial support f...
710
711
712
713
714
715
716
717
718
719
720
721
{#    ,#}
{#  layers: [#}
{#{% for layer in config.layers %}#}
{#    {#}
{#      id: "{{ layer.slug | escapejs }}",#}
{#      data: [#}
{#        { start: "2018-03-08T00:00:00Z", end: "2018-03-20T17:00:00Z" },#}
{#        { start: "2018-03-28T00:00:00", end: "2018-03-29T00:00:00" }#}
{#      ]#}
{#    }{{ ',' if not loop.last }}#}
{#{% endfor %}#}
{#  ]#}
438929a4   Goutte   Rewrite the orbit...
722
};
9390ec89   Goutte   Initial experimen...
723

06a3a1f1   Goutte   Continue bug hunt...
724
var sw;
9390ec89   Goutte   Initial experimen...
725
jQuery().ready(function($){
a975b380   Goutte   Clean up.
726
  // Space Weather app itself, handling data downloads and plot draws.
06a3a1f1   Goutte   Continue bug hunt...
727
  sw = new SpaceWeather(configuration);
2a5f0e9b   Goutte   Force UTC. A bit ...
728
  sw.init("{{ started_at }}Z", "{{ stopped_at }}Z");
ae0aa7d2   Goutte   Add an x axis lab...
729

a975b380   Goutte   Clean up.
730
731
732
733
734
735
736
737
  // User Interface (except plots' interactivity, such as mouse hovers)
  var parameters = $('#parameters');
  var isLastParameterEnabled = function(parameter_id) {
    var s = 0;
    parameters.find('.parameter[data-ts-slug]').each(function(i,p) {
      if ($(p).hasClass('active')) s++;
    });
    return s < 2;
6f9a3852   Goutte   Hide time series ...
738
  };
4cf497e0   Goutte   Make the targets ...
739
740
  var isLastTargetEnabled = function(target_slug) {
    var s = 0;
4900d232   Goutte   Add the time inte...
741
    $(".targets-filters .target:not(.locked)").each(function(i,p) {
fb6cfc7d   Goutte   Make sure we cann...
742
743
744
745
746
      if ($(p).hasClass('active')
          && ! $(p).hasClass('loading')
          && ! $(p).hasClass('empty')
          && ! $(p).hasClass('failed')
      ) { s++; }
4cf497e0   Goutte   Make the targets ...
747
748
749
    });
    return s < 2;
  };
0332f168   Goutte   Initial support f...
750
751
  $(".targets-filters .target:not(.locked)").on("click", function(e){
    if ($(this).hasClass('loading')) return false;
b7fe650c   Goutte   Misc bundle of ol...
752
    var switch_on = ! $(this).hasClass('active');
0332f168   Goutte   Initial support f...
753
    var target_slug = $(this).attr('data-target-slug');
b7fe650c   Goutte   Misc bundle of ol...
754
    if (switch_on) {
0332f168   Goutte   Initial support f...
755
      sw.enableTarget(target_slug);
a975b380   Goutte   Clean up.
756
      $(this).addClass('active');
0332f168   Goutte   Initial support f...
757
758
    } else if ( ! isLastTargetEnabled(target_slug)) {
      sw.disableTarget(target_slug);
a975b380   Goutte   Clean up.
759
      $(this).removeClass('active');
b7fe650c   Goutte   Misc bundle of ol...
760
    }
6f9a3852   Goutte   Hide time series ...
761
762
    return false;
  });
0332f168   Goutte   Initial support f...
763
  parameters.find(".parameter").click(function(e){
4cf497e0   Goutte   Make the targets ...
764
    var switch_on = ! $(this).hasClass('active');
0332f168   Goutte   Initial support f...
765
    var parameter_slug = $(this).attr('data-ts-slug');
4cf497e0   Goutte   Make the targets ...
766
    if (switch_on) {
0332f168   Goutte   Initial support f...
767
      sw.enableParameter(parameter_slug);
4cf497e0   Goutte   Make the targets ...
768
      $(this).addClass('active');
0332f168   Goutte   Initial support f...
769
770
    } else if ( ! isLastParameterEnabled(parameter_slug)) {
      sw.disableParameter(parameter_slug);
4cf497e0   Goutte   Make the targets ...
771
772
773
774
      $(this).removeClass('active');
    }
    return false;
  });
243cd8a4   Goutte   Timestamp party c...
775
776
777
778
779
  $('#apply_new_interval').on("click", function(e){
    var started_at = moment($("#started_at").val());
    var stopped_at = moment($("#stopped_at").val());
    sw.resizeDomain(started_at, stopped_at);
    return false;
6b149919   Goutte   Add a Download bu...
780
  });
297a7dfc   Goutte   Add support for i...
781
782
783
784
785
  $('#apply_new_input').on("click", function(e){
    var new_input_slug = $("input[name='input_slug']:checked").val();
    window.location = "?input_slug="+new_input_slug;
    return false;
  });
0332f168   Goutte   Initial support f...
786
787
788
789
790
791
792
793

  $('.option-layer').on("click", function(e){
    var catalog_slug = $(this).attr('value');
    var checked = $(this).prop('checked');
    if (checked) { sw.showCatalogLayer(catalog_slug); }
    else         { sw.hideCatalogLayer(catalog_slug); }
  });

51d614e6   Goutte   Add a spinner to ...
794
795
  var download_spinner = $('#download_spinner');
  var waiting_for_download = false;
a0e5bc71   Goutte   Keep trying to fi...
796

6b149919   Goutte   Add a Download bu...
797
  $('#download').on("click", function(e){
51d614e6   Goutte   Add a spinner to ...
798
799
800
    if (waiting_for_download) return;
    download_spinner.css('display', 'inline-block');
    waiting_for_download = true;
6b149919   Goutte   Add a Download bu...
801
    var url = sw.buildDownloadUrl();
aa7247d6   Goutte   Generate a CDF fi...
802
    console.info("Downloading " + url);
6b149919   Goutte   Add a Download bu...
803
804
805
806
    $.ajax({
      type: 'GET',
      url: url,
      processData: false,
51d614e6   Goutte   Add a spinner to ...
807
808
809
810
811
      success: function (data) {
        download_spinner.css('display', 'none');
        waiting_for_download = false;
        window.location = url;
      },
6b149919   Goutte   Add a Download bu...
812
      error: function (xhr) {
51d614e6   Goutte   Add a spinner to ...
813
814
        download_spinner.css('display', 'none');
        waiting_for_download = false;
6b149919   Goutte   Add a Download bu...
815
816
817
818
819
820
        console.error('Cannot download.', xhr);
        alert("Our apologies, there was an error while downloading.");
      }
    });
    return false;
  });
3c2b15fc   Goutte   Make the Y-Axis o...
821
822
823
824
825
826
827
828
829
830
  $('#zoom_inner_heliosphere').on("click", function(e){
    console.info("Zooming to inner heliosphere…");
    sw.orbits.zoomToTarget('mars');
    return false;
  });
  $('#zoom_outer_heliosphere').on("click", function(e){
    console.info("Zooming to outer heliosphere…");
    sw.orbits.resize(true);
    return false;
  });
dd8621f8   Goutte   Play some accordi...
831
832
833
834
835
836
  $('#email_alert').on("click", function(e){
    console.info("Setting an alert…");
    var href = $(this).attr("data-href");
    window.open(href);
    return false;
  });
6f9a3852   Goutte   Hide time series ...
837

9390ec89   Goutte   Initial experimen...
838
839
});
</script>
cad44b6d   Goutte   Finish adding the...
840
841

{#### SAMP ###################################################################}
dd8621f8   Goutte   Play some accordi...
842
<script type="application/javascript">
cad44b6d   Goutte   Finish adding the...
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
  jQuery().ready(function ($) {
    // Flag to know when a hub is connected or not
    var isConnected = false;

    // Show SAMP button(s) depending on whether the hub is available or not.
    var onHubAvailability = function (isHubRunning) {
      $(".samp").each(function (index, element) {
        if (isHubRunning) {
          isConnected = true;
          $(element).removeClass('disabled mdl-button--disabled');
        } else {
          isConnected = false;
          $(element).addClass('disabled mdl-button--disabled');
        }
      });
    };

03452084   Goutte   Make time series'...
860
    // Update the document about the presence of any SAMP hub every 7 sec.
ddd9e89c   Goutte   Add metadata to S...
861
862
863
864
865
    var connector = new samp.Connector("Sender", {
        "samp.name": "Heliopropa",
        "samp.description.text": "{{ config.meta.description }}",
        "samp.icon.url": "http://heliopropa.irap.omp.eu/static/img/target/earth_128.png",
    });
03452084   Goutte   Make time series'...
866
    connector.onHubAvailability(onHubAvailability, 7000);
cad44b6d   Goutte   Finish adding the...
867
868
869
870
871
872
873
874
875
876
877
    window.onunload = function () {
      connector.unregister();
    };

    // Clicking on a SAMP button sends the CDF file to the connected hub.
    $("#samp").click(function (event) {
      event.stopPropagation();
      if ($(this).hasClass('disabled')) { return; }
      // pitfall : connector.connection is ALWAYS undefined here
      if ( ! isConnected) {  // so we use a bool flag instead
        alert("We do not detect any connected SAMP hub.\n" +
03452084   Goutte   Make time series'...
878
              "Wait some more, or try refreshing this page?");
cad44b6d   Goutte   Finish adding the...
879
880
881
882
        return;
      }
      var name = sw.buildSampName();
      var url = sw.buildSampUrl();
aa7247d6   Goutte   Generate a CDF fi...
883
      console.info("Trying to activate SAMP…", name, url);
cad44b6d   Goutte   Finish adding the...
884
885
886
887
888
889
890
891
892
893
894
895
896
897
      connector.runWithConnection(function (connection) {
        var msg = new samp.Message("table.load.cdf", {
          "name": name,
          "url": url // absolute URL required
        });
        connection.notifyAll([msg]);
      }, function (error) {
        var msg = 'Error: ' + error;
        console.error(msg);
        alert(msg);  // let's yell at the user as well
      });
    });
  });
</script>
9390ec89   Goutte   Initial experimen...
898
{% endblock %}