|
1 | 1 | function isPreview() { |
2 | | - return !!window.location.search.match(/preview/gi); |
| 2 | + return !!window.location.search.match(/preview/gi); |
3 | 3 | } |
4 | 4 |
|
5 | 5 | function initializeReveal() { |
6 | | - // Full list of configuration options available at: |
7 | | - // https://github.com/hakimel/reveal.js#configuration |
8 | | - Reveal.initialize({ |
9 | | - controls: true, |
10 | | - progress: true, |
11 | | - history: true, |
12 | | - center: true, |
13 | | - transition: 'slide', // none/fade/slide/convex/concave/zoom |
14 | | - transitionSpeed: isPreview() ? 'fast' : 'default', |
15 | | - embedded: isPreview() ? true : false, |
16 | | - |
17 | | - // Optional reveal.js plugins |
18 | | - dependencies: [ |
19 | | - { src: '/static/revealjs/lib/js/classList.js', condition: function() { return !document.body.classList; } }, |
20 | | - { src: '/static/revealjs/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, |
21 | | - { src: '/static/revealjs/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); }, callback: function() { externalLinksInNewWindow(); } }, |
22 | | - { src: '/static/revealjs/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, |
23 | | - { src: '/static/revealjs/plugin/zoom-js/zoom.js', async: true }, |
24 | | - { src: '/static/revealjs/plugin/notes/notes.js', async: true } |
25 | | - ] |
26 | | - }); |
| 6 | + // Full list of configuration options available at: |
| 7 | + // https://github.com/hakimel/reveal.js#configuration |
| 8 | + Reveal.initialize({ |
| 9 | + controls: true, |
| 10 | + progress: true, |
| 11 | + history: true, |
| 12 | + center: true, |
| 13 | + transition: 'slide', // none/fade/slide/convex/concave/zoom |
| 14 | + transitionSpeed: isPreview() ? 'fast' : 'default', |
| 15 | + embedded: isPreview() ? true : false, |
| 16 | + |
| 17 | + // Optional reveal.js plugins |
| 18 | + dependencies: [{ |
| 19 | + src: '/static/reveal.js/lib/js/classList.js', |
| 20 | + condition: function() { |
| 21 | + return !document.body.classList; |
| 22 | + } |
| 23 | + }, |
| 24 | + |
| 25 | + // Interpret Markdown in <section> elements |
| 26 | + { |
| 27 | + src: '/static/reveal.js/plugin/markdown/marked.js', |
| 28 | + condition: function() { |
| 29 | + return !!document.querySelector('[data-markdown]'); |
| 30 | + } |
| 31 | + }, { |
| 32 | + src: '/static/reveal.js/plugin/markdown/markdown.js', |
| 33 | + condition: function() { |
| 34 | + return !!document.querySelector('[data-markdown]'); |
| 35 | + } |
| 36 | + }, |
| 37 | + |
| 38 | + // Syntax highlight for <code> elements |
| 39 | + { |
| 40 | + src: '/static/reveal.js/plugin/highlight/highlight.js', |
| 41 | + async: true, |
| 42 | + callback: function() { |
| 43 | + hljs.initHighlightingOnLoad(); |
| 44 | + } |
| 45 | + }, |
| 46 | + |
| 47 | + // Zoom in and out with Alt+click |
| 48 | + { |
| 49 | + src: '/static/reveal.js/plugin/zoom-js/zoom.js', |
| 50 | + async: true |
| 51 | + }, |
| 52 | + |
| 53 | + // Speaker notes |
| 54 | + { |
| 55 | + src: '/static/reveal.js/plugin/notes/notes.js', |
| 56 | + async: true |
| 57 | + }, |
| 58 | + |
| 59 | + // MathJax |
| 60 | + { |
| 61 | + src: '/static/reveal.js/plugin/math/math.js', |
| 62 | + async: true |
| 63 | + } |
| 64 | + |
| 65 | + { |
| 66 | + src: '/static/reveal.js/static/revealjs/lib/js/classList.js', |
| 67 | + condition: function() { |
| 68 | + return !document.body.classList; |
| 69 | + } |
| 70 | + } |
| 71 | + d |
| 72 | + ] |
| 73 | + }); |
27 | 74 | } |
28 | 75 |
|
29 | 76 | function highlightAnyCodeBlocks() { |
30 | | - $(document).ready(function() { |
31 | | - $('pre code').each(function(i, block) { |
32 | | - hljs.highlightBlock(block); |
| 77 | + $(document).ready(function() { |
| 78 | + $('pre code').each(function(i, block) { |
| 79 | + hljs.highlightBlock(block); |
| 80 | + }); |
33 | 81 | }); |
34 | | - }); |
35 | 82 | } |
36 | 83 |
|
37 | 84 | function insertMarkdownReference() { |
38 | | - var markdownReference = $('<section/>', { |
39 | | - 'data-markdown': "/slides.md", |
40 | | - 'data-separator': "^-( *)-( *)-( *-*)*", |
41 | | - 'data-separator-notes': "^Note:", |
42 | | - 'data-charset': "utf-8" |
43 | | - }); |
44 | | - |
45 | | - $('.slides').html(markdownReference); |
| 85 | + var markdownReference = $('<section/>', { |
| 86 | + 'data-markdown': "/slides.md", |
| 87 | + 'data-separator': "^-( *)-( *)-( *-*)*", |
| 88 | + 'data-separator-notes': "^Note:", |
| 89 | + 'data-charset': "utf-8" |
| 90 | + }); |
| 91 | + |
| 92 | + $('.slides').html(markdownReference); |
46 | 93 | } |
47 | 94 |
|
48 | 95 | function scrollToCurrentSlide() { |
49 | | - var i = Reveal.getIndices(); |
50 | | - Reveal.slide(i.h, i.v, i.f); |
| 96 | + var i = Reveal.getIndices(); |
| 97 | + Reveal.slide(i.h, i.v, i.f); |
51 | 98 | } |
52 | 99 |
|
53 | 100 | function reloadMarkdown() { |
54 | | - insertMarkdownReference(); |
55 | | - RevealMarkdown.initialize(); |
56 | | - highlightAnyCodeBlocks(); |
57 | | - scrollToCurrentSlide(); |
| 101 | + insertMarkdownReference(); |
| 102 | + RevealMarkdown.initialize(); |
| 103 | + highlightAnyCodeBlocks(); |
| 104 | + scrollToCurrentSlide(); |
58 | 105 | } |
59 | 106 |
|
60 | 107 | function externalLinksInNewWindow() { |
61 | | - $(document.links).filter(function() { |
62 | | - return this.hostname != window.location.hostname; |
63 | | - }).attr('target', '_blank'); |
| 108 | + $(document.links).filter(function() { |
| 109 | + return this.hostname != window.location.hostname; |
| 110 | + }).attr('target', '_blank'); |
64 | 111 | } |
65 | 112 |
|
66 | 113 | insertMarkdownReference(); |
|
0 commit comments