-
Notifications
You must be signed in to change notification settings - Fork 22
/
hello-www.html
893 lines (684 loc) · 23.4 KB
/
hello-www.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
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
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
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<title>Introduction to JavaScript for Shiny Users</title>
<meta charset="utf-8" />
<meta name="author" content="Garrick Aden-Buie" />
<meta name="date" content="2020-01-27" />
<link href="assets/libs/tile-view/tile-view.css" rel="stylesheet" />
<script src="assets/libs/tile-view/tile-view.js"></script>
<link href="assets/libs/animate.css/animate.xaringan.css" rel="stylesheet" />
<link href="assets/libs/panelset/panelset.css" rel="stylesheet" />
<script src="assets/libs/panelset/panelset.js"></script>
<link href="assets/libs/js4shiny/css/_variables-fonts.css" rel="stylesheet" />
<link href="assets/libs/js4shiny/css/_variables.css" rel="stylesheet" />
<link href="assets/libs/js4shiny/css/code.css" rel="stylesheet" />
<link href="assets/libs/js4shiny/jsonview/jsonview.css" rel="stylesheet" />
<script src="assets/libs/js4shiny/jsonview/jsonview.min.js"></script>
<link href="assets/libs/js4shiny-redirectConsoleLog/jslog.css" rel="stylesheet" />
<script src="assets/libs/js4shiny-redirectConsoleLog/redirectConsoleLog.js"></script>
<meta name="description" content="Slides for "Hello World Wide Web" from the "JavaScript for Shiny Users" workshop at rstudio::conf(2020)"/>
<meta name="twitter:title" content="Hello World Wide Web | JavaScript for Shiny Users"/>
<meta name="twitter:description" content="Slides for "Hello World Wide Web" from the "JavaScript for Shiny Users" workshop at rstudio::conf(2020)"/>
<meta name="twitter:url" content="https://js4shiny.com"/>
<meta name="twitter:image:src" content="https://slides.js4shiny.com/assets/img/js4shiny-preview.jpg"/>
<meta name="twitter:image:alt" content="Hex logo of the js4shiny workshop and package"/>
<meta name="twitter:card" content="summary"/>
<meta name="twitter:creator" content="@grrrck"/>
<meta name="twitter:site" content="@grrrck"/>
<meta name="og:title" content="Hello World Wide Web | JavaScript for Shiny Users"/>
<meta name="og:description" content="Slides for "Hello World Wide Web" from the "JavaScript for Shiny Users" workshop at rstudio::conf(2020)"/>
<meta name="og:url" content="https://js4shiny.com"/>
<meta name="og:image" content="https://slides.js4shiny.com/assets/img/js4shiny-preview.jpg"/>
<meta name="og:image:alt" content="Hex logo of the js4shiny workshop and package"/>
<meta name="og:type" content="website"/>
<meta name="og:locale" content="en_US"/>
<meta name="article:author" content="Garrick Aden-Buie"/>
<link rel="stylesheet" href="assets/css/js4shiny-xaringan-base.css" type="text/css" />
<link rel="stylesheet" href="assets/css/tachyons.min.css" type="text/css" />
<link rel="stylesheet" href="assets/css/js4shiny-xaringan-extra.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: title
<h1>Hello World Wide Web</h1>
<h2>JavaScript for Shiny Users</h2>
<div class="rstudio-conf-logo"></div>
<div class="talk-meta">
<p class="talk-author">Garrick Aden-Buie</p>
<p class="talk-date">rstudio::conf(2020, "JavaScript for Shiny Users")</p>
</div>
---
class: break break-javascript bottom right
## JS<br>CSS<br>HTML<br>...WTF?
---
name: how-it-works
layout: true
# How does the web work?
???
* Browser requests `rstudio.com`
* gets `rstudio.com/index.html`
* `index.html` says here's the document
* and you also need these other files
* browser reads document structure, styles, javascript
* builds a web page and hands it to you
* what `index.html` says it should be and what the page *is* when you see it are very different
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-04.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-05.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-06.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-07.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-08.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-09.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-10.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-11.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-12.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-13.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-14.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-15.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-16.jpg')
background-size: contain
background-position: top left
---
class: animated fadeIn
background-image: url('assets/img/intro/how-web-works/how-web-works-17.jpg')
background-size: contain
background-position: top left
---
layout: false
class: fullscreen animated zoomIn
background-image: url('assets/img/intro/color-by-number.png')
background-size: cover
background-position: top left
???
* HTML tells the browser **what**:
* content
* images
* other files
---
class: fullscreen
background-image: url('assets/img/intro/anna-kolosyuk-D5nh6mCW52c-unsplash.jpg')
background-size: cover
background-position: top left
???
* CSS tells the browser **how** to show things to you
---
class: fullscreen
background-image: url('assets/img/intro/alice-achterhof-FwF_fKj5tBo-unsplash.jpg')
background-size: cover
background-position: 0 -50px
???
* JavaScript can step in at any point and mess with the whole process
---
name: button-example
class: fullscreen h-100
.pa2.pl3[
## HTML
]
.fl.w-70.pa2.pl3.nt3[
```html
<button id="button-demo" value='0'>
&#x1F44D; Plus one
</button>
```
]
.fr.w-30.pa2.pl3.pt3.nt3[
<button value='0'>&#x1F44D; Plus one</button>
]
???
Go through the example twice...
The first time, just showing the basics, focusing on the role of the languages.
The second time, talk through
- connected via `id`
- css controls appearance
- note: appearance _in states_ so sometimes it feels like it does something but it doesn't change the HTML
- js can change the HTML, change the styles, move things around, react etc.
Finally use last block as quick intro to JS
---
class: fullscreen h-100
.pa2.pl3[
## CSS
]
.fl.w-70.pa2.pl3.nt3[
```css
#button-demo {
color: #4d8dc9;
background-color: white;
border: 2px solid #4d8dc9;
padding: 0.5em 1em;
}
```
<style type="text/css">
#button-demo {
color: #4d8dc9;
background-color: white;
border: 2px solid #4d8dc9;
padding: 0.5em 1em;
}
</style>
]
<div id="button-demo-no-hover">
.fr.w-30.pa2.pl3.pt3.nt3[
<button id="button-demo" value='0'>&#x1F44D; Plus one</button>
]
</div>
<style>
#button-demo-no-hover #button-demo {
background-color: white;
border: 2px solid #4d8dc9;
color: #4d8dc9;
}
#button-demo-no-hover #button-demo {
transform: scale(1);
}
</style>
---
class: fullscreen h-100
.pa2.pl3[
## CSS
]
.fl.w-70.pa2.pl3.nt3[
```css
#button-demo {
color: #4d8dc9;
background-color: white;
border: 2px solid #4d8dc9;
padding: 0.5em 1em;
}
```
```css
#button-demo:hover {
background-color: #4d8dc9;
color: white;
}
```
<style type="text/css">
#button-demo:hover {
background-color: #4d8dc9;
color: white;
}
</style>
]
<div id="button-demo-no-active">
.fr.w-30.pa2.pl3.pt3.nt3[
<button id="button-demo" value='0'>&#x1F44D; Plus one</button>
]
</div>
<style>#button-demo-no-active #button-demo { transform: scale(1); }</style>
---
class: fullscreen h-100
.pa2.pl3[
## CSS
]
.fl.w-70.pa2.pl3.nt3[
```css
#button-demo {
color: #4d8dc9;
background-color: white;
border: 2px solid #4d8dc9;
padding: 0.5em 1em;
}
#button-demo:hover {
background-color: #4d8dc9;
color: white;
}
```
```css
#button-demo:active {
transform: scale(0.9);
}
```
<style type="text/css">
#button-demo:active {
transform: scale(0.9);
}
</style>
]
.fr.w-30.pa2.pl3.pt3.nt3[
<button id="button-demo" value='0'>&#x1F44D; Plus one</button>
]
---
class: fullscreen h-100
.pa2.pl3[
## JS
]
.fl.w-70.pa2.pl3.nt3[
```js
const btn = document.getElementById('button-demo')
```
```js
btn.addEventListener('click', function() {
let clicks = parseInt(btn.value)
clicks = clicks + 1
btn.value = clicks
btn.innerHTML = `&#x1F44D; Plus one (${clicks})`
console.log('Clicks: ' + clicks)
})
```
<div id="out-button-demo-js"><pre></pre></div>
]
<div id="button-demo-full">
.fr.w-30.pa2.pl3.pt3.nt3[
<button id="button-demo" value='0'>&#x1F44D; Plus one</button>
]
</div>
<div id="out-button-demo-js-reset"><pre></pre></div>
<style type="text/css">
#out-button-demo-js-reset { display: none; }
</style>
---
name: motivation
class: break break-shiny huge
# Shiny + .js
.marker.f5[What can we do with Shiny and Javascript?]
---
# Use color to give feedback
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/01-feedback-color.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/01-feedback-color.html">iframe content</a>
</div></div>
]
---
# Hold your horses...
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/02-feedback-icon-animation_initial.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/02-feedback-icon-animation_initial.html">iframe content</a>
</div></div>
]
---
# Waiting is easier with communication
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/02-feedback-icon-animation_solution.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/02-feedback-icon-animation_solution.html">iframe content</a>
</div></div>
]
---
# Direct attention with animation
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/03-feedback-animation-wiggle.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/03-feedback-animation-wiggle.html">iframe content</a>
</div></div>
]
---
# Send messages to your users
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/04-feedback-update-text.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/04-feedback-update-text.html">iframe content</a>
</div></div>
]
---
# Guide users through your app
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/05-control-focus.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/05-control-focus.html">iframe content</a>
</div></div>
]
---
# Add keyboard shortcuts
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/06-control-keyboard-events.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/06-control-keyboard-events.html">iframe content</a>
</div></div>
]
---
layout: true
# Make R Markdown awesome-r
---
.panelset[
.panel[.panel-name[pkg-stats.Rmd]
```markdown
## ggplot2 {.pkg-stats}
downloads
: 846k/month
stars
: 4.2k
forks
: 1.5k
```
]
.panel[.panel-name[pkg-stats.html]
```html
<h2 class="pkg-stat" id="ggplot2">ggplot2</h2>
<dl>
<dt>downloads</dt>
<dd>846k/month</dd>
<dt>stars</dt>
<dd>4.2k</dd>
<dt>forks</dt>
<dd>1.5k</dd>
</dl>
```
]
.panel[.panel-name[Browser]
.relative.w-100.h-abs-475[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/08-design-rewrite_initial.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/08-design-rewrite_initial.html">iframe content</a>
</div></div>
]]
]
---
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/08-design-rewrite_solution.html" class="fullscreen-iframe-scale-150">
<a href="assets/html/motivate/08-design-rewrite_solution.html">iframe content</a>
</div></div>
]
---
layout: false
# Don't work too hard
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/07-design-add-content.html" class="fullscreen-iframe-scale-150">
<a href="assets/html/motivate/07-design-add-content.html">iframe content</a>
</div></div>
]
---
# Use JavaScript libraries for **fun**
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/09-jslib-typerjs.html" class="fullscreen-iframe-scale-200">
<a href="assets/html/motivate/09-jslib-typerjs.html">iframe content</a>
</div></div>
]
---
# Use JavaScript libraries for **profit**
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/10-jslib-frappe-charts.html" class="fullscreen-iframe-scale-125">
<a href="assets/html/motivate/10-jslib-frappe-charts.html">iframe content</a>
</div></div>
]
---
# Use JavaScript libraries for **profit**
.relative.w-100.h-100.ph2[
<div class="fullscreen-iframe-container"><div data-iframe data-src="assets/html/motivate/11-jslib-frappe-charts-extended.html" class="fullscreen-iframe-scale-125">
<a href="assets/html/motivate/11-jslib-frappe-charts-extended.html">iframe content</a>
</div></div>
]
---
layout: true
# Workshop goals
???
One major reason for focusing on some of the fundamentals is that it's an expected baseline in much of the documentation.
Web people and libraries assume you're going to do web things, as anyone whose asked a shiny specific webdev question on stack overflow knows.
R and Shiny package docs focus on being productive with the tools, not necessarily going deep. _How does anybody learn this?_
Having a solid mental model of what web dev is supposed to be like is super helpful.
---
.w-two-thirds.mh-a[
![](assets/img/intro/front-back.png)
]
---
.w-80.mh-a[
![](assets/img/intro/front-back-shiny.jpg)
]
---
class: center middle
# Next: [Maiden Voyage (How to WWW)](how-to-www.html)
</textarea>
<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
<script src="assets/js/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"ratio": "16:9",
"slideNumberFormat": "%current%",
"highlightStyle": "docco",
"highlightLines": true,
"countIncrementalSlides": true
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function(d) {
var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})(document);
(function(d) {
var el = d.getElementsByClassName("remark-slides-area");
if (!el) return;
var slide, slides = slideshow.getSlides(), els = el[0].children;
for (var i = 1; i < slides.length; i++) {
slide = slides[i];
if (slide.properties.continued === "true" || slide.properties.count === "false") {
els[i - 1].className += ' has-continuation';
}
}
var s = d.createElement("style");
s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
d.head.appendChild(s);
})(document);
// delete the temporary CSS (for displaying all slides initially) when the user
// starts to view slides
(function() {
var deleted = false;
slideshow.on('beforeShowSlide', function(slide) {
if (deleted) return;
var sheets = document.styleSheets, node;
for (var i = 0; i < sheets.length; i++) {
node = sheets[i].ownerNode;
if (node.dataset["target"] !== "print-only") continue;
node.parentNode.removeChild(node);
}
deleted = true;
});
})();
// adds .remark-code-has-line-highlighted class to <pre> parent elements
// of code chunks containing highlighted lines with class .remark-code-line-highlighted
(function(d) {
const hlines = d.querySelectorAll('.remark-code-line-highlighted');
const preParents = [];
const findPreParent = function(line, p = 0) {
if (p > 1) return null; // traverse up no further than grandparent
const el = line.parentElement;
return el.tagName === "PRE" ? el : findPreParent(el, ++p);
};
for (let line of hlines) {
let pre = findPreParent(line);
if (pre && !preParents.includes(pre)) preParents.push(pre);
}
preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
})(document);</script>
<!-- scripts from markdown source start -->
<script type="text/javascript">
const log_out_button_demo_js = redirectLogger(document.querySelector("#out-button-demo-js > pre"))
document.addEventListener("DOMContentLoaded", function() {
log_out_button_demo_js(`const btn = document.querySelector('#button-demo-full #button-demo')
btn.addEventListener('click', function() {
let clicks = parseInt(btn.value)
clicks = clicks + 1
btn.value = clicks
btn.innerHTML = \`👍 Plus one (\${clicks})\`
console.log('Clicks: ' + clicks)
})`)
})
</script>
<script type="text/javascript">
const log_out_button_demo_js_reset = redirectLogger(document.querySelector("#out-button-demo-js-reset > pre"))
document.addEventListener("DOMContentLoaded", function() {
log_out_button_demo_js_reset(`const btn = document.querySelector('#button-demo-full #button-demo')
const btnConsole = document.querySelector("#out-button-demo-js pre")
btn.addEventListener('click', function() {
if (parseInt(btn.value) === 13) {
btn.classList.add('animated')
btn.classList.add('hinge')
}
})
slideshow.on('showSlide', () => {
if (parseInt(btn.value) === 13) {
btn.classList.remove('animated')
btn.classList.remove('hinge')
btn.value = 0
btn.innerHTML = '👍 Plus one'
btnConsole.innerHTML = ''
}
})`)
})
</script>
<!-- scripts from markdown source end -->
<script>
(function (d) {
d.addEventListener('DOMContentLoaded', function () {
// find code chunks that get special colors
const langSpecial = ['r', 'js', 'yaml', 'json', 'bash', 'html', 'css']
const codeSpecial = d.querySelectorAll(langSpecial.map(l => 'pre code.' + l))
// find code chunks with highlighted lines
const hlines = d.querySelectorAll('.remark-code-line-highlighted')
const preHLParents = []
const findPreParent = function (line, p = 0) {
if (p > 1) return null // traverse up no further than grandparent
const el = line.parentElement
if (el.tagName === 'PRE') {
return el
} else {
return findPreParent(el, ++p)
}
}
// add the code language to the parent <pre> element
for (const code of codeSpecial) {
const pre = findPreParent(code)
const codeLang = code.className.split(' ').filter(c => langSpecial.includes(c))
pre.classList += ` ${codeLang}`
}
// add remark-code-has-line-highlighted to parent <pre> element
for (const line of hlines) {
const pre = findPreParent(line)
if (pre && !preHLParents.includes(pre)) preHLParents.push(pre)
}
preHLParents.forEach(p => p.classList += ' remark-code-has-line-highlighted')
slideshow.on('afterShowSlide', function (slide) {
replaceIframePlaceholders()
})
replaceIframePlaceholders()
})
})(document)
function replaceIframePlaceholders () {
document
.querySelectorAll('.remark-slides-area .remark-visible div[data-iframe]')
.forEach(el => replaceIframePlaceholder(el))
}
function replaceIframePlaceholder (el) {
const iframe = document.createElement('iframe')
if (el.childNodes) {
el.childNodes.forEach(e => iframe.appendChild(e))
}
iframe.src = el.dataset.src
iframe.classList = el.classList
el.parentElement.replaceChild(iframe, el)
}
</script>
<style>
.remark-code-has-line-highlighted .remark-code-line:not(.remark-code-line-highlighted) {
opacity: 0.4;
}
.remark-code-line-highlighted {
background-color: inherit; /* Override highlight color */
/* font-weight: 500; */
}
/* Line Hover Indicator */
.remark-code-line:hover {
font-weight: bold;
opacity: 1 !important;
}
.remark-code-line:hover:before {
content: "\25B6";
color: #6d7e8a;
position: absolute;
transform: translateX(-1.2em);
animation: hover 0.66s alternate 8 cubic-bezier(0.445, 0.05, 0.55, 0.95);
}
@keyframes hover {
0% {
transform: translateX(-1.2em);
}
100% {
transform: translateX(-0.8em);
}
}
</style>
<script>
(function() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
links[i].target = '_blank';
}
}
})();
</script>
<script>
slideshow._releaseMath = function(el) {
var i, text, code, codes = el.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
};
slideshow._releaseMath(document);
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'FALSE';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>