forked from Quazer/anglerfish
/
angler-presentation.html
2806 lines (2443 loc) · 110 KB
/
angler-presentation.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
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<head>
<meta charset="utf-8"/>
<title>Angler</title>
<link rel=icon type="image/x-icon" href="https://www.python.org/static/favicon.ico">
<meta name=author content="Juan"/>
</head>
<body class="impress-not-supported">
<div class="fallback-message">
<!-- This warning message is shown when web browser dont support the requirements. -->
<p>Your browser <b>does not support the features required</b> by impress.js, so you are presented with a simplified (broken) version of this presentation.</p>
<p>For the best experience please use the latest <b>Chromium</b>, <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p>
<hr>
<p>Tu navegador <b>no soporta las caracteristicas requeridas</b> por impress.js, se presentara una version simplificada (rota) de esta presentacion.</p>
<p>Para una mejor experiencia por favor usa un navegador web actualizado de <b>Chromium</b>, <b>Chrome</b>, <b>Safari</b> o <b>Firefox</b>.</p>
</div>
<div id=impress data-transition-duration=1000 >
<!-- Begins presentation slide number: 0 -->
<div id=0 class="step grayscale" data-rel-x="3804" data-rel-y="6647" data-rotate="41" data-rotate-x="1" data-rotate-y="4" data-x="2717" data-y="6435" data-z="5" data-scale="1">
<h1>Angler</h1>
<p><em>Get things done, K.I.S.S. way...</em></p>
<p><img src="https://raw.githubusercontent.com/juancarlospaco/anglerfish/master/temp.jpg" alt="Anglerfish"></p>
</div>
<!-- Ends presentation slide number: 0 -->
<!-- Begins presentation slide number: 1 -->
<div id=1 class="step grayscale" data-rel-x="4754" data-rel-y="7206" data-rotate="191" data-rotate-x="2" data-rotate-y="3" data-x="1625" data-y="5155" data-z="1" data-scale="8">
<h1>Make a Logger</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a>
<a href="#-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">make_logger</span>
<span class="o">>>></span> <span class="n">log</span> <span class="o">=</span> <span class="n">make_logger</span><span class="p">(</span><span class="s2">"MyAppName"</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"This is a Test."</span><span class="p">)</span>
</pre></div>
</td></tr></table><ul>
<li>Colored, logs to STDOUT, Rotating File, SysLog.</li>
<li>Automatically ZIP compress old rotated logs.</li>
<li>Kittens Emoji on Terminal, optional.</li>
</ul>
</div>
<!-- Ends presentation slide number: 1 -->
<!-- Begins presentation slide number: 2 -->
<div id=2 class="step brightness" data-rel-x="4725" data-rel-y="5543" data-rotate="379" data-rotate-x="3" data-rotate-y="4" data-x="3194" data-y="5466" data-z="5" data-scale="9">
<h1>Set up a Process</h1>
<p><strong>Set Process Name:</strong></p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">set_process_name</span>
<span class="o">>>></span> <span class="n">set_process_name</span><span class="p">(</span><span class="s2">"MyAppName"</span><span class="p">)</span>
</pre></div>
</td></tr></table><ul>
<li>Changes <code>python</code> to <code>MyAppName</code> on System Monitor.</li>
</ul>
<p><strong>Set Single Instance:</strong></p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">set_single_instance</span>
<span class="o">>>></span> <span class="n">set_single_instance</span><span class="p">(</span><span class="s2">"MyAppName"</span><span class="p">)</span>
</pre></div>
</td></tr></table><ul>
<li>Uses <code>socket</code>, no stale lockfiles, hard-reboots.</li>
</ul>
</div>
<!-- Ends presentation slide number: 2 -->
<!-- Begins presentation slide number: 3 -->
<div id=3 class="step saturate" data-rel-x="2970" data-rel-y="8104" data-rotate="60" data-rotate-x="2" data-rotate-y="4" data-x="3450" data-y="5659" data-z="1" data-scale="1">
<h1>Export to eBook</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">html2ebook</span>
<span class="o">>>></span> <span class="n">html2ebook</span><span class="p">((</span><span class="s2">"index.html"</span><span class="p">,</span> <span class="s2">"chapter1.html"</span><span class="p">))</span>
</pre></div>
</td></tr></table><ul>
<li>Optional Metadata <em>(Title, Author, Licence, etc)</em></li>
<li>Pure Python, Compression, Auto-Metadata, etc.</li>
</ul>
</div>
<!-- Ends presentation slide number: 3 -->
<!-- Begins presentation slide number: 4 -->
<div id=4 class="step contrast" data-rel-x="2048" data-rel-y="7994" data-rotate="-72" data-rotate-x="5" data-rotate-y="2" data-x="3334" data-y="8397" data-z="2" data-scale="7">
<h1>Color Design</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_pastelight_color</span>
<span class="o">>>></span> <span class="n">get_random_pastelight_color</span><span class="p">()</span>
</pre></div>
</td></tr></table><ul>
<li>Return random pastel <strong>Light</strong> color from curated list.</li>
</ul>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_pasteldark_color</span>
<span class="o">>>></span> <span class="n">get_random_pasteldark_color</span><span class="p">()</span>
</pre></div>
</td></tr></table><ul>
<li>Return random pastel <strong>Dark</strong> color from curated list.</li>
</ul>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_pastel_color</span>
<span class="o">>>></span> <span class="n">get_random_pastel_color</span><span class="p">()</span>
</pre></div>
</td></tr></table><ul>
<li>Return random pastel color from curated lists.</li>
</ul>
</div>
<!-- Ends presentation slide number: 4 -->
<!-- Begins presentation slide number: 5 -->
<div id=5 class="step huerotate" data-rel-x="3402" data-rel-y="5418" data-rotate="-609" data-rotate-x="1" data-rotate-y="1" data-x="2553" data-y="7464" data-z="3" data-scale="1">
<h1>Font Design</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_handwriting_font</span>
<span class="o">>>></span> <span class="n">get_random_handwriting_font</span><span class="p">()</span>
</pre></div>
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_mono_font</span>
<span class="o">>>></span> <span class="n">get_random_mono_font</span><span class="p">()</span>
</pre></div>
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_display_font</span>
<span class="o">>>></span> <span class="n">get_random_display_font</span><span class="p">()</span>
</pre></div>
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_sans_font</span>
<span class="o">>>></span> <span class="n">get_random_sans_font</span><span class="p">()</span>
</pre></div>
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">get_random_serif_font</span>
<span class="o">>>></span> <span class="n">get_random_serif_font</span><span class="p">()</span>
</pre></div>
</td></tr></table><ul>
<li>Return handwriting, Monospace, Display, Sans, Serif font.</li>
<li>Fonts are randomly choosed from curated lists.</li>
<li>Fonts are Open Source Free, on Google CDN.</li>
</ul>
</div>
<!-- Ends presentation slide number: 5 -->
<!-- Begins presentation slide number: 6 -->
<div id=6 class="step contrast" data-rel-x="3911" data-rel-y="5688" data-rotate="409" data-rotate-x="2" data-rotate-y="2" data-x="4043" data-y="8255" data-z="5" data-scale="9">
<h1>Data URI Base64 WebP</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a>
<a href="#-3">3</a>
<a href="#-4">4</a>
<a href="#-5">5</a>
<a href="#-6">6</a>
<a href="#-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">DataURI</span>
<span class="o">>>></span> <span class="n">DataURI</span><span class="o">.</span><span class="n">from_url</span><span class="p">(</span><span class="s1">'example.com/image.jpg'</span><span class="p">)</span>
<span class="s1">'data:image/webp;charset=utf-8;base64,...'</span>
<span class="o">>>></span> <span class="n">DataURI</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="s1">'image.png'</span><span class="p">,</span> <span class="n">webp</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="s1">'data:image/png;charset=utf-8;base64,...'</span>
<span class="o">>>></span> <span class="n">DataURI</span><span class="o">.</span><span class="n">make</span><span class="p">(</span><span class="s1">'text/plain'</span><span class="p">,</span> <span class="n">base64</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="s1">'Test message'</span><span class="p">)</span>
<span class="s1">'data:text/plain;charset=utf-8;base64,...'</span>
</pre></div>
</td></tr></table><ul>
<li>From file or url or string to Data URI Base64.</li>
<li>Auto-conversion of images to WebP, optional.</li>
</ul>
</div>
<!-- Ends presentation slide number: 6 -->
<!-- Begins presentation slide number: 7 -->
<div id=7 class="step grayscale" data-rel-x="1493" data-rel-y="8496" data-rotate="-633" data-rotate-x="2" data-rotate-y="5" data-x="4890" data-y="7201" data-z="5" data-scale="3">
<h1>MultiCPU MultiThread</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a>
<a href="#-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">multiprocessed</span>
<span class="o">>>></span> <span class="n">multiprocessed</span><span class="p">(</span><span class="n">function</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">cpu_num</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">thread_num</span><span class="o">=</span><span class="mi">6</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">multiprocessed</span><span class="p">(</span><span class="n">function</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">cpu_num</span><span class="o">=</span><span class="mi">6</span><span class="p">,</span> <span class="n">thread_num</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</td></tr></table><ul>
<li>Run on multiple CPU Cores and multiple Threads per CPU.</li>
<li>Optional Timeout.</li>
</ul>
</div>
<!-- Ends presentation slide number: 7 -->
<!-- Begins presentation slide number: 8 -->
<div id=8 class="step " data-rel-x="2017" data-rel-y="7473" data-rotate="491" data-rotate-x="3" data-rotate-y="4" data-x="4856" data-y="7224" data-z="4" data-scale="7">
<h1>Make strings banish</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a>
<a href="#-3">3</a>
<a href="#-4">4</a>
<a href="#-5">5</a>
<a href="#-6">6</a>
<a href="#-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">string2stealth</span>
<span class="o">>>></span> <span class="n">hidden</span> <span class="o">=</span> <span class="n">string2stealth</span><span class="p">(</span><span class="s2">"Test message"</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">hidden</span>
<span class="s2">""</span>
<span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">stealth2string</span>
<span class="o">>>></span> <span class="n">stealth2string</span><span class="p">(</span><span class="n">hidden</span><span class="p">)</span>
<span class="s2">"Test message"</span>
</pre></div>
</td></tr></table><ul>
<li>Screenshot-proof encryptions.</li>
<li>Pack templates on thin air.</li>
<li>No information lost.</li>
</ul>
</div>
<!-- Ends presentation slide number: 8 -->
<!-- Begins presentation slide number: 9 -->
<div id=9 class="step huerotate" data-rel-x="2652" data-rel-y="8682" data-rotate="-177" data-rotate-x="3" data-rotate-y="3" data-x="4683" data-y="6440" data-z="2" data-scale="4">
<h1>Powerful Templating</h1>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#-1">1</a>
<a href="#-2">2</a>
<a href="#-3">3</a>
<a href="#-4">4</a>
<a href="#-5">5</a>
<a href="#-6">6</a>
<a href="#-7">7</a>
<a href="#-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="o">>>></span> <span class="kn">from</span> <span class="nn">anglerfish</span> <span class="kn">import</span> <span class="n">TemplatePython</span>
<span class="o">>>></span> <span class="n">demo</span> <span class="o">=</span> <span class="s2">"""<html><body></span>
<span class="s2">{%</span>
<span class="s2">import calendar</span>
<span class="s2">{{ calendar.HTMLCalendar.formatyearpage(2017) }}</span>
<span class="s2">%} </body></html>"""</span>
<span class="o">>>></span> <span class="n">template</span> <span class="o">=</span> <span class="n">TemplatePython</span><span class="p">(</span><span class="n">demo</span><span class="p">)</span>
<span class="o">>>></span> <span class="n">template</span><span class="p">()</span>
</pre></div>
</td></tr></table><ul>
<li>Generic Template Engine Renders native Python.</li>
<li>Optional Minification for HTML.</li>
<li><code>{% {{ "Render this" }} %}</code></li>
<li><code>{% print("Run this") %}</code></li>
</ul>
</div>
<!-- Ends presentation slide number: 9 -->
<!-- Begins presentation slide number: 10 -->
<div id=10 class="step brightness" data-rel-x="3963" data-rel-y="5621" data-rotate="336" data-rotate-x="2" data-rotate-y="2" data-x="2471" data-y="8289" data-z="4" data-scale="1">
<h1>Thanks ♥</h1>
<p><code>pip install anglerfish</code></p>
<p><a href="https://github.com/juancarlospaco/anglerfish">https://github.com/juancarlospaco/anglerfish</a></p>
<ul>
<li>No Dependencies. Python 3.</li>
<li>Presentation Powered by Anglerfish.</li>
</ul>
</div>
<!-- Ends presentation slide number: 10 -->
<!-- Begins presentation slide overview -->
<div id=overview class=step data-x=1423 data-y=3892 data-scale=7 style='pointer-events:none' data-rotate=-520 ></div>
<!-- Ends presentation slide overview -->
</div>
<div id="impress-toolbar"></div>
<div id="impress-help"></div>
<style>
@import url(https://fonts.googleapis.com/css?family='Monoton');
@import url(https://fonts.googleapis.com/css?family='Ubuntu Mono');
@import url(https://fonts.googleapis.com/css?family='Marmelad');
@import url(https://fonts.googleapis.com/css?family='Julee');
@import url(https://fonts.googleapis.com/css?family='Stoke');
body, .step {font-family: Marmelad};
table, tbody, del {font-family: Stoke};
h1, h2, h3 {font-family: Monoton};
.code, code, pre {font-family: "Ubuntu Mono"};
.blockquote, blockquote, quote {font-family: Julee};
.fallback-message {
font-family: sans-serif;
line-height: 1.3;
width: 780px;
padding: 9px 9px 0;
margin: 9px auto;
border: 1px solid red;
border-radius: 9px;
background: orange
}
.fallback-message p {margin-bottom: 9px}
.impress-supported .fallback-message {display: none}
/* Disable mouse clicks / focus for body */
.impress-enabled {pointer-events: none}
.impress-enabled #impress, .impress-enabled #impress-toolbar {pointer-events: auto}
.notes {display: none}
h1, h2, h3 {text-align: center}
p {margin: .7em}
li {margin: .2em}
.code, code {
background-color: white;
text-shadow: none;
border-radius: 0
}
strike {opacity: .7}
/* Presentation */
body {
background: #fff;
background:
linear-gradient(lemonchiffon, transparent),
linear-gradient(90deg, lightpink, transparent),
linear-gradient(-90deg, skyblue, transparent);
background-blend-mode: screen
}
.step {
position: relative;
width: 900px;
height: 700px;
padding: 40px 60px;
margin: 20px auto;
box-sizing: border-box;
color: dodgerblue;
text-shadow: 0 1px 2px brown;
font-size: 30px;
line-height: 1.5
}
/* Simple effects for non-active slides (blur kills performance so is out) */
.saturate { filter: saturate(3) }
.grayscale { filter: grayscale(99%) }
.contrast { filter: contrast(99%) }
.brightness { filter: brightness(9) }
.invert { filter: invert(99%) }
.sepia { filter: sepia(99%) }
.huerotate { filter: hue-rotate(180deg) }
/* Make inactive steps a little bit transparent */
.impress-enabled .step {
margin: 0;
opacity: .05;
transition: all 1s
}
.impress-enabled .step.active {opacity: 1; filter: none}
/* Plugins */
.impress-enabled div#impress-toolbar {
position: fixed;
right: 1px;
bottom: 1px;
opacity: .6;
}
.impress-enabled div#impress-toolbar > span {margin-right: 9px}
body.impress-mouse-timeout div#impress-toolbar {display: none}
body.impress-mouse-timeout {cursor: none}
/* Help popup */
.impress-enabled #impress-help {
background: none repeat scroll 0 0 rgba(0, 0, 0, .5);
color: #eee;
font-size: 80%;
position: fixed;
left: 2em;
bottom: 2em;
width: 24em;
border-radius: 1em;
padding: 1em;
text-align: center;
z-index: 99;
font-family: Verdana, Arial, Sans
}
.impress-enabled #impress-help td {padding-left: 1em; padding-right: 1em}
.hll { background-color: #ffffcc }
.c { color: #408080; font-style: italic } /* Comment */
.err { border: 1px solid #FF0000 } /* Error */
.k { color: #008000; font-weight: bold } /* Keyword */
.o { color: #666666 } /* Operator */
.ch { color: #408080; font-style: italic } /* Comment.Hashbang */
.cm { color: #408080; font-style: italic } /* Comment.Multiline */
.cp { color: #BC7A00 } /* Comment.Preproc */
.cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
.c1 { color: #408080; font-style: italic } /* Comment.Single */
.cs { color: #408080; font-style: italic } /* Comment.Special */
.gd { color: #A00000 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #FF0000 } /* Generic.Error */
.gh { color: #000080; font-weight: bold } /* Generic.Heading */
.gi { color: #00A000 } /* Generic.Inserted */
.go { color: #888888 } /* Generic.Output */
.gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.gt { color: #0044DD } /* Generic.Traceback */
.kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.kp { color: #008000 } /* Keyword.Pseudo */
.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.kt { color: #B00040 } /* Keyword.Type */
.m { color: #666666 } /* Literal.Number */
.s { color: #BA2121 } /* Literal.String */
.na { color: #7D9029 } /* Name.Attribute */
.nb { color: #008000 } /* Name.Builtin */
.nc { color: #0000FF; font-weight: bold } /* Name.Class */
.no { color: #880000 } /* Name.Constant */
.nd { color: #AA22FF } /* Name.Decorator */
.ni { color: #999999; font-weight: bold } /* Name.Entity */
.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.nf { color: #0000FF } /* Name.Function */
.nl { color: #A0A000 } /* Name.Label */
.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.nt { color: #008000; font-weight: bold } /* Name.Tag */
.nv { color: #19177C } /* Name.Variable */
.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mb { color: #666666 } /* Literal.Number.Bin */
.mf { color: #666666 } /* Literal.Number.Float */
.mh { color: #666666 } /* Literal.Number.Hex */
.mi { color: #666666 } /* Literal.Number.Integer */
.mo { color: #666666 } /* Literal.Number.Oct */
.sb { color: #BA2121 } /* Literal.String.Backtick */
.sc { color: #BA2121 } /* Literal.String.Char */
.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.s2 { color: #BA2121 } /* Literal.String.Double */
.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.sh { color: #BA2121 } /* Literal.String.Heredoc */
.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.sx { color: #008000 } /* Literal.String.Other */
.sr { color: #BB6688 } /* Literal.String.Regex */
.s1 { color: #BA2121 } /* Literal.String.Single */
.ss { color: #19177C } /* Literal.String.Symbol */
.bp { color: #008000 } /* Name.Builtin.Pseudo */
.vc { color: #19177C } /* Name.Variable.Class */
.vg { color: #19177C } /* Name.Variable.Global */
.vi { color: #19177C } /* Name.Variable.Instance */
.il { color: #666666 } /* Literal.Number.Integer.Long */
</style>
<!-- User custom CSS -->
<style>
</style>
<!-- User custom JavaScript -->
<script>
</script>
<!-- Call "impress().init()" at the end of document. -->
<script>/**
* impress.js
*
* impress.js is a presentation tool based on the power of CSS3 transforms and transitions
* in modern browsers and inspired by the idea behind prezi.com.
*
*
* Copyright 2011-2012 Bartek Szopka (@bartaz)
*
* Released under the MIT and GPL Licenses.
*
* ------------------------------------------------
* author: Bartek Szopka
* version: 0.5.3
* url: http://bartaz.github.com/impress.js/
* source: http://github.com/bartaz/impress.js/
*/
/*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true,
noarg:true, noempty:true, undef:true, strict:true, browser:true */
// You are one of those who like to know how things work inside?
// Let me show you the cogs that make impress.js run...
(function ( document, window ) {
'use strict';
// HELPER FUNCTIONS
// `pfx` is a function that takes a standard CSS property name as a parameter
// and returns it's prefixed version valid for current browser it runs in.
// The code is heavily inspired by Modernizr http://www.modernizr.com/
var pfx = (function () {
var style = document.createElement('dummy').style,
prefixes = 'Webkit Moz O ms Khtml'.split(' '),
memory = {};
return function ( prop ) {
if ( typeof memory[ prop ] === "undefined" ) {
var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),
props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' ');
memory[ prop ] = null;
for ( var i in props ) {
if ( style[ props[i] ] !== undefined ) {
memory[ prop ] = props[i];
break;
}
}
}
return memory[ prop ];
};
})();
// `arraify` takes an array-like object and turns it into real Array
// to make all the Array.prototype goodness available.
var arrayify = function ( a ) {
return [].slice.call( a );
};
// `css` function applies the styles given in `props` object to the element
// given as `el`. It runs all property names through `pfx` function to make
// sure proper prefixed version of the property is used.
var css = function ( el, props ) {
var key, pkey;
for ( key in props ) {
if ( props.hasOwnProperty(key) ) {
pkey = pfx(key);
if ( pkey !== null ) {
el.style[pkey] = props[key];
}
}
}
return el;
};
// `toNumber` takes a value given as `numeric` parameter and tries to turn
// it into a number. If it is not possible it returns 0 (or other value
// given as `fallback`).
var toNumber = function (numeric, fallback) {
return isNaN(numeric) ? (fallback || 0) : Number(numeric);
};
var validateOrder = function ( order, fallback ) {
var validChars = "xyz";
var returnStr = "";
if ( typeof order == "string" ) {
for ( var i in order.split("") ) {
if( validChars.indexOf( order[i] >= 0 ) ) {
returnStr += order[i];
// Each of x,y,z can be used only once.
validChars = validChars.split(order[i]).join("");
}
}
}
if ( returnStr )
return returnStr;
else if ( fallback !== undefined )
return fallback;
else
return "xyz";
};
// `byId` returns element with given `id` - you probably have guessed that ;)
var byId = function ( id ) {
return document.getElementById(id);
};
// `$` returns first element for given CSS `selector` in the `context` of
// the given element or whole document.
var $ = function ( selector, context ) {
context = context || document;
return context.querySelector(selector);
};
// `$$` return an array of elements for given CSS `selector` in the `context` of
// the given element or whole document.
var $$ = function ( selector, context ) {
context = context || document;
return arrayify( context.querySelectorAll(selector) );
};
// `triggerEvent` builds a custom DOM event with given `eventName` and `detail` data
// and triggers it on element given as `el`.
var triggerEvent = function (el, eventName, detail) {
var event = document.createEvent("CustomEvent");
event.initCustomEvent(eventName, true, true, detail);
el.dispatchEvent(event);
};
// `translate` builds a translate transform string for given data.
var translate = function ( t ) {
return " translate3d(" + t.x + "px," + t.y + "px," + t.z + "px) ";
};
// `rotate` builds a rotate transform string for given data.
// By default the rotations are in X Y Z order that can be reverted by passing `true`
// as second parameter.
var rotate = function ( r, revert ) {
var order = r.order ? r.order : "xyz";
var css = "";
var axes = order.split("");
if ( revert ) {
axes = axes.reverse();
}
for ( var i in axes ) {
css += " rotate" + axes[i].toUpperCase() + "(" + r[axes[i]] + "deg)"
}
return css;
};
// `scale` builds a scale transform string for given data.
var scale = function ( s ) {
return " scale(" + s + ") ";
};
// `perspective` builds a perspective transform string for given data.
var perspective = function ( p ) {
return " perspective(" + p + "px) ";
};
// `getElementFromHash` returns an element located by id from hash part of
// window location.
var getElementFromHash = function () {
// get id from url # by removing `#` or `#/` from the beginning,
// so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work
return byId( window.location.hash.replace(/^#\/?/,"") );
};
// `computeWindowScale` counts the scale factor between window size and size
// defined for the presentation in the config.
var computeWindowScale = function ( config ) {
var hScale = window.innerHeight / config.height,
wScale = window.innerWidth / config.width,
scale = hScale > wScale ? wScale : hScale;
if (config.maxScale && scale > config.maxScale) {
scale = config.maxScale;
}
if (config.minScale && scale < config.minScale) {
scale = config.minScale;
}
return scale;
};
// CHECK SUPPORT
var body = document.body;
var ua = navigator.userAgent.toLowerCase();
var impressSupported =
// browser should support CSS 3D transtorms
( pfx("perspective") !== null ) &&
// and `classList` and `dataset` APIs
( body.classList ) &&
( body.dataset );
if (!impressSupported) {
// we can't be sure that `classList` is supported
body.className += " impress-not-supported ";
} else {
body.classList.remove("impress-not-supported");
body.classList.add("impress-supported");
}
// GLOBALS AND DEFAULTS
// This is where the root elements of all impress.js instances will be kept.
// Yes, this means you can have more than one instance on a page, but I'm not
// sure if it makes any sense in practice ;)
var roots = {};
var preInitPlugins = [];
var preStepLeavePlugins = [];
// some default config values.
var defaults = {
width: 1024,
height: 768,
maxScale: 1,
minScale: 0,
perspective: 1000,
transitionDuration: 1000
};
// it's just an empty function ... and a useless comment.
var empty = function () { return false; };
// IMPRESS.JS API
// And that's where interesting things will start to happen.
// It's the core `impress` function that returns the impress.js API
// for a presentation based on the element with given id ('impress'
// by default).
var impress = window.impress = function ( rootId ) {
// If impress.js is not supported by the browser return a dummy API
// it may not be a perfect solution but we return early and avoid
// running code that may use features not implemented in the browser.
if (!impressSupported) {
return {
init: empty,
goto: empty,
prev: empty,
next: empty,
addPreInitPlugin: empty,
addPreStepLeavePlugin: empty
};
}
rootId = rootId || "impress";
// if given root is already initialized just return the API
if (roots["impress-root-" + rootId]) {
return roots["impress-root-" + rootId];
}
// data of all presentation steps
var stepsData = {};
// element of currently active step
var activeStep = null;
// current state (position, rotation and scale) of the presentation
var currentState = null;
// array of step elements
var steps = null;
// configuration options
var config = null;
// scale factor of the browser window
var windowScale = null;
// root presentation elements
var root = byId( rootId );
var canvas = document.createElement("div");
var initialized = false;
// STEP EVENTS
//
// There are currently two step events triggered by impress.js
// `impress:stepenter` is triggered when the step is shown on the
// screen (the transition from the previous one is finished) and
// `impress:stepleave` is triggered when the step is left (the
// transition to next step just starts).
// reference to last entered step
var lastEntered = null;
// `onStepEnter` is called whenever the step element is entered
// but the event is triggered only if the step is different than
// last entered step.
var onStepEnter = function (step) {
if (lastEntered !== step) {
triggerEvent(step, "impress:stepenter");
lastEntered = step;
}
};
// `onStepLeave` is called whenever the step element is left
// but the event is triggered only if the step is the same as
// last entered step.
var onStepLeave = function (currentStep, nextStep) {
if (lastEntered === currentStep) {
triggerEvent(currentStep, "impress:stepleave", { next : nextStep } );
lastEntered = null;
}
};
// `addPreInitPlugin` allows plugins to register a function that should
// be run (synchronously) at the beginning of init, before
// impress().init() itself executes.
var addPreInitPlugin = function( plugin, weight ) {
weight = toNumber(weight,10);
if ( preInitPlugins[weight] === undefined ) {
preInitPlugins[weight] = [];
}
preInitPlugins[weight].push( plugin );
};
// Called at beginning of init, to execute all pre-init plugins.
var execPreInitPlugins = function() {
for( var i = 0; i < preInitPlugins.length; i++ ) {
var thisLevel = preInitPlugins[i];
if( thisLevel !== undefined ) {
for( var j = 0; j < thisLevel.length; j++ ) {
thisLevel[j]();
}
}
}
};
// `addPreStepLeavePlugin` allows plugins to register a function that should
// be run (synchronously) at the beginning of goto()
var addPreStepLeavePlugin = function( plugin, weight ) {
weight = toNumber(weight,10);
if ( preStepLeavePlugins[weight] === undefined ) {
preStepLeavePlugins[weight] = [];
}
preStepLeavePlugins[weight].push( plugin );
};
// Called at beginning of goto(), to execute all preStepLeave plugins.
var execPreStepLeavePlugins = function(event) {
for( var i = 0; i < preStepLeavePlugins.length; i++ ) {
var thisLevel = preStepLeavePlugins[i];
if( thisLevel !== undefined ) {
for( var j = 0; j < thisLevel.length; j++ ) {
thisLevel[j](event);
}
}
}
};
// `initStep` initializes given step element by reading data from its
// data attributes and setting correct styles.
var initStep = function ( el, idx ) {
var data = el.dataset,
step = {
translate: {
x: toNumber(data.x),
y: toNumber(data.y),
z: toNumber(data.z)
},
rotate: {
x: toNumber(data.rotateX),
y: toNumber(data.rotateY),
z: toNumber(data.rotateZ || data.rotate),
order: validateOrder(data.rotateOrder)
},
scale: toNumber(data.scale, 1),
transitionDuration: toNumber(data.transitionDuration, config.transitionDuration),
el: el
};
if ( !el.id ) {
el.id = "step-" + (idx + 1);
}
stepsData["impress-" + el.id] = step;
css(el, {
position: "absolute",
transform: "translate(-50%,-50%)" +
translate(step.translate) +
rotate(step.rotate) +
scale(step.scale),
transformStyle: "preserve-3d"
});
};
// `init` API function that initializes (and runs) the presentation.
var init = function () {
if (initialized) { return; }
execPreInitPlugins();
// First we set up the viewport for mobile devices.
// For some reason iPad goes nuts when it is not done properly.
var meta = $("meta[name='viewport']") || document.createElement("meta");
meta.content = "width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no";
if (meta.parentNode !== document.head) {
meta.name = 'viewport';
document.head.appendChild(meta);
}
// initialize configuration object
var rootData = root.dataset;
config = {
width: toNumber( rootData.width, defaults.width ),
height: toNumber( rootData.height, defaults.height ),
maxScale: toNumber( rootData.maxScale, defaults.maxScale ),
minScale: toNumber( rootData.minScale, defaults.minScale ),
perspective: toNumber( rootData.perspective, defaults.perspective ),
transitionDuration: toNumber( rootData.transitionDuration, defaults.transitionDuration )
};
windowScale = computeWindowScale( config );
// wrap steps with "canvas" element
arrayify( root.childNodes ).forEach(function ( el ) {
canvas.appendChild( el );
});
root.appendChild(canvas);
// set initial styles
document.documentElement.style.height = "100%";
css(body, {
height: "100%",
overflow: "hidden"
});
var rootStyles = {
position: "absolute",
transformOrigin: "top left",
transition: "all 0s ease-in-out",
transformStyle: "preserve-3d"
};
css(root, rootStyles);
css(root, {
top: "50%",
left: "50%",
transform: perspective( config.perspective/windowScale ) + scale( windowScale )
});
css(canvas, rootStyles);
body.classList.remove("impress-disabled");
body.classList.add("impress-enabled");
// get and init steps
steps = $$(".step", root);
steps.forEach( initStep );
// set a default initial state of the canvas
currentState = {
translate: { x: 0, y: 0, z: 0 },
rotate: { x: 0, y: 0, z: 0, order: "xyz" },
scale: 1
};
initialized = true;
triggerEvent(root, "impress:init", { api: roots[ "impress-root-" + rootId ] });
};
// `getStep` is a helper function that returns a step element defined by parameter.
// If a number is given, step with index given by the number is returned, if a string
// is given step element with such id is returned, if DOM element is given it is returned
// if it is a correct step element.
var getStep = function ( step ) {
if (typeof step === "number") {
step = step < 0 ? steps[ steps.length + step] : steps[ step ];
} else if (typeof step === "string") {
step = byId(step);
}
return (step && step.id && stepsData["impress-" + step.id]) ? step : null;
};
// used to reset timeout for `impress:stepenter` event
var stepEnterTimeout = null;
// `goto` API function that moves to step given with `el` parameter (by index, id or element),
// with a transition `duration` optionally given as second parameter.
var goto = function ( el, duration, reason = "goto" ) {
if ( !initialized || !(el = getStep(el)) ) {
// presentation not initialized or given element is not a step
return false;
}
// Sometimes it's possible to trigger focus on first link with some keyboard action.
// Browser in such a case tries to scroll the page to make this element visible
// (even that body overflow is set to hidden) and it breaks our careful positioning.
//
// So, as a lousy (and lazy) workaround we will make the page scroll back to the top
// whenever slide is selected
//
// If you are reading this and know any better way to handle it, I'll be glad to hear about it!
window.scrollTo(0, 0);
var step = stepsData["impress-" + el.id];
// If we are in fact moving to another step, start with executing the registered preStepLeave plugins.
if (activeStep && activeStep !== el) {
var event = { target: activeStep, detail : {} };
event.detail.next = el;
event.detail.transitionDuration = step.transitionDuration;
event.detail.reason = reason;
execPreStepLeavePlugins(event);
// Plugins are allowed to change the detail values
el = event.detail.next;
step = stepsData["impress-" + el.id];
duration = event.detail.transitionDuration;
}
if ( activeStep ) {
activeStep.classList.remove("active");
body.classList.remove("impress-on-" + activeStep.id);
}
el.classList.add("active");
body.classList.add("impress-on-" + el.id);
// compute target state of the canvas based on given step
var target = {
rotate: {
x: -step.rotate.x,
y: -step.rotate.y,
z: -step.rotate.z,
order: step.rotate.order