escience_theme 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +75 -7
  2. package/escience.css +321 -87
  3. package/escience.js +189 -421
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -49,9 +49,17 @@ Set the look of a slide with `data-state`, e.g. in reveal.js markdown:
49
49
  <!-- .slide: data-state="standard" -->
50
50
  ```
51
51
 
52
- Presets: `standard`, `title`, `two_pane`, `about`, `keepintouch`. Single
53
- decorations (`white_overlay`, `blue_overlay`, `purple_overlay`,
54
- `black_overlay`, `logo`, `yellow_flag`, …) can be combined freely.
52
+ `data-state` is a space-separated list of words. Presets: `standard`,
53
+ `title`, `two_pane`, `about`, `keepintouch` (or `touch`). Single decorations
54
+ can be combined freely with them and with each other: `white_overlay`,
55
+ `blue_overlay`, `purple_overlay`, `black_overlay`, `logo`, `yellow_flag`,
56
+ `yellow_strip`, `blue_pane_left`, `blue_pane_right`, `touch_pane`,
57
+ `purple_half_circle_top`, `purple_half_circle_bottom`, `purple_strip_bottom`,
58
+ `yellow_half_strip`, `purple_blob`, `right_e_top`, `right_e_bottom`, and
59
+ `clear_background` (moves overlays and panes away, e.g. for an interactive
60
+ background iframe). A slide without `data-state` shows no decorations.
61
+
62
+ A `<footer>` element in a slide is shown in a blue strip at the bottom right.
55
63
 
56
64
  A number from 0 to 10 sets the overlay opacity in tenths: `standard 6` lets a
57
65
  background image show through, `standard 10` is opaque. Without a number the
@@ -59,6 +67,49 @@ overlay is opaque, unless the slide has a background image, video or iframe
59
67
  (`data-background-image`, `-video`, `-iframe`); then it is 0.8, so the
60
68
  background stays faintly visible.
61
69
 
70
+ ## Layout classes
71
+
72
+ For use inside slides, e.g. as HTML in reveal.js markdown.
73
+
74
+ **`.columns`** lays its children out in a grid: two equal columns by default,
75
+ or any `grid-template-columns` value in `--columns`. Further children wrap
76
+ into new rows; `--gap` sets the gap. reveal.js's own `.items-center`,
77
+ `.items-start` etc. align the columns vertically.
78
+
79
+ ```html
80
+ <div class="columns items-center" style="--columns: 7fr 3fr">
81
+ <div>text</div>
82
+ <img src="photo.jpg">
83
+ </div>
84
+ ```
85
+
86
+ **`.card`** is a padded light-gray box with dark text. `.card.bordered` has a
87
+ border only and keeps the slide's colours; `.card.highlight` has a blue
88
+ border. A card inside a filled card is white.
89
+
90
+ **`.stepper`** shows steps one by one. Its `.step` elements are the steps: the
91
+ first one plain, the later ones fragments. The current step (the last one
92
+ shown; the plugin marks it with `.current-step`) gets a blue border if it has
93
+ a border, e.g. as `.step.card`, and only
94
+ its `.detail` is displayed: the `.detail` right after the step, or one inside
95
+ it. `.stepper.preview` shows upcoming steps faded instead of hidden.
96
+ `--columns` and `--gap` on the stepper apply to its `.columns` rows.
97
+
98
+ ```html
99
+ <div class="stepper" style="--columns: 7em repeat(2, 1fr)">
100
+ <div class="step card columns"><strong>Create</strong><span>Generate</span><span>Summarize</span></div>
101
+ <div class="detail columns"><em>e.g.</em><span>Text, code</span><span>Papers</span></div>
102
+ <div class="step card columns fragment"><strong>Find</strong><span>Search</span><span>Predict</span></div>
103
+ <div class="detail columns"><em>e.g.</em><span>Documents</span><span>Outcomes</span></div>
104
+ </div>
105
+ ```
106
+
107
+ ## Printing
108
+
109
+ Decks print with reveal.js's print view (`?print-pdf` in the URL, then print
110
+ to PDF from the browser). Every page gets the decorations of its own slide.
111
+ The overview (Esc) shows every slide with its decorations as well.
112
+
62
113
  ## Development
63
114
 
64
115
  ```sh
@@ -68,10 +119,27 @@ npm test
68
119
 
69
120
  `npm test` renders `test/fixture/deck.html` in Chromium (`CHROME` overrides
70
121
  the executable), screenshots every slide and overview mode, and compares them
71
- pixel by pixel with the theme at `BASELINE_REF` (default `1ef0fd0`, the last
72
- single-file version). Screenshots and diffs land in `test/output/`. Set
73
- `MAX_DIFF` to allow a number of differing pixels per screenshot, e.g. when a
74
- change is intentional.
122
+ with the theme at `BASELINE_REF` (default `v0.2.0`; a revision before 0.2.0,
123
+ such as `1ef0fd0`, loads the old single-file plugin). Each slide must match
124
+ pixel by pixel, and the computed typography (font, weight, style, text
125
+ transform) of every element on it must match too, as must that of the speaker
126
+ notes panel.
127
+ Screenshots and diffs land in `test/output/`. Set `MAX_DIFF` to allow a number
128
+ of differing pixels per screenshot.
129
+
130
+ Every stepper is walked fragment by fragment (exactly the last shown step is
131
+ current, only its details are displayed), and in the overview every thumbnail
132
+ must carry its slide's decorations, removed again when the overview closes.
133
+ A second pass opens the deck in print view and checks that every page shows
134
+ the decorations, logo, link colours and background classes its slide shows on
135
+ screen, and that no decoration covers the slide's heading.
136
+
137
+ Fixture slides can declare what they expect from the current theme:
138
+ `data-expect-opacity` (overlay opacity), `data-expect-selection` (text
139
+ selection colours), `data-fonts-differ` (elements whose typography may differ
140
+ from the baseline) and `data-baseline-differs` (left out of both comparisons because the slide
141
+ changes on purpose). `data-overview-differs` on `.reveal` leaves the overview
142
+ screenshot out of the pixel comparison.
75
143
 
76
144
  ## License
77
145
 
package/escience.css CHANGED
@@ -15,67 +15,47 @@
15
15
  --link-color: var(--nlesc-purple);
16
16
  --link-color-hover: var(--nlesc-yellow);
17
17
 
18
+ /* reveal.js theme variables (black.css reads these; this file loads after it) */
19
+ --r-main-font: "Assistant", sans-serif;
20
+ --r-heading-font: "Nunito", sans-serif;
21
+ --r-heading-font-weight: 700;
22
+ --r-heading-text-transform: none;
23
+ --r-code-font: "Fira Code", monospace;
24
+ --r-selection-color: #fff;
25
+ --r-selection-background-color: var(--nlesc-purple);
18
26
  }
19
27
 
20
28
  /*********************************************
21
29
  * GLOBAL STYLES
22
30
  *
23
- * Scoped to .reveal so that the page around an embedded deck (e.g. a
24
- * NEBULA site) keeps its own typography. Everything the theme draws,
25
- * decorations and speaker notes included, lives inside .reveal.
26
- * :where() keeps the specificity of the bare element selectors, so
27
- * rules like .hljs (code highlighting) still win where they did before.
31
+ * Fonts are set through the --r-* variables above, which the reveal.js
32
+ * theme applies to body text, headings and code. Slide content can
33
+ * override font and weight with ordinary CSS.
34
+ * Rules are scoped to .reveal so that the page around an embedded deck
35
+ * (e.g. a NEBULA site) keeps its own typography. :where() gives a rule
36
+ * the specificity of its bare element selector, so class rules such as
37
+ * .hljs (code highlighting) take precedence.
28
38
  *********************************************/
29
39
 
30
- :where(.reveal), :where(.reveal) p, :where(.reveal) div, :where(.reveal) ul {
31
- font-family: "Assistant", sans-serif !important;
32
- font-optical-sizing: auto;
33
- font-weight: 400 !important;
34
- font-style: normal;
35
- }
40
+ .reveal {
41
+ font-size: 36px; } /* make stuff smaller */
36
42
 
37
- :where(.reveal) h1, :where(.reveal) h2, :where(.reveal) h3 {
38
- font-family: "Nunito" !important;
39
- font-weight: 700 !important;
43
+ /* reveal.css gives these Helvetica; keep them in the theme font */
44
+ .reveal .speaker-notes,
45
+ .reveal .slide-number,
46
+ .reveal .r-overlay {
47
+ font-family: var(--r-main-font);
40
48
  }
41
49
 
42
- :where(.reveal) h4, :where(.reveal) h5, :where(.reveal) h6 {
43
- font-family: "Assistant", sans-serif !important;
44
- font-optical-sizing: auto;
45
- font-weight: 700 !important;
46
- font-style: normal;
50
+ .reveal h4, .reveal h5, .reveal h6 {
51
+ font-family: var(--r-main-font);
47
52
  }
48
53
 
49
54
  :where(.reveal) code {
50
- font-family: "Fira Code", monospace !important;
51
- font-optical-sizing: auto !important;
52
55
  font-weight: 500;
53
- font-style: normal;
54
56
  background-color: var(--gray-transparent);
55
57
  }
56
58
 
57
- .reveal h1,
58
- .reveal h2,
59
- .reveal h3,
60
- .reveal h4,
61
- .reveal h5,
62
- .reveal h6 {
63
- text-transform: none;
64
- }
65
-
66
- .reveal {
67
- font-size: 36px; } /* make stuff smaller */
68
-
69
- :where(.reveal) ::selection {
70
- color: #0f0;
71
- background: var(--nlesc-purple);
72
- text-shadow: none; }
73
-
74
- :where(.reveal) ::-moz-selection {
75
- color: #fff;
76
- background: var(--nlesc-purple);
77
- text-shadow: none; }
78
-
79
59
 
80
60
  /*********************************************
81
61
  * CUSTOM COLORS
@@ -93,6 +73,19 @@
93
73
  .reveal a:hover {
94
74
  color: var(--link-color-hover); }
95
75
 
76
+ /* escience.js marks each slide with the background its links sit on */
77
+ .reveal section[data-escience-links="on-light"] {
78
+ --link-color: var(--nlesc-blue);
79
+ --link-color-hover: var(--nlesc-yellow); }
80
+
81
+ .reveal section[data-escience-links="on-dark"] {
82
+ --link-color: var(--nlesc-yellow);
83
+ --link-color-hover: var(--nlesc-blue); }
84
+
85
+ .reveal section[data-escience-links="on-blue"] {
86
+ --link-color: var(--nlesc-yellow);
87
+ --link-color-hover: var(--nlesc-purple); }
88
+
96
89
  .reveal .roll span:after {
97
90
  color: #fff;
98
91
  background: var(--nlesc-blue); }
@@ -131,10 +124,82 @@
131
124
 
132
125
  .reveal .progress span {
133
126
  background: var(--nlesc-yellow);
134
- -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
135
- -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
136
127
  transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); }
137
128
 
129
+ /*********************************************
130
+ * LAYOUT
131
+ *
132
+ * .columns grid, two equal columns unless --columns gives a
133
+ * grid-template-columns value ("7fr 3fr", "repeat(3, 1fr)");
134
+ * further children wrap into new rows. --gap sets the gap.
135
+ * Combine with reveal.js's .items-center etc. for alignment.
136
+ * .card padded box in light gray, with even spacing between its
137
+ * children; .bordered: border only; .highlight: blue border.
138
+ * A card inside a filled card is white.
139
+ * .stepper steps that appear one by one: .step elements, the first one
140
+ * plain, later ones fragments. The current step (the last one
141
+ * shown, marked .current-step by escience.js) gets a blue
142
+ * border if it has one (e.g. .step.card), and
143
+ * only its .detail is shown: the .detail right after the step or
144
+ * inside it. When the steps are cards, the stepper's other rows
145
+ * line up with the cards' content. .preview shows upcoming steps
146
+ * faded instead of hidden. --columns and --gap on the stepper
147
+ * apply to its .columns rows.
148
+ *
149
+ * --columns and --gap apply only to the element they are set on, so a
150
+ * nested .columns starts from the defaults again.
151
+ *********************************************/
152
+ @property --columns { syntax: "*"; inherits: false; }
153
+ @property --gap { syntax: "*"; inherits: false; }
154
+
155
+ .reveal .columns {
156
+ display: grid;
157
+ grid-template-columns: var(--columns, repeat(2, minmax(0, 1fr)));
158
+ gap: var(--gap, .5em);
159
+ }
160
+
161
+ .reveal .card {
162
+ padding: .4em .6em; /* the stepper's row alignment below uses .6em */
163
+ border: 2px solid var(--light-gray);
164
+ border-radius: 8px;
165
+ background-color: var(--light-gray);
166
+ color: #222;
167
+ text-align: start;
168
+ --r-heading-color: #222;
169
+ --link-color: var(--nlesc-blue);
170
+ --link-color-hover: var(--nlesc-purple);
171
+ }
172
+ .reveal .card > * { margin-block: 0; }
173
+ .reveal .card:not(.columns) > * + * { margin-top: .4em; }
174
+ .reveal .card:not(.bordered) .card:not(.bordered) {
175
+ border-color: white;
176
+ background-color: white;
177
+ }
178
+ .reveal .card.bordered {
179
+ background-color: transparent;
180
+ color: inherit;
181
+ --r-heading-color: inherit;
182
+ --link-color: inherit;
183
+ --link-color-hover: inherit;
184
+ }
185
+ .reveal .card.highlight { border-color: var(--nlesc-blue); }
186
+
187
+ .reveal .stepper { text-align: start; }
188
+ .reveal .stepper > * { --columns: inherit; --gap: inherit; }
189
+ .reveal .stepper > .step.card { margin-block: .4em; }
190
+ .reveal .stepper:has(> .step.card) > :not(.step) { padding-inline: calc(.6em + 2px); }
191
+
192
+ /* escience.js marks the current step with .current-step */
193
+ .reveal .stepper .step.current-step { border-color: var(--nlesc-blue); }
194
+ .reveal .stepper .step:not(.current-step) + .detail,
195
+ .reveal .stepper .step:not(.current-step) .detail {
196
+ display: none;
197
+ }
198
+ .reveal .slides section .stepper.preview .step.fragment:not(.visible) {
199
+ opacity: .35;
200
+ visibility: inherit;
201
+ }
202
+
138
203
  /*********************************************
139
204
  * FOOTER
140
205
  *********************************************/
@@ -154,51 +219,220 @@
154
219
  background-color: var(--dark-gray); } }
155
220
 
156
221
  /*********************************************
157
- * DIM BACKGROUND PICTURES
222
+ * DECORATIONS
223
+ *
224
+ * escience.js inserts one .escience-decorations root per deck (per page in
225
+ * print view) and sets on it:
226
+ * data-show space-separated names of the decorations to show
227
+ * data-logo color | white | part-white
228
+ * --escience-overlay-opacity
229
+ * Hidden decorations sit outside the slide; shown ones slide or fade in.
230
+ * The root has no box of its own, so the decorations are positioned
231
+ * against .reveal (or the print page background).
158
232
  *********************************************/
159
- .dim .backgrounds {
160
- -webkit-filter: brightness(.4) !important;
161
- -moz-filter: brightness(.4) !important;
162
- -o-filter: brightness(.4) !important;
163
- -ms-filter: brightness(.4) !important;
164
- filter: brightness(.4) !important;
165
- -webkit-transition: -webkit-filter 100ms linear;
166
- transition: filter 100ms linear;
167
- }
168
-
169
- .dim_3 .backgrounds {
170
- -webkit-filter: brightness(.3) !important;
171
- -moz-filter: brightness(.3) !important;
172
- -o-filter: brightness(.3) !important;
173
- -ms-filter: brightness(.3) !important;
174
- filter: brightness(.3) !important;
175
- -webkit-transition: -webkit-filter 100ms linear;
176
- transition: filter 100ms linear;
177
- }
178
-
179
- .dim_8 .backgrounds {
180
- -webkit-filter: brightness(.8) !important;
181
- -moz-filter: brightness(.8) !important;
182
- -o-filter: brightness(.8) !important;
183
- -ms-filter: brightness(.8) !important;
184
- filter: brightness(.8) !important;
185
- -webkit-transition: -webkit-filter 100ms linear;
186
- transition: filter 100ms linear;
187
- }
188
-
189
- .backgrounds {
190
- -webkit-filter: brightness(1) !important;
191
- -moz-filter: brightness(1) !important;
192
- -o-filter: brightness(1) !important;
193
- -ms-filter: brightness(1) !important;
194
- filter: brightness(1) !important;
195
- -webkit-transition: -webkit-filter 1s linear;
196
- transition: filter 1s linear;
197
- }
233
+ .escience-decorations { display: contents; }
234
+
235
+ .escience-decorations > * { position: absolute; z-index: 2; }
236
+
237
+ /* Full-size overlays, under everything else */
238
+ .escience-purple-overlay,
239
+ .escience-blue-overlay,
240
+ .escience-white-overlay,
241
+ .escience-black-overlay {
242
+ inset: 0;
243
+ z-index: 1;
244
+ opacity: 0;
245
+ transition: opacity 1s; }
246
+ .escience-purple-overlay { background-color: var(--nlesc-purple); }
247
+ .escience-blue-overlay { background-color: var(--nlesc-blue); }
248
+ .escience-white-overlay { background-color: white; }
249
+ .escience-black-overlay { background-color: black; }
250
+
251
+ /* Panes */
252
+ .escience-blue-pane-left,
253
+ .escience-blue-pane-right,
254
+ .escience-touch-pane {
255
+ top: 0;
256
+ bottom: 0;
257
+ opacity: 0;
258
+ transition: opacity 1s; }
259
+ .escience-blue-pane-left { left: 0; right: 50%; background-color: var(--nlesc-blue); }
260
+ .escience-blue-pane-right { left: 50%; right: 0; background-color: var(--nlesc-blue); }
261
+ .escience-touch-pane {
262
+ left: 0;
263
+ right: 66.6%;
264
+ display: flex;
265
+ align-items: center;
266
+ justify-content: center;
267
+ background-color: white; }
268
+ .escience-touch-pane h1 { color: black; text-align: left; }
269
+
270
+ /* Logo, top left; data-logo picks the variant */
271
+ .escience-logo {
272
+ top: 1.5vh;
273
+ left: -12vw;
274
+ opacity: 0;
275
+ transition: opacity 1s, left 1s; }
276
+ .escience-logo svg { width: 12vw; }
277
+
278
+ /* Shapes */
279
+ .escience-yellow-strip {
280
+ left: -10vw;
281
+ bottom: 0;
282
+ width: 10vw;
283
+ height: 70vh;
284
+ border-radius: 10vw 10vw 0 0;
285
+ background-color: var(--nlesc-yellow);
286
+ transition: left 1s; }
287
+
288
+ .escience-yellow-flag {
289
+ left: -10vh;
290
+ bottom: 5vh;
291
+ width: 10vh;
292
+ height: 12vh;
293
+ border-radius: 0 6vh 6vh 0;
294
+ z-index: 3;
295
+ background-color: var(--nlesc-yellow);
296
+ transition: left 1s, bottom 1s; }
297
+ .escience-yellow-flag svg { position: absolute; height: 10vh; margin: 1vh 0; }
298
+
299
+ .escience-purple-half-circle-top {
300
+ left: 0;
301
+ top: -17vw;
302
+ width: 34vw;
303
+ height: 17vw;
304
+ border-radius: 0 0 20vw 20vw;
305
+ background-color: var(--nlesc-purple);
306
+ transition: top 1s; }
307
+
308
+ .escience-purple-half-circle-bottom {
309
+ left: 0;
310
+ bottom: -10vw;
311
+ width: 20vw;
312
+ height: 10vw;
313
+ border-radius: 20vw 20vw 0 0;
314
+ background-color: var(--nlesc-purple);
315
+ transition: bottom 1s; }
316
+ .escience-purple-half-circle-bottom svg { position: absolute; bottom: 2vw; left: 6vw; width: 8vw; }
317
+
318
+ .escience-purple-strip-bottom {
319
+ right: calc(50% + 17vw);
320
+ bottom: -10vw;
321
+ width: 16vw;
322
+ height: 10vw;
323
+ border-radius: 20vw 20vw 0 0;
324
+ background-color: var(--nlesc-purple);
325
+ transition: bottom 1s; }
326
+
327
+ .escience-yellow-half-strip {
328
+ right: 50%;
329
+ bottom: -25vw;
330
+ width: 17vw;
331
+ height: 25vw;
332
+ border-radius: 20vw 0 0 0;
333
+ background-color: var(--nlesc-yellow);
334
+ transition: bottom 1s; }
335
+
336
+ .escience-purple-blob {
337
+ /* top right: a long and a short drop, joined by a concave curve */
338
+ right: 0;
339
+ top: -50vh;
340
+ width: 10vw;
341
+ height: 50vh;
342
+ border-radius: 0 0 5vw 5vw;
343
+ background-color: var(--nlesc-purple);
344
+ transition: top 1s; }
345
+ .escience-purple-blob::before,
346
+ .escience-purple-blob::after {
347
+ content: "";
348
+ position: absolute;
349
+ right: calc(100% - 1px); /* overlap the long drop by 1px, so no seam shows */
350
+ background-color: var(--nlesc-purple); }
351
+ .escience-purple-blob::before {
352
+ /* the short drop; its inner corner continues into the curve */
353
+ top: 0;
354
+ width: calc(10vw + 1px);
355
+ height: 25vh;
356
+ border-bottom-left-radius: 5vw; }
357
+ .escience-purple-blob::after {
358
+ /* the curve: a 5vw square below the short drop, cut out around its
359
+ bottom left corner; the 1px gradient step smooths the edge */
360
+ top: calc(25vh - 1px);
361
+ width: calc(5vw + 1px);
362
+ height: calc(5vw + 1px);
363
+ background: radial-gradient(circle at 0 100%, transparent 5vw, var(--nlesc-purple) calc(5vw + 1px)); }
364
+
365
+ .escience-right-e {
366
+ top: 10vh;
367
+ right: -4vw;
368
+ width: 4vw;
369
+ z-index: 3;
370
+ transition: right 1s, top 1s; }
371
+
372
+ /* Footer strip, bottom right; holds the slide's <footer> content */
373
+ .escience-blue-strip {
374
+ right: 0;
375
+ bottom: 0;
376
+ border-radius: 20vw 0 0 0;
377
+ background-color: var(--nlesc-blue);
378
+ transform: translateX(100%);
379
+ transition: transform 1s; }
380
+ .escience-footer {
381
+ margin: 1vw 1vw 1vw 3vw;
382
+ text-align: right;
383
+ line-height: 130%; }
384
+ .reveal .escience-footer a { color: white; text-decoration: underline; }
385
+ .reveal .escience-footer a:hover { color: var(--nlesc-purple); }
386
+
387
+ /* Shown */
388
+ [data-show~="purple_overlay"] .escience-purple-overlay,
389
+ [data-show~="blue_overlay"] .escience-blue-overlay,
390
+ [data-show~="white_overlay"] .escience-white-overlay,
391
+ [data-show~="black_overlay"] .escience-black-overlay {
392
+ opacity: var(--escience-overlay-opacity, 1); }
393
+
394
+ [data-show~="blue_pane_left"] .escience-blue-pane-left,
395
+ [data-show~="blue_pane_right"] .escience-blue-pane-right,
396
+ [data-show~="touch_pane"] .escience-touch-pane { opacity: 1; }
397
+
398
+ [data-show~="logo"] .escience-logo { left: 3vw; }
399
+ [data-logo="color"] .escience-logo-color,
400
+ [data-logo="white"] .escience-logo-white,
401
+ [data-logo="part-white"] .escience-logo-part-white { opacity: 1; }
402
+
403
+ [data-show~="yellow_strip"] .escience-yellow-strip { left: 0; }
404
+ [data-show~="yellow_flag"] .escience-yellow-flag { left: 0; }
405
+ [data-show~="purple_half_circle_bottom"] .escience-yellow-flag { bottom: 20vh; }
406
+ [data-show~="purple_half_circle_top"] .escience-purple-half-circle-top { top: 0; }
407
+ [data-show~="purple_half_circle_bottom"] .escience-purple-half-circle-bottom { bottom: 0; }
408
+ [data-show~="purple_strip_bottom"] .escience-purple-strip-bottom { bottom: 0; }
409
+ [data-show~="yellow_half_strip"] .escience-yellow-half-strip { bottom: 0; }
410
+ [data-show~="purple_blob"] .escience-purple-blob { top: 0; }
411
+ [data-show~="right_e_top"] .escience-right-e { top: 10vh; right: 0; }
412
+ [data-show~="right_e_bottom"] .escience-right-e { top: 60vh; right: 0; }
413
+ [data-show~="footer"] .escience-blue-strip { transform: none; }
414
+
415
+ /* clear_background moves overlays and panes away, e.g. for an interactive
416
+ background iframe */
417
+ [data-show~="clear_background"] :is(.escience-purple-overlay, .escience-blue-overlay,
418
+ .escience-white-overlay, .escience-black-overlay, .escience-blue-pane-left,
419
+ .escience-blue-pane-right, .escience-touch-pane) {
420
+ transform: translateY(100vh); }
421
+
422
+ /* overview: each thumbnail's background carries its own decorations, shown
423
+ in their final state and clipped to the thumbnail */
424
+ .reveal.overview .backgrounds .slide-background { overflow: hidden; }
425
+ .reveal.overview .backgrounds .escience-decorations > * { transition: none; }
198
426
 
199
427
  /*********************************************
200
- * ALLOW FOR DECORATIONS
428
+ * SLIDE CONTENT ABOVE DECORATIONS
201
429
  *********************************************/
430
+ /* print view: each page holds its background (with decorations), slide,
431
+ notes and slide number side by side */
432
+ html.reveal-print .reveal .pdf-page > :is(section, .speaker-notes-pdf, .slide-number-pdf) {
433
+ z-index: 10;
434
+ }
435
+
202
436
  .slides {
203
437
  /* puts the slide content above overlays and decorations*/
204
438
  z-index: 10 !important;
package/escience.js CHANGED
@@ -1,11 +1,19 @@
1
- let Escience = {
2
- id: 'Escience',
3
- init: (deck) => {
4
- initDecorations(deck)
5
- }
6
- }
7
-
8
- export default Escience;
1
+ // eScience Center decorations for reveal.js.
2
+ //
3
+ // A slide's data-state lists what it shows: a preset ("standard", "title",
4
+ // ...), decoration names ("blue_overlay", "yellow_flag", ...) and optionally
5
+ // a number 0-10 for the overlay opacity in tenths. The plugin turns that into
6
+ // attributes on a decoration root; escience.css positions and animates the
7
+ // decorations from those attributes:
8
+ //
9
+ // data-show the decorations to show (plus "footer" if the slide has one)
10
+ // data-logo which logo variant is visible: color, white or part-white
11
+ // --escience-overlay-opacity
12
+ //
13
+ // On screen there is one root in the .reveal element, updated on every slide
14
+ // change. In the overview every slide background gets its own root while the
15
+ // overview is open, so the thumbnails look like their slides. In print view
16
+ // (?print-pdf) every page gets its own root, set once from that page's slide.
9
17
 
10
18
  const LOGGING = false;
11
19
 
@@ -15,28 +23,170 @@ function log (content) {
15
23
  }
16
24
  }
17
25
 
18
- // TODO: Refactor this quick hack into a Reveal plugin form (it works at least)
19
- const initDecorations = function(Reveal) {
26
+ const PRESETS = {
27
+ standard: 'logo yellow_flag white_overlay',
28
+ two_pane: 'logo yellow_flag white_overlay blue_pane_right',
29
+ about: 'logo white_overlay blue_pane_left purple_half_circle_top purple_strip_bottom yellow_half_strip',
30
+ touch: 'logo blue_overlay touch_pane purple_blob right_e_bottom',
31
+ keepintouch: 'logo blue_overlay touch_pane purple_blob right_e_bottom',
32
+ title: 'blue_overlay yellow_flag yellow_strip purple_half_circle_bottom purple_blob right_e_top',
33
+ };
34
+
35
+ // Decorations that change the logo variant, the link colours (data-escience-links
36
+ // on the slide) or reveal's has-light/dark-background classes on the slide.
37
+ // Later entries take precedence over earlier ones.
38
+ const EFFECTS = [
39
+ ['purple_overlay', { logo: 'part-white', links: 'on-dark', background: ['-light'] }],
40
+ ['white_overlay', { logo: 'color', links: 'on-light', background: ['+light'] }],
41
+ ['black_overlay', { logo: 'part-white', links: 'on-dark', background: ['-light'] }],
42
+ ['blue_overlay', { logo: 'white', links: 'on-blue', background: ['-light'] }],
43
+ ['blue_pane_right', { background: ['-dark', '+light'] }],
44
+ ['blue_pane_left', { logo: 'white', background: ['-dark', '+light'] }],
45
+ ['touch_pane', { logo: 'color', background: ['-light', '+dark'] }],
46
+ ['purple_half_circle_top', { logo: 'part-white' }],
47
+ ];
48
+
49
+ // Overlays let background images, videos and iframes show through at 0.8
50
+ // unless data-state gives a number.
51
+ const BACKGROUND_MEDIA = ['data-background-image', 'data-background-video', 'data-background-iframe'];
52
+
53
+ function slideState(slide) {
54
+ const words = (slide.getAttribute('data-state') || '').split(/\s+/).filter(Boolean);
55
+ const show = new Set();
56
+ let opacity = BACKGROUND_MEDIA.some(a => slide.hasAttribute(a)) ? 0.8 : 1;
57
+ for (const word of words) {
58
+ if (/^(10|[0-9])$/.test(word)) { opacity = Number(word) / 10; continue; }
59
+ for (const name of (PRESETS[word] || word).split(' ')) show.add(name);
60
+ }
61
+ if (slide.querySelector('footer')) show.add('footer');
62
+
63
+ let logo = 'color', links = null;
64
+ const background = [];
65
+ for (const [name, effect] of EFFECTS) {
66
+ if (!show.has(name)) continue;
67
+ logo = effect.logo || logo;
68
+ links = effect.links || links;
69
+ background.push(...(effect.background || []));
70
+ }
71
+ return { show, opacity, logo, links, background };
72
+ }
73
+
74
+ function render(root, slide) {
75
+ const state = slideState(slide);
76
+ root.dataset.show = [...state.show].join(' ');
77
+ root.dataset.logo = state.logo;
78
+ root.style.setProperty('--escience-overlay-opacity', state.opacity);
79
+
80
+ // Without a footer the strip slides out with its previous content.
81
+ const footer = slide.querySelector('footer');
82
+ if (footer) root.querySelector('.escience-footer').innerHTML = footer.innerHTML;
83
+
84
+ if (state.links) slide.dataset.escienceLinks = state.links;
85
+ else delete slide.dataset.escienceLinks;
86
+ for (const change of state.background) {
87
+ slide.classList.toggle(`has-${change.slice(1)}-background`, change[0] === '+');
88
+ }
89
+ log(`decorations: ${root.dataset.show} (logo ${state.logo}, opacity ${state.opacity})`);
90
+ }
91
+
92
+ // In every .stepper inside `scope`, the last shown .step (a plain one, or a
93
+ // fragment that is visible) gets the class current-step; escience.css
94
+ // highlights it and shows only its details.
95
+ function markSteps(scope) {
96
+ for (const stepper of scope.querySelectorAll('.stepper')) {
97
+ const steps = [...stepper.querySelectorAll('.step')];
98
+ const current = steps.filter(s => !s.classList.contains('fragment') || s.classList.contains('visible')).at(-1);
99
+ for (const step of steps) step.classList.toggle('current-step', step === current);
100
+ }
101
+ }
102
+
103
+ let template;
104
+
105
+ function createRoot(parent) {
106
+ template ??= Object.assign(document.createElement('template'), { innerHTML: DECORATIONS });
107
+ const root = template.content.firstElementChild.cloneNode(true);
108
+ parent.prepend(root);
109
+ return root;
110
+ }
20
111
 
112
+ const Escience = () => {
113
+ let deck, root;
21
114
 
22
- const decoration_elements = `
23
- <div id="blue_pane_left" style="transition: opacity 1s; background-color: var(--nlesc-blue); opacity: 0; position: absolute; left: 0; right: 50%; bottom: 0; top: 0; z-index: 2;"></div>
24
- <div id="blue_pane_right" style="transition: opacity 1s; background-color: var(--nlesc-blue); opacity: 0; position: absolute; left: 50%; right: 0; bottom: 0; top: 0; z-index: 2;"></div>
25
- <div id="touch_pane" style="background-color: white; transition: opacity 1s; opacity: 0; position: absolute; left: 0; right: 66.6%; bottom: 0; top: 0; display: flex; align-items: center; justify-content: center; z-index: 2;">
26
- <h1 style="color: black; text-align: left;">Let's stay<br>in touch</h1>
115
+ const update = () => {
116
+ markSteps(deck.getCurrentSlide());
117
+ if (!deck.isOverview()) render(root, deck.getCurrentSlide());
118
+ };
119
+ const ready = () => { markSteps(deck.getRevealElement()); update(); };
120
+ const steps = () => markSteps(deck.getCurrentSlide());
121
+
122
+ const thumbnailRoots = () => deck.getRevealElement().querySelectorAll('.backgrounds .escience-decorations');
123
+ const showOverview = () => {
124
+ root.dataset.show = '';
125
+ for (const slide of deck.getSlides()) {
126
+ if (slide.slideBackgroundElement) render(createRoot(slide.slideBackgroundElement), slide);
127
+ }
128
+ };
129
+ const hideOverview = () => {
130
+ for (const thumbnail of thumbnailRoots()) thumbnail.remove();
131
+ update();
132
+ };
133
+
134
+ return {
135
+ id: 'Escience',
136
+ init: (reveal) => {
137
+ deck = reveal;
138
+ if (deck.isPrintView()) {
139
+ deck.on('pdf-ready', () => {
140
+ for (const page of deck.getRevealElement().querySelectorAll('.pdf-page')) {
141
+ const slide = page.querySelector('section');
142
+ const background = page.querySelector('.slide-background');
143
+ markSteps(page);
144
+ if (slide && background) render(createRoot(background), slide);
145
+ }
146
+ });
147
+ return;
148
+ }
149
+ root = createRoot(deck.getRevealElement());
150
+ deck.on('ready', ready);
151
+ deck.on('slidechanged', update);
152
+ deck.on('fragmentshown', steps);
153
+ deck.on('fragmenthidden', steps);
154
+ deck.on('overviewshown', showOverview);
155
+ deck.on('overviewhidden', hideOverview);
156
+ },
157
+ destroy: () => {
158
+ if (!root) return;
159
+ deck.off('ready', ready);
160
+ deck.off('slidechanged', update);
161
+ deck.off('fragmentshown', steps);
162
+ deck.off('fragmenthidden', steps);
163
+ deck.off('overviewshown', showOverview);
164
+ deck.off('overviewhidden', hideOverview);
165
+ for (const thumbnail of thumbnailRoots()) thumbnail.remove();
166
+ root.remove();
167
+ },
168
+ };
169
+ };
170
+
171
+ export default Escience;
172
+
173
+ const DECORATIONS = `<div class="escience-decorations">
174
+ <div class="escience-blue-pane-left"></div>
175
+ <div class="escience-blue-pane-right"></div>
176
+ <div class="escience-touch-pane">
177
+ <h1>Let's stay<br>in touch</h1>
27
178
  </div>
28
- <div id="purple_half_circle_top" style="transition: top 1s; opacity: 1; position: absolute; background-color: var(--nlesc-purple); left: 0; top: -17vw; width: 34vw; height: 17vw; border-radius: 0 0 20vw 20vw; z-index: 2;"></div>
29
- <div id="yellow_half_strip" style="opacity: 1; transition: bottom 1s; position: absolute; background-color: var(--nlesc-yellow); right: 50%; bottom: -25vw; width: 17vw; height: 25vw; border-radius: 20vw 0 0 0; z-index: 2;"></div>
30
- <div id="purple_strip_bottom" style="opacity: 1; transition: bottom 1s; position: absolute; background-color: var(--nlesc-purple); right: calc(50% + 17vw); bottom: -10vw; width: 16vw; height: 10vw; border-radius: 20vw 20vw 0 0; z-index: 2;"></div>
31
- <div id="logo_color" style="transition: opacity 1s, left 1s; opacity: 0; position: absolute; left: -12vw; top: 1.5vh; z-index: 2;">
179
+ <div class="escience-purple-half-circle-top"></div>
180
+ <div class="escience-yellow-half-strip"></div>
181
+ <div class="escience-purple-strip-bottom"></div>
182
+ <div class="escience-logo-color escience-logo">
32
183
  <svg
33
184
  xmlns:dc="http://purl.org/dc/elements/1.1/"
34
185
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
35
186
  xmlns:svg="http://www.w3.org/2000/svg"
36
187
  xmlns="http://www.w3.org/2000/svg"
37
188
  viewBox="0 0 182.94 50.27"
38
- version="1.1"
39
- style="width: 12vw;">
189
+ version="1.1">
40
190
  <metadata
41
191
  id="metadata1137">
42
192
  <rdf:RDF>
@@ -168,7 +318,7 @@ const decoration_elements = `
168
318
  id="path1132" />
169
319
  </svg>
170
320
  </div>
171
- <div id="logo_part_white" style="transition: opacity 1s, left 1s; opacity: 0; position: absolute; left: -12vw; top: 1.5vh; z-index: 2;">
321
+ <div class="escience-logo-part-white escience-logo">
172
322
  <svg
173
323
  xmlns:dc="http://purl.org/dc/elements/1.1/"
174
324
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -176,8 +326,7 @@ const decoration_elements = `
176
326
  xmlns="http://www.w3.org/2000/svg"
177
327
  viewBox="0 0 182.94 50.27"
178
328
  version="1.1"
179
- inkscape:version="1.0.2 (1.0.2+r75+1)"
180
- style="width: 12vw;">
329
+ inkscape:version="1.0.2 (1.0.2+r75+1)">
181
330
  <sodipodi:namedview
182
331
  pagecolor="#505050"
183
332
  bordercolor="#eeeeee"
@@ -314,7 +463,7 @@ const decoration_elements = `
314
463
  style="fill:#ffffff;fill-opacity:1" />
315
464
  </svg>
316
465
  </div>
317
- <div id="logo_white" style="transition: opacity 1s, left 1s; opacity: 0; position: absolute; left: -12vw; top: 1.5vh; z-index: 2;">
466
+ <div class="escience-logo-white escience-logo">
318
467
  <svg
319
468
  xmlns:dc="http://purl.org/dc/elements/1.1/"
320
469
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -323,7 +472,6 @@ const decoration_elements = `
323
472
  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
324
473
  viewBox="0 0 182.94 50.27"
325
474
  version="1.1"
326
- style="width: 12vw;"
327
475
  >
328
476
  <metadata
329
477
  id="metadata1137">
@@ -478,18 +626,18 @@ const decoration_elements = `
478
626
  style="fill:#ffffff;fill-opacity:1" />
479
627
  </svg>
480
628
  </div>
481
- <div id="purple_overlay" style="background-color: var(--nlesc-purple); opacity: 0; transition: opacity 1s; position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 1;">
629
+ <div class="escience-purple-overlay">
482
630
  </div>
483
- <div id="blue_overlay" style="background-color: var(--nlesc-blue); opacity: 0; transition: opacity 1s; position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 1;">
631
+ <div class="escience-blue-overlay">
484
632
  </div>
485
- <div id="white_overlay" style="background-color: white; opacity: 0; transition: opacity 1s; position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 1;">
633
+ <div class="escience-white-overlay">
486
634
  </div>
487
- <div id="black_overlay" style="background-color: black; opacity: 0; transition: opacity 1s; position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 1;">
635
+ <div class="escience-black-overlay">
488
636
  </div>
489
- <div id="yellow_strip" style="background-color: var(--nlesc-yellow); transition: left 1s; width: 10vw; height: 70vh; border-radius: 10vw 10vw 0 0; z-index: 2; position: absolute; left: -10vw; bottom: 0;">
637
+ <div class="escience-yellow-strip">
490
638
  </div>
491
- <div id="yellow_flag" style="background-color: var(--nlesc-yellow); transition: left 1s, bottom 1s; width: 10vh; height: 12vh; border-radius: 0 6vh 6vh 0; z-index: 3; position: absolute; left: -10vh; bottom: 5vh; margin: 0; padding: 0;">
492
- <svg id="left_e" style="position: absolute; height: 10vh; margin: 1vh 0; padding: 0;" viewBox="0 0 27 59" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
639
+ <div class="escience-yellow-flag">
640
+ <svg viewBox="0 0 27 59" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
493
641
  <defs>
494
642
  <polygon id="path-1" points="0 0.132265672 26.8359 0.132265672 26.8359 33.3422209 0 33.3422209"></polygon>
495
643
  <polygon id="path-3" points="0 0.662473134 25.2148 0.662473134 25.2148 18.629294 0 18.629294"></polygon>
@@ -518,15 +666,14 @@ const decoration_elements = `
518
666
  </g>
519
667
  </svg>
520
668
  </div>
521
- <div id="purple_half_circle_bottom" style="transition: bottom 1s; background-color: var(--nlesc-purple); width: 20vw; height: 10vw; border-radius: 20vw 20vw 0 0; z-index: 2; position: absolute; left: 0; bottom: -10vw;">
522
- <svg id="left_e"
669
+ <div class="escience-purple-half-circle-bottom">
670
+ <svg
523
671
  xmlns:dc="http://purl.org/dc/elements/1.1/"
524
672
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
525
673
  xmlns:svg="http://www.w3.org/2000/svg"
526
674
  xmlns="http://www.w3.org/2000/svg"
527
675
  viewBox="0 0 182.94 50.27"
528
- version="1.1"
529
- style="position: absolute; bottom: 2vw; left: 6vw; width: 8vw;">
676
+ version="1.1">
530
677
  <metadata
531
678
  id="metadata1137">
532
679
  <rdf:RDF>
@@ -676,391 +823,12 @@ const decoration_elements = `
676
823
  </svg>
677
824
 
678
825
  </div>
679
- <div id="purple_blob" style="transition: top 1s; position: absolute; display: flex; right: 0; top: -50vh; z-index: 2;">
680
- <div style="background-color: var(--nlesc-purple); width: 10vw; height: 25vh; border-radius: 0 0 10vw 10vw;">
681
- </div>
682
- <div style="background-color: var(--nlesc-purple); width: 10vw; height: 50vh; border-radius: 0 0 10vw 10vw;">
683
- </div>
684
- <div class="box" style="background: var(--nlesc-purple); position: absolute; right: 10vw; top: 0; width: 5vw; height: calc(25vh + 5vw); border-corner-shape: scoop; background: yellow; background: linear-gradient(45deg, transparent 10vw, var(--nlesc-purple) 0) bottom left; background-image: radial-gradient(circle at 0 100%, rgba(204,0,0,0) 5vw, var(--nlesc-purple) 15px)">
685
- </div>
686
- </div>
687
- <div id="blue_strip" style="background-color: var(--nlesc-blue); transition: left 1s, right 1s; margin: 0; padding: 0; border-radius: 20vw 0 0 0; z-index: 2; position: absolute; right: -100vw; bottom: 0;">
688
- <div id="footer" style="text-align: right; line-height: 130%; padding: 0; margin: 1vw 1vw 1vw 3vw; bottom: 0; right: 0;">
826
+ <div class="escience-purple-blob"></div>
827
+ <div class="escience-blue-strip">
828
+ <div class="escience-footer">
689
829
  </div>
690
830
  </div>
691
- <svg id="right_e" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 272.549 662.141" style="transition: right 1s, top 1s; position: absolute; top: 10vh; right: -4vw; width: 4vw; z-index: 3;">
831
+ <svg class="escience-right-e" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 272.549 662.141">
692
832
  <path id="Path_88" data-name="Path 88" d="M342.892,527.031q17.52-21.911,45.055-35.264a133.418,133.418,0,0,1,36-11.063V357.814c-33.264,2.515-63.486,9.336-90.408,20.725q-52.012,21.874-88.269,58.407-47.551,46.277-70.694,111.421-23.2,65.132-23.177,141.8,0,77.95,25.652,142.459Q202.723,897.2,251.563,943.4a314.339,314.339,0,0,0,88.213,56.587q37.073,15.944,84.176,19.965V896.642a104.455,104.455,0,0,1-25.345-8.657,178.837,178.837,0,0,1-40.683-27.369Q334.157,838.7,322.27,805.822a202.364,202.364,0,0,1-11.888-69.4h113.57V625.625H309.123q1.256-31.6,8.759-54.767Q325.384,547.762,342.892,527.031Z" transform="translate(-151.403 -357.814)" fill="#fff"/>
693
833
  </svg>
694
- `;
695
-
696
- function insertDecoration() {
697
- if ( window.location.search.match( /print-pdf/gi ) ) {
698
- const backgrounds = document.getElementsByClassName('slide-background');
699
- for (let i = 0; i < backgrounds.length; i++) {
700
- backgrounds[i].insertAdjacentHTML("afterbegin", decoration_elements);
701
- };
702
- } else {
703
- // for viewing slides
704
- const reveal_div = document.querySelectorAll('div.reveal');
705
- // TODO better do this loop with "forEach"
706
- for (let i = 0; i < reveal_div.length; i++) {
707
- reveal_div[i].insertAdjacentHTML("afterbegin", decoration_elements);
708
- };
709
- //$('#decoration').remove(); // without this the fadeIn/fadeOut below does not work. why is this necessary?
710
- };
711
- addDecorations();
712
- }
713
-
714
- Reveal.on( 'ready', event => {
715
- insertDecoration();
716
-
717
- /* set events only after reveal is ready */
718
- Reveal.on( 'slidechanged', event => {
719
- if (overview_shown == false)
720
- {
721
- log("slide changed");
722
- addDecorations();
723
- }
724
- });
725
- Reveal.on( 'overviewshown', event => {
726
- overview_shown = true;
727
- removeDecorations();
728
- });
729
- Reveal.on( 'overviewhidden', event => {
730
- overview_shown = false;
731
- addDecorations();
732
- });
733
- } );
734
-
735
-
736
- function setLogoStyle(style) {
737
- //style must be one of {"logo_color","logo_white","logo_part_white"}
738
-
739
- //unset everything
740
- document.getElementById("logo_color").style.opacity = 0;
741
- document.getElementById("logo_white").style.opacity = 0;
742
- document.getElementById("logo_part_white").style.opacity = 0;
743
-
744
- //set only what we want
745
- document.getElementById(style).style.opacity = 1;
746
- };
747
- var overview_shown = false;
748
- // Overlay opacity in tenths from a number 0-10 in data-state ("standard 6").
749
- // Without a number the overlay is opaque, except over background media,
750
- // which would otherwise be hidden completely; there it stays at 0.8.
751
- const BACKGROUND_MEDIA = ['data-background-image', 'data-background-video', 'data-background-iframe'];
752
- function getOpacity(data_state, slide) {
753
- var opacity = BACKGROUND_MEDIA.some(a => slide.hasAttribute(a)) ? 0.8 : 1.0;
754
- for (let i = 0; i < 11; i++) {
755
- if (data_state.includes(i)) { opacity = i/10; log("opacity set to " + opacity)}
756
- };
757
- return opacity
758
- };
759
- function addDecorations() {
760
- log("set decorations")
761
- let root = document.documentElement;
762
-
763
-
764
- var currentSlide = Reveal.getCurrentSlide();
765
- if (currentSlide.contains(currentSlide.querySelector('footer')))
766
- {
767
- document.getElementById("footer").innerHTML = currentSlide.querySelector('footer').innerHTML;
768
- document.getElementById("blue_strip").style.right = 0;
769
- log("footer (and blue_strip)");
770
- } else {
771
- document.getElementById("blue_strip").style.right = "-" + document.getElementById("blue_strip").offsetWidth + "px";
772
- log("no footer");
773
- };
774
- if ( currentSlide.getAttribute('data-state') )
775
- {
776
- var data_state = currentSlide.getAttribute('data-state')
777
- var opacity = getOpacity(data_state, currentSlide);
778
- log("DS" + data_state)
779
- // pre-set slide designs
780
-
781
- // standard
782
- if ( data_state.includes("standard"))
783
- {
784
- data_state += " logo yellow_flag white_overlay";
785
- };
786
-
787
- // two_pane
788
- if ( data_state.includes("two_pane"))
789
- {
790
- data_state += " logo yellow_flag white_overlay blue_pane_right";
791
- };
792
-
793
- // about
794
- if ( data_state.includes("about"))
795
- {
796
- data_state += " logo white_overlay blue_pane_left purple_half_circle_top purple_strip_bottom yellow_half_strip";
797
- };
798
-
799
- // touch
800
- if ( data_state.includes("touch"))
801
- {
802
- data_state += " logo blue_overlay touch_pane purple_blob right_e_bottom";
803
- };
804
-
805
- // title
806
- if ( data_state.includes("title"))
807
- {
808
- data_state += " blue_overlay yellow_flag yellow_strip purple_half_circle_bottom purple_blob right_e_top";
809
- };
810
-
811
- // individual elements
812
-
813
- // purple overlay
814
- if ( data_state.includes("purple_overlay"))
815
- {
816
- document.getElementById("purple_overlay").style.opacity = opacity;
817
- document.getElementById("purple_overlay").style.transform = "translateY(0)";
818
- document.getElementById("logo_color").style.opacity = 0;
819
- document.getElementById("logo_white").style.opacity = 0;
820
- document.getElementById("logo_part_white").style.opacity = 1;
821
- currentSlide.classList.remove("has-light-background");
822
- root.style.setProperty("--link-color", "var(--nlesc-yellow)");
823
- root.style.setProperty("--link-color-hover", "var(--nlesc-blue)");
824
- log("purple overlay");
825
- } else {
826
- document.getElementById("purple_overlay").style.opacity = 0;
827
- log("no purple overlay");
828
- };
829
-
830
- // white overlay
831
- if ( data_state.includes("white_overlay"))
832
- {
833
- document.getElementById("white_overlay").style.opacity = opacity;
834
- document.getElementById("white_overlay").style.transform = "translateY(0)";
835
- document.getElementById("logo_color").style.opacity = 1;
836
- document.getElementById("logo_white").style.opacity = 0;
837
- document.getElementById("logo_part_white").style.opacity = 0;
838
- currentSlide.classList.add("has-light-background");
839
- root.style.setProperty("--link-color", "var(--nlesc-blue)");
840
- root.style.setProperty("--link-color-hover", "var(--nlesc-yellow)");
841
- log("white overlay");
842
- } else {
843
- document.getElementById("white_overlay").style.opacity = 0;
844
- log("no white overlay");
845
- };
846
-
847
- // black overlay
848
- if ( data_state.includes("black_overlay"))
849
- {
850
- document.getElementById("black_overlay").style.opacity = opacity;
851
- document.getElementById("black_overlay").style.transform = "translateY(0)";
852
- document.getElementById("logo_color").style.opacity = 0;
853
- document.getElementById("logo_white").style.opacity = 0;
854
- document.getElementById("logo_part_white").style.opacity = 1;
855
- currentSlide.classList.remove("has-light-background");
856
- root.style.setProperty("--link-color", "var(--nlesc-yellow)");
857
- root.style.setProperty("--link-color-hover", "var(--nlesc-blue)");
858
- log("black overlay");
859
- } else {
860
- document.getElementById("black_overlay").style.opacity = 0;
861
- log("no black overlay");
862
- };
863
-
864
- // blue overlay
865
- if ( data_state.includes("blue_overlay"))
866
- {
867
- document.getElementById("blue_overlay").style.opacity = opacity;
868
- document.getElementById("blue_overlay").style.transform = "translateY(0)";
869
- document.getElementById("logo_color").style.opacity = 0;
870
- document.getElementById("logo_white").style.opacity = 1;
871
- document.getElementById("logo_part_white").style.opacity = 0;
872
- currentSlide.classList.remove("has-light-background");
873
- root.style.setProperty("--link-color", "var(--nlesc-yellow)");
874
- root.style.setProperty("--link-color-hover", "var(--nlesc-purple)");
875
- log("blue overlay");
876
- } else {
877
- document.getElementById("blue_overlay").style.opacity = 0;
878
- log("no blue overlay");
879
- };
880
-
881
- // blue pane right
882
- if ( data_state.includes("blue_pane_right"))
883
- {
884
- document.getElementById("blue_pane_right").style.opacity = 1;
885
- document.getElementById("blue_pane_right").style.transform = "translateY(0)";
886
- currentSlide.classList.remove("has-dark-background");
887
- currentSlide.classList.add("has-light-background");
888
- log("blue_pane_right");
889
- } else {
890
- document.getElementById("blue_pane_right").style.opacity = 0;
891
- log("no blue_pane_right");
892
- };
893
-
894
- // blue pane left
895
- if ( data_state.includes("blue_pane_left"))
896
- {
897
- document.getElementById("blue_pane_left").style.opacity = 1;
898
- document.getElementById("blue_pane_left").style.transform = "translateY(0)";
899
- setLogoStyle("logo_white");
900
- currentSlide.classList.remove("has-dark-background");
901
- currentSlide.classList.add("has-light-background");
902
- log("blue_pane_left");
903
- } else {
904
- document.getElementById("blue_pane_left").style.opacity = 0;
905
- log("no blue_pane_left");
906
- };
907
-
908
- // touch pane
909
- if ( data_state.includes("touch_pane"))
910
- {
911
- document.getElementById("touch_pane").style.opacity = 1;
912
- document.getElementById("touch_pane").style.transform = "translateY(0)";
913
- setLogoStyle("logo_color");
914
- currentSlide.classList.remove("has-light-background");
915
- currentSlide.classList.add("has-dark-background");
916
- log("touch_pane");
917
- } else {
918
- document.getElementById("touch_pane").style.opacity = 0;
919
- log("no touch_pane");
920
- };
921
-
922
- // logo
923
- if ( data_state.includes("logo"))
924
- {
925
- document.getElementById("logo_color").style.left = 3 + "vw";
926
- document.getElementById("logo_part_white").style.left = 3 + "vw";
927
- document.getElementById("logo_white").style.left = 3 + "vw";
928
- log("logo");
929
- } else {
930
- document.getElementById("logo_color").style.left = -12 + "vw";
931
- document.getElementById("logo_part_white").style.left = -12 + "vw";
932
- document.getElementById("logo_white").style.left = -12 + "vw";
933
- log("no logo");
934
- };
935
-
936
- // yellow strip
937
- if ( data_state.includes("yellow_strip"))
938
- {
939
- document.getElementById("yellow_strip").style.left = 0;
940
- log("yellow_strip");
941
- } else {
942
- document.getElementById("yellow_strip").style.left = -10 + "vw";
943
- log("no yellow_strip");
944
- };
945
-
946
- // yellow flag
947
- if ( data_state.includes("yellow_flag"))
948
- {
949
- document.getElementById("yellow_flag").style.left = 0;
950
- log("yellow_flag");
951
- } else {
952
- document.getElementById("yellow_flag").style.left = -10 + "vh";
953
- log("no yellow_flag");
954
- };
955
-
956
- // purple half circle top
957
- if ( data_state.includes("purple_half_circle_top"))
958
- {
959
- document.getElementById("purple_half_circle_top").style.top = 0;
960
- setLogoStyle("logo_part_white");
961
- log("purple_half_circle_top");
962
- } else {
963
- document.getElementById("purple_half_circle_top").style.top = -17 + "vw";
964
- log("no purple_half_circle_top");
965
- };
966
-
967
- // purple half circle bottom
968
- if ( data_state.includes("purple_half_circle_bottom"))
969
- {
970
- document.getElementById("purple_half_circle_bottom").style.bottom = 0;
971
- document.getElementById("yellow_flag").style.bottom = 20 + "vh";
972
- log("purple_half_circle_bottom");
973
- } else {
974
- document.getElementById("purple_half_circle_bottom").style.bottom = -10 + "vw";
975
- document.getElementById("yellow_flag").style.bottom = 5 + "vh";
976
- log("no purple_half_circle_bottom");
977
- };
978
-
979
- // purple strip bottom
980
- if ( data_state.includes("purple_strip_bottom"))
981
- {
982
- document.getElementById("purple_strip_bottom").style.bottom = 0;
983
- log("purple_strip_bottom");
984
- } else {
985
- document.getElementById("purple_strip_bottom").style.bottom = -10 + "vw";
986
- log("no purple_strip_bottom");
987
- };
988
-
989
- // yellow_half_strip
990
- if ( data_state.includes("yellow_half_strip"))
991
- {
992
- document.getElementById("yellow_half_strip").style.bottom = 0;
993
- log("yellow_half_strip");
994
- } else {
995
- document.getElementById("yellow_half_strip").style.bottom = -25 + "vw";
996
- log("no yellow_half_strip");
997
- };
998
-
999
- // purple blob
1000
- if ( data_state.includes("purple_blob"))
1001
- {
1002
- document.getElementById("purple_blob").style.top = 0;
1003
- log("purple_blob");
1004
- } else {
1005
- document.getElementById("purple_blob").style.top = -50 + "vh";
1006
- log("no purple_blob");
1007
- };
1008
-
1009
- // right_e
1010
- if ( data_state.includes("right_e_top"))
1011
- {
1012
- document.getElementById("right_e").style.top = 10 + "vh";
1013
- document.getElementById("right_e").style.right = 0;
1014
- log("right_e_top");
1015
- } else if ( data_state.includes("right_e_bottom")){
1016
- document.getElementById("right_e").style.top = 60 + "vh";
1017
- document.getElementById("right_e").style.right = 0;
1018
- log("right_e_bottom");
1019
- } else {
1020
- document.getElementById("right_e").style.right = -4 + "vw";
1021
- log("no right_e");
1022
- };
1023
-
1024
- // clear the background so that the overlays don't interfere
1025
- // with underlying iframe
1026
- if ( data_state.includes("clear_background"))
1027
- {
1028
- document.getElementById("purple_overlay").style.transform = "translateY(100vh)";
1029
- document.getElementById("white_overlay").style.transform = "translateY(100vh)";
1030
- document.getElementById("black_overlay").style.transform = "translateY(100vh)";
1031
- document.getElementById("blue_overlay").style.transform = "translateY(100vh)";
1032
- document.getElementById("blue_pane_right").style.transform = "translateY(100vh)";
1033
- document.getElementById("blue_pane_left").style.transform = "translateY(100vh)";
1034
- document.getElementById("touch_pane").style.transform = "translateY(100vh)";
1035
- };
1036
- }
1037
- else
1038
- {
1039
- log("nothing special")
1040
- };
1041
- };
1042
-
1043
- function removeDecorations() {
1044
- log("removeDecorations")
1045
- document.getElementById("purple_overlay").style.opacity = 0;
1046
- document.getElementById("white_overlay").style.opacity = 0;
1047
- document.getElementById("black_overlay").style.opacity = 0;
1048
- document.getElementById("blue_overlay").style.opacity = 0;
1049
- document.getElementById("blue_pane_right").style.opacity = 0;
1050
- document.getElementById("blue_pane_left").style.opacity = 0;
1051
- document.getElementById("touch_pane").style.opacity = 0;
1052
- document.getElementById("logo_color").style.left = -12 + "vw";
1053
- document.getElementById("logo_part_white").style.left = -12 + "vw";
1054
- document.getElementById("logo_white").style.left = -12 + "vw";
1055
- document.getElementById("yellow_strip").style.left = -10 + "vw";
1056
- document.getElementById("yellow_flag").style.left = -10 + "vh";
1057
- document.getElementById("purple_half_circle_top").style.top = -17 + "vw";
1058
- document.getElementById("purple_half_circle_bottom").style.bottom = -10 + "vw";
1059
- document.getElementById("purple_strip_bottom").style.bottom = -10 + "vw";
1060
- document.getElementById("yellow_half_strip").style.bottom = -25 + "vw";
1061
- document.getElementById("purple_blob").style.top = -50 + "vh";
1062
- document.getElementById("right_e").style.right = -4 + "vw";
1063
- document.getElementById("blue_strip").style.right = "-" + document.getElementById("blue_strip").offsetWidth + "px";
1064
- };
1065
-
1066
- }
834
+ </div>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escience_theme",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "eScience Center theme for web presentations",
5
5
  "type": "module",
6
6
  "main": "escience.js",