|
2 | 2 | <script src="dependencies/revealjs/lib/js/head.min.js"></script>
|
3 | 3 | <script src="dependencies/revealjs/js/reveal.js"></script>
|
4 | 4 | <script>
|
5 |
| - // Full list of configuration options available here: |
6 |
| - // https://github.com/hakimel/reveal.js#configuration |
7 |
| - Reveal.initialize({ |
8 |
| - controls: false, |
9 |
| - progress: true, |
10 |
| - history: true, |
11 |
| - center: true, |
12 |
| - |
13 |
| - theme: Reveal.getQueryHash().theme, // available themes are in /css/theme |
14 |
| - transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/none |
15 |
| - backgroundTransition: 'none', |
16 |
| - |
17 |
| - // Optional libraries used to extend on reveal.js |
18 |
| - dependencies: [ |
19 |
| - { src: 'dependencies/revealjs/lib/js/classList.js', condition: function() { return !document.body.classList; } }, |
20 |
| - { src: 'dependencies/revealjs/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }, |
21 |
| - { src: 'dependencies/revealjs/plugin/zoom-js/zoom.js', condition: function() { return !!document.body.classList; } } |
22 |
| - ] |
23 |
| - }); |
24 |
| - |
25 |
| - // SnapSVG |
26 |
| - // Run once at startup to inject all SVGs |
27 |
| - loadAllSvg(); |
28 |
| - |
29 |
| - function loadAllSvg(){ |
30 |
| - var els = document.getElementsByTagName("svg"); |
31 |
| - |
32 |
| - for(var elCount = 0; elCount < els.length; elCount++){ |
33 |
| - injectSvg(els[elCount]); |
34 |
| - } |
35 |
| - } |
36 |
| - |
37 |
| - function injectSvg(canvasTarget){ |
38 |
| - if(canvasTarget){ |
39 |
| - Snap.load( |
40 |
| - canvasTarget.getAttribute("data-path"), |
41 |
| - function (frag) { |
42 |
| - sCanvas = Snap("#" + canvasTarget.getAttribute("id")); |
43 |
| - fCanvas = Snap(); |
44 |
| - sCanvas.clear(); |
45 |
| - |
46 |
| - //Determine if grouped build-steps present |
47 |
| - var buildStepBase = frag.select("#base"); |
48 |
| - buildStepGroups = frag.selectAll("[id^=step-]"), |
49 |
| - buildStepCount = buildStepGroups.length, |
50 |
| - buildStep = 0; |
51 |
| - |
52 |
| - //Setup the container canvas boundary sizing |
53 |
| - setCanvasBBox(frag, canvasTarget); |
54 |
| - |
55 |
| - // Show the first build step when available |
56 |
| - // Otherwise just show entire graphic |
57 |
| - if(buildStepCount > 0){ |
58 |
| - // Include the non-fragment base layout/visuals |
59 |
| - fCanvas.append(buildStepBase); |
60 |
| - // fCanvas.append(buildStepGroups[buildStep]); |
61 |
| - |
62 |
| - for(; buildStep < buildStepCount; buildStep++){ |
63 |
| - |
64 |
| - // Supports fragment in-out transitions by |
65 |
| - // wrapping in a group and applying a second |
66 |
| - // fragment class |
67 |
| - if(buildStepGroups[buildStep].node.id.match(/in-out/)){ |
68 |
| - var tG = fCanvas.g(buildStepGroups[buildStep]); |
69 |
| - buildStepGroups[buildStep].attr("class", "fragment fade-out"); |
70 |
| - tG.attr("class", "fragment"); |
71 |
| - fCanvas.append(tG); |
72 |
| - } |
73 |
| - else{ |
74 |
| - buildStepGroups[buildStep].attr("class", "fragment"); |
75 |
| - fCanvas.append(buildStepGroups[buildStep]); |
76 |
| - } |
77 |
| - } |
78 |
| - } else{ |
79 |
| - //No "steps" to build out, ensure boundary guide |
80 |
| - //is not rendered |
81 |
| - frag.select("#boundary").remove(); |
82 |
| - fCanvas.append(frag); |
83 |
| - } |
84 |
| - |
85 |
| - sCanvas.append(fCanvas); |
86 |
| - } |
87 |
| - ); |
88 |
| - } |
89 |
| - } |
90 |
| - |
91 |
| - function setCanvasBBox(canvas, target){ |
| 5 | + // Full list of configuration options available here: |
| 6 | + // https://github.com/hakimel/reveal.js#configuration |
| 7 | + Reveal.initialize({ |
| 8 | + controls: false, |
| 9 | + progress: true, |
| 10 | + history: true, |
| 11 | + center: true, |
| 12 | + |
| 13 | + theme: Reveal.getQueryHash().theme, // available themes are in /css/theme |
| 14 | + transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/none |
| 15 | + backgroundTransition: 'none', |
| 16 | + |
| 17 | + // Optional libraries used to extend on reveal.js |
| 18 | + dependencies: [ |
| 19 | + { src: 'dependencies/revealjs/lib/js/classList.js', condition: function() { return !document.body.classList; } }, |
| 20 | + { src: 'dependencies/revealjs/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }, |
| 21 | + { src: 'dependencies/revealjs/plugin/zoom-js/zoom.js', condition: function() { return !!document.body.classList; } } |
| 22 | + ] |
| 23 | + }); |
| 24 | + |
| 25 | + // SnapSVG |
| 26 | + // Run once at startup to inject all SVGs |
| 27 | + loadAllSvg(); |
| 28 | + |
| 29 | + function loadAllSvg(){ |
| 30 | + var els = document.getElementsByTagName("svg"); |
| 31 | + |
| 32 | + for(var elCount = 0; elCount < els.length; elCount++){ |
| 33 | + injectSvg(els[elCount]); |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + function injectSvg(canvasTarget){ |
| 38 | + if(canvasTarget){ |
| 39 | + Snap.load( |
| 40 | + canvasTarget.getAttribute("data-path"), |
| 41 | + function (frag) { |
| 42 | + sCanvas = Snap("#" + canvasTarget.getAttribute("id")); |
| 43 | + fCanvas = Snap(); |
| 44 | + sCanvas.clear(); |
| 45 | + |
| 46 | + //Determine if grouped build-steps present |
| 47 | + var buildStepBase = frag.select("#base"); |
| 48 | + buildStepGroups = frag.selectAll("[id^=step-]"), |
| 49 | + buildStepCount = buildStepGroups.length, |
| 50 | + buildStep = 0; |
| 51 | + |
| 52 | + //Setup the container canvas boundary sizing |
| 53 | + setCanvasBBox(frag, canvasTarget); |
| 54 | + |
| 55 | + // Show the first build step when available |
| 56 | + // Otherwise just show entire graphic |
| 57 | + if(buildStepCount > 0){ |
| 58 | + // Include the non-fragment base layout/visuals |
| 59 | + fCanvas.append(buildStepBase); |
| 60 | + // fCanvas.append(buildStepGroups[buildStep]); |
| 61 | + |
| 62 | + for(; buildStep < buildStepCount; buildStep++){ |
| 63 | + |
| 64 | + // Supports fragment in-out transitions by |
| 65 | + // wrapping in a group and applying a second |
| 66 | + // fragment class |
| 67 | + if(buildStepGroups[buildStep].node.id.match(/in-out/)){ |
| 68 | + var tG = fCanvas.g(buildStepGroups[buildStep]); |
| 69 | + buildStepGroups[buildStep].attr("class", "fragment fade-out"); |
| 70 | + tG.attr("class", "fragment"); |
| 71 | + fCanvas.append(tG); |
| 72 | + } |
| 73 | + else{ |
| 74 | + buildStepGroups[buildStep].attr("class", "fragment"); |
| 75 | + fCanvas.append(buildStepGroups[buildStep]); |
| 76 | + } |
| 77 | + } |
| 78 | + } else{ |
| 79 | + //No "steps" to build out, ensure boundary guide |
| 80 | + //is not rendered |
| 81 | + frag.select("#boundary").remove(); |
| 82 | + fCanvas.append(frag); |
| 83 | + } |
| 84 | + |
| 85 | + sCanvas.append(fCanvas); |
| 86 | + } |
| 87 | + ); |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + function setCanvasBBox(canvas, target){ |
92 | 92 | var boundary,
|
93 |
| - maxWidth, |
94 |
| - maxHeight; |
| 93 | + maxWidth, |
| 94 | + maxHeight; |
95 | 95 |
|
96 | 96 | boundary = canvas.select("#boundary").select(":first-child").getBBox();
|
97 |
| - maxWidth = Math.ceil(boundary.width); |
98 |
| - maxHeight = Math.ceil(boundary.height); |
| 97 | + maxWidth = Math.ceil(boundary.width); |
| 98 | + maxHeight = Math.ceil(boundary.height); |
99 | 99 |
|
100 |
| - target.setAttribute("height", (((maxHeight/maxWidth)*100)+"%")); |
| 100 | + target.setAttribute("height", (((maxHeight/maxWidth)*100)+"%")); |
101 | 101 | target.setAttribute("viewBox", "0 0 " + maxWidth + " " + maxHeight);
|
102 | 102 | return canvas;
|
103 | 103 | }
|
|
0 commit comments