slippery 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/assets/deck.js/core/deck.core.css +60 -0
- data/assets/deck.js/core/deck.core.js +728 -0
- data/assets/deck.js/core/deck.core.scss +65 -0
- data/assets/deck.js/core/print.css +25 -0
- data/assets/deck.js/core/print.scss +14 -0
- data/assets/deck.js/css/common.css +216 -0
- data/assets/deck.js/css/common.scss +233 -0
- data/assets/deck.js/css/home.css +790 -0
- data/assets/deck.js/css/home.scss +892 -0
- data/assets/deck.js/extensions/goto/deck.goto.css +36 -0
- data/assets/deck.js/extensions/goto/deck.goto.html +7 -0
- data/assets/deck.js/extensions/goto/deck.goto.js +190 -0
- data/assets/deck.js/extensions/goto/deck.goto.scss +39 -0
- data/assets/deck.js/extensions/hash/deck.hash.css +13 -0
- data/assets/deck.js/extensions/hash/deck.hash.html +2 -0
- data/assets/deck.js/extensions/hash/deck.hash.js +145 -0
- data/assets/deck.js/extensions/hash/deck.hash.scss +13 -0
- data/assets/deck.js/extensions/menu/deck.menu.css +45 -0
- data/assets/deck.js/extensions/menu/deck.menu.js +225 -0
- data/assets/deck.js/extensions/menu/deck.menu.scss +55 -0
- data/assets/deck.js/extensions/navigation/deck.navigation.css +42 -0
- data/assets/deck.js/extensions/navigation/deck.navigation.html +5 -0
- data/assets/deck.js/extensions/navigation/deck.navigation.js +94 -0
- data/assets/deck.js/extensions/navigation/deck.navigation.scss +44 -0
- data/assets/deck.js/extensions/scale/deck.scale.css +20 -0
- data/assets/deck.js/extensions/scale/deck.scale.js +190 -0
- data/assets/deck.js/extensions/scale/deck.scale.scss +22 -0
- data/assets/deck.js/extensions/status/deck.status.css +18 -0
- data/assets/deck.js/extensions/status/deck.status.html +6 -0
- data/assets/deck.js/extensions/status/deck.status.js +108 -0
- data/assets/deck.js/extensions/status/deck.status.scss +18 -0
- data/assets/deck.js/modernizr.custom.js +4 -0
- data/assets/deck.js/themes/style/_reset.scss +300 -0
- data/assets/deck.js/themes/style/neon.css +421 -0
- data/assets/deck.js/themes/style/neon.scss +148 -0
- data/assets/deck.js/themes/style/swiss.css +389 -0
- data/assets/deck.js/themes/style/swiss.scss +109 -0
- data/assets/deck.js/themes/style/web-2.0.css +500 -0
- data/assets/deck.js/themes/style/web-2.0.scss +228 -0
- data/assets/deck.js/themes/transition/fade.css +35 -0
- data/assets/deck.js/themes/transition/fade.scss +59 -0
- data/assets/deck.js/themes/transition/horizontal-slide.css +53 -0
- data/assets/deck.js/themes/transition/horizontal-slide.scss +72 -0
- data/assets/deck.js/themes/transition/vertical-slide.css +67 -0
- data/assets/deck.js/themes/transition/vertical-slide.scss +92 -0
- data/assets/highlight.js/CHANGES.md +953 -0
- data/assets/highlight.js/LICENSE +24 -0
- data/assets/highlight.js/README.md +101 -0
- data/assets/highlight.js/README.ru.md +101 -0
- data/assets/highlight.js/highlight-0.8.default.min.css +1 -0
- data/assets/highlight.js/highlight-0.8.min.js +1 -0
- data/assets/highlight.js/highlight.pack.js +1 -0
- data/assets/highlight.js/styles/arta.css +141 -0
- data/assets/highlight.js/styles/ascetic.css +53 -0
- data/assets/highlight.js/styles/atelier-dune.dark.css +95 -0
- data/assets/highlight.js/styles/atelier-dune.light.css +95 -0
- data/assets/highlight.js/styles/atelier-forest.dark.css +95 -0
- data/assets/highlight.js/styles/atelier-forest.light.css +95 -0
- data/assets/highlight.js/styles/atelier-heath.dark.css +95 -0
- data/assets/highlight.js/styles/atelier-heath.light.css +95 -0
- data/assets/highlight.js/styles/atelier-lakeside.dark.css +95 -0
- data/assets/highlight.js/styles/atelier-lakeside.light.css +95 -0
- data/assets/highlight.js/styles/atelier-seaside.dark.css +95 -0
- data/assets/highlight.js/styles/atelier-seaside.light.css +95 -0
- data/assets/highlight.js/styles/brown_paper.css +105 -0
- data/assets/highlight.js/styles/brown_papersq.png +0 -0
- data/assets/highlight.js/styles/codepen-embed.css +108 -0
- data/assets/highlight.js/styles/color-brewer.css +169 -0
- data/assets/highlight.js/styles/dark.css +105 -0
- data/assets/highlight.js/styles/default.css +153 -0
- data/assets/highlight.js/styles/docco.css +136 -0
- data/assets/highlight.js/styles/far.css +112 -0
- data/assets/highlight.js/styles/foundation.css +136 -0
- data/assets/highlight.js/styles/github.css +127 -0
- data/assets/highlight.js/styles/googlecode.css +148 -0
- data/assets/highlight.js/styles/hybrid.css +171 -0
- data/assets/highlight.js/styles/idea.css +126 -0
- data/assets/highlight.js/styles/ir_black.css +110 -0
- data/assets/highlight.js/styles/kimbie.dark.css +96 -0
- data/assets/highlight.js/styles/kimbie.light.css +96 -0
- data/assets/highlight.js/styles/magula.css +122 -0
- data/assets/highlight.js/styles/mono-blue.css +70 -0
- data/assets/highlight.js/styles/monokai.css +127 -0
- data/assets/highlight.js/styles/monokai_sublime.css +148 -0
- data/assets/highlight.js/styles/obsidian.css +154 -0
- data/assets/highlight.js/styles/paraiso.dark.css +95 -0
- data/assets/highlight.js/styles/paraiso.light.css +95 -0
- data/assets/highlight.js/styles/pojoaque.css +108 -0
- data/assets/highlight.js/styles/pojoaque.jpg +0 -0
- data/assets/highlight.js/styles/railscasts.css +185 -0
- data/assets/highlight.js/styles/rainbow.css +109 -0
- data/assets/highlight.js/styles/school_book.css +113 -0
- data/assets/highlight.js/styles/school_book.png +0 -0
- data/assets/highlight.js/styles/solarized_dark.css +109 -0
- data/assets/highlight.js/styles/solarized_light.css +109 -0
- data/assets/highlight.js/styles/sunburst.css +165 -0
- data/assets/highlight.js/styles/tomorrow-night-blue.css +95 -0
- data/assets/highlight.js/styles/tomorrow-night-bright.css +94 -0
- data/assets/highlight.js/styles/tomorrow-night-eighties.css +94 -0
- data/assets/highlight.js/styles/tomorrow-night.css +95 -0
- data/assets/highlight.js/styles/tomorrow.css +92 -0
- data/assets/highlight.js/styles/vs.css +94 -0
- data/assets/highlight.js/styles/xcode.css +159 -0
- data/assets/highlight.js/styles/zenburn.css +119 -0
- data/assets/jquery/jquery-2.1.0.min.js +4 -0
- data/assets/reveal.js/css/print/paper.css +1 -1
- data/assets/reveal.js/css/print/pdf.css +2 -2
- data/assets/reveal.js/css/reveal.css +372 -108
- data/assets/reveal.js/css/reveal.min.css +2 -2
- data/assets/reveal.js/css/theme/README.md +3 -1
- data/assets/reveal.js/css/theme/beige.css +7 -1
- data/assets/reveal.js/css/theme/blood.css +175 -0
- data/assets/reveal.js/css/theme/default.css +7 -1
- data/assets/reveal.js/css/theme/moon.css +7 -1
- data/assets/reveal.js/css/theme/night.css +7 -1
- data/assets/reveal.js/css/theme/serif.css +7 -1
- data/assets/reveal.js/css/theme/simple.css +7 -1
- data/assets/reveal.js/css/theme/sky.css +7 -1
- data/assets/reveal.js/css/theme/solarized.css +7 -1
- data/assets/reveal.js/css/theme/source/blood.scss +91 -0
- data/assets/reveal.js/css/theme/template/settings.scss +1 -0
- data/assets/reveal.js/css/theme/template/theme.scss +9 -2
- data/assets/reveal.js/js/reveal.js +1238 -433
- data/assets/reveal.js/js/reveal.min.js +4 -3
- data/assets/reveal.js/lib/css/zenburn.css +16 -17
- data/assets/reveal.js/plugin/highlight/highlight.js +3 -2
- data/assets/reveal.js/plugin/leap/leap.js +3 -0
- data/assets/reveal.js/plugin/markdown/example.html +37 -5
- data/assets/reveal.js/plugin/markdown/example.md +2 -0
- data/assets/reveal.js/plugin/markdown/markdown.js +373 -171
- data/assets/reveal.js/plugin/math/math.js +64 -0
- data/assets/reveal.js/plugin/multiplex/master.js +2 -1
- data/assets/reveal.js/plugin/notes/notes.html +33 -19
- data/assets/reveal.js/plugin/notes/notes.js +25 -47
- data/assets/reveal.js/plugin/remotes/remotes.js +4 -4
- data/assets/reveal.js/plugin/zoom-js/zoom.js +3 -1
- data/assets/reveal.old/css/print/paper.css +176 -0
- data/assets/reveal.old/css/print/pdf.css +190 -0
- data/assets/reveal.old/css/reveal.css +1616 -0
- data/assets/reveal.old/css/reveal.min.css +7 -0
- data/assets/reveal.old/css/theme/README.md +23 -0
- data/assets/reveal.old/css/theme/beige.css +142 -0
- data/assets/reveal.old/css/theme/default.css +142 -0
- data/assets/reveal.old/css/theme/moon.css +142 -0
- data/assets/reveal.old/css/theme/night.css +130 -0
- data/assets/reveal.old/css/theme/serif.css +132 -0
- data/assets/reveal.old/css/theme/simple.css +132 -0
- data/assets/reveal.old/css/theme/sky.css +139 -0
- data/assets/reveal.old/css/theme/solarized.css +142 -0
- data/assets/reveal.old/css/theme/source/beige.scss +50 -0
- data/assets/reveal.old/css/theme/source/default.scss +42 -0
- data/assets/reveal.old/css/theme/source/moon.scss +68 -0
- data/assets/reveal.old/css/theme/source/night.scss +35 -0
- data/assets/reveal.old/css/theme/source/serif.scss +35 -0
- data/assets/reveal.old/css/theme/source/simple.scss +38 -0
- data/assets/reveal.old/css/theme/source/sky.scss +46 -0
- data/assets/reveal.old/css/theme/source/solarized.scss +74 -0
- data/assets/reveal.old/css/theme/template/mixins.scss +29 -0
- data/assets/reveal.old/css/theme/template/settings.scss +33 -0
- data/assets/reveal.old/css/theme/template/theme.scss +163 -0
- data/assets/{reveal.js → reveal.old}/js/head.min.js +0 -0
- data/assets/reveal.old/js/reveal.js +2577 -0
- data/assets/reveal.old/js/reveal.min.js +8 -0
- data/assets/reveal.old/lib/css/zenburn.css +115 -0
- data/assets/reveal.old/lib/font/league_gothic-webfont.eot +0 -0
- data/assets/reveal.old/lib/font/league_gothic-webfont.svg +230 -0
- data/assets/reveal.old/lib/font/league_gothic-webfont.ttf +0 -0
- data/assets/reveal.old/lib/font/league_gothic-webfont.woff +0 -0
- data/assets/reveal.old/lib/font/league_gothic_license +2 -0
- data/assets/reveal.old/lib/js/classList.js +2 -0
- data/assets/reveal.old/lib/js/head.min.js +8 -0
- data/assets/reveal.old/lib/js/html5shiv.js +7 -0
- data/assets/reveal.old/plugin/highlight/highlight.js +31 -0
- data/assets/reveal.old/plugin/leap/leap.js +154 -0
- data/assets/reveal.old/plugin/markdown/example.html +97 -0
- data/assets/reveal.old/plugin/markdown/example.md +29 -0
- data/assets/reveal.old/plugin/markdown/markdown.js +190 -0
- data/assets/reveal.old/plugin/markdown/marked.js +37 -0
- data/assets/reveal.old/plugin/multiplex/client.js +13 -0
- data/assets/reveal.old/plugin/multiplex/index.js +56 -0
- data/assets/reveal.old/plugin/multiplex/master.js +50 -0
- data/assets/reveal.old/plugin/notes-server/client.js +57 -0
- data/assets/reveal.old/plugin/notes-server/index.js +59 -0
- data/assets/reveal.old/plugin/notes-server/notes.html +142 -0
- data/assets/reveal.old/plugin/notes/notes.html +253 -0
- data/assets/reveal.old/plugin/notes/notes.js +100 -0
- data/assets/reveal.old/plugin/postmessage/example.html +39 -0
- data/assets/reveal.old/plugin/postmessage/postmessage.js +42 -0
- data/assets/reveal.old/plugin/print-pdf/print-pdf.js +44 -0
- data/assets/reveal.old/plugin/remotes/remotes.js +39 -0
- data/assets/reveal.old/plugin/search/search.js +196 -0
- data/assets/reveal.old/plugin/zoom-js/zoom.js +256 -0
- data/bin/slippery +1 -0
- data/code_of_conduct.md +32 -0
- data/lib/slippery.rb +5 -3
- data/lib/slippery/document.rb +2 -2
- data/lib/slippery/presentation.rb +10 -1
- data/lib/slippery/processor.rb +18 -0
- data/lib/slippery/processor_helpers.rb +16 -2
- data/lib/slippery/processors/add_highlight.rb +9 -2
- data/lib/slippery/processors/deck_js.rb +81 -0
- data/lib/slippery/processors/fathom_js.rb +31 -0
- data/lib/slippery/processors/impress_js/add_impress_js.rb +2 -2
- data/lib/slippery/processors/jquery.rb +12 -0
- data/lib/slippery/processors/reveal_js/add_reveal_js.rb +12 -9
- data/lib/slippery/rake_tasks.rb +59 -31
- data/lib/slippery/version.rb +1 -1
- data/slippery.gemspec +5 -4
- metadata +215 -33
- data/lib/slippery/converter.rb +0 -132
@@ -0,0 +1,100 @@
|
|
1
|
+
/**
|
2
|
+
* Handles opening of and synchronization with the reveal.js
|
3
|
+
* notes window.
|
4
|
+
*/
|
5
|
+
var RevealNotes = (function() {
|
6
|
+
|
7
|
+
function openNotes() {
|
8
|
+
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
|
9
|
+
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
|
10
|
+
var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' );
|
11
|
+
|
12
|
+
// Fires when slide is changed
|
13
|
+
Reveal.addEventListener( 'slidechanged', function( event ) {
|
14
|
+
post('slidechanged');
|
15
|
+
} );
|
16
|
+
|
17
|
+
// Fires when a fragment is shown
|
18
|
+
Reveal.addEventListener( 'fragmentshown', function( event ) {
|
19
|
+
post('fragmentshown');
|
20
|
+
} );
|
21
|
+
|
22
|
+
// Fires when a fragment is hidden
|
23
|
+
Reveal.addEventListener( 'fragmenthidden', function( event ) {
|
24
|
+
post('fragmenthidden');
|
25
|
+
} );
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Posts the current slide data to the notes window
|
29
|
+
*
|
30
|
+
* @param {String} eventType Expecting 'slidechanged', 'fragmentshown'
|
31
|
+
* or 'fragmenthidden' set in the events above to define the needed
|
32
|
+
* slideDate.
|
33
|
+
*/
|
34
|
+
function post( eventType ) {
|
35
|
+
var slideElement = Reveal.getCurrentSlide(),
|
36
|
+
messageData;
|
37
|
+
|
38
|
+
if( eventType === 'slidechanged' ) {
|
39
|
+
var notes = slideElement.querySelector( 'aside.notes' ),
|
40
|
+
indexh = Reveal.getIndices().h,
|
41
|
+
indexv = Reveal.getIndices().v,
|
42
|
+
nextindexh,
|
43
|
+
nextindexv;
|
44
|
+
|
45
|
+
if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) {
|
46
|
+
nextindexh = indexh;
|
47
|
+
nextindexv = indexv + 1;
|
48
|
+
} else {
|
49
|
+
nextindexh = indexh + 1;
|
50
|
+
nextindexv = 0;
|
51
|
+
}
|
52
|
+
|
53
|
+
messageData = {
|
54
|
+
notes : notes ? notes.innerHTML : '',
|
55
|
+
indexh : indexh,
|
56
|
+
indexv : indexv,
|
57
|
+
nextindexh : nextindexh,
|
58
|
+
nextindexv : nextindexv,
|
59
|
+
markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false
|
60
|
+
};
|
61
|
+
}
|
62
|
+
else if( eventType === 'fragmentshown' ) {
|
63
|
+
messageData = {
|
64
|
+
fragment : 'next'
|
65
|
+
};
|
66
|
+
}
|
67
|
+
else if( eventType === 'fragmenthidden' ) {
|
68
|
+
messageData = {
|
69
|
+
fragment : 'prev'
|
70
|
+
};
|
71
|
+
}
|
72
|
+
|
73
|
+
notesPopup.postMessage( JSON.stringify( messageData ), '*' );
|
74
|
+
}
|
75
|
+
|
76
|
+
// Navigate to the current slide when the notes are loaded
|
77
|
+
notesPopup.addEventListener( 'load', function( event ) {
|
78
|
+
post('slidechanged');
|
79
|
+
}, false );
|
80
|
+
}
|
81
|
+
|
82
|
+
// If the there's a 'notes' query set, open directly
|
83
|
+
if( window.location.search.match( /(\?|\&)notes/gi ) !== null ) {
|
84
|
+
openNotes();
|
85
|
+
}
|
86
|
+
|
87
|
+
// Open the notes when the 's' key is hit
|
88
|
+
document.addEventListener( 'keydown', function( event ) {
|
89
|
+
// Disregard the event if the target is editable or a
|
90
|
+
// modifier is present
|
91
|
+
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
|
92
|
+
|
93
|
+
if( event.keyCode === 83 ) {
|
94
|
+
event.preventDefault();
|
95
|
+
openNotes();
|
96
|
+
}
|
97
|
+
}, false );
|
98
|
+
|
99
|
+
return { open: openNotes };
|
100
|
+
})();
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
|
4
|
+
<iframe id="reveal" src="../../index.html" style="border: 0;" width="500" height="500"></iframe>
|
5
|
+
|
6
|
+
<div>
|
7
|
+
<input id="back" type="button" value="go back"/>
|
8
|
+
<input id="ahead" type="button" value="go ahead"/>
|
9
|
+
<input id="slideto" type="button" value="slideto 2-2"/>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<script>
|
13
|
+
|
14
|
+
(function (){
|
15
|
+
|
16
|
+
var back = document.getElementById( 'back' ),
|
17
|
+
ahead = document.getElementById( 'ahead' ),
|
18
|
+
slideto = document.getElementById( 'slideto' ),
|
19
|
+
reveal = window.frames[0];
|
20
|
+
|
21
|
+
back.addEventListener( 'click', function () {
|
22
|
+
|
23
|
+
reveal.postMessage( JSON.stringify({method: 'prev', args: []}), '*' );
|
24
|
+
}, false );
|
25
|
+
|
26
|
+
ahead.addEventListener( 'click', function (){
|
27
|
+
reveal.postMessage( JSON.stringify({method: 'next', args: []}), '*' );
|
28
|
+
}, false );
|
29
|
+
|
30
|
+
slideto.addEventListener( 'click', function (){
|
31
|
+
reveal.postMessage( JSON.stringify({method: 'slide', args: [2,2]}), '*' );
|
32
|
+
}, false );
|
33
|
+
|
34
|
+
}());
|
35
|
+
|
36
|
+
</script>
|
37
|
+
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
simple postmessage plugin
|
4
|
+
|
5
|
+
Useful when a reveal slideshow is inside an iframe.
|
6
|
+
It allows to call reveal methods from outside.
|
7
|
+
|
8
|
+
Example:
|
9
|
+
var reveal = window.frames[0];
|
10
|
+
|
11
|
+
// Reveal.prev();
|
12
|
+
reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*');
|
13
|
+
// Reveal.next();
|
14
|
+
reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*');
|
15
|
+
// Reveal.slide(2, 2);
|
16
|
+
reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*');
|
17
|
+
|
18
|
+
Add to the slideshow:
|
19
|
+
|
20
|
+
dependencies: [
|
21
|
+
...
|
22
|
+
{ src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } }
|
23
|
+
]
|
24
|
+
|
25
|
+
*/
|
26
|
+
|
27
|
+
(function (){
|
28
|
+
|
29
|
+
window.addEventListener( "message", function ( event ) {
|
30
|
+
var data = JSON.parse( event.data ),
|
31
|
+
method = data.method,
|
32
|
+
args = data.args;
|
33
|
+
|
34
|
+
if( typeof Reveal[method] === 'function' ) {
|
35
|
+
Reveal[method].apply( Reveal, data.args );
|
36
|
+
}
|
37
|
+
}, false);
|
38
|
+
|
39
|
+
}());
|
40
|
+
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* phantomjs script for printing presentations to PDF.
|
3
|
+
*
|
4
|
+
* Example:
|
5
|
+
* phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf
|
6
|
+
*
|
7
|
+
* By Manuel Bieh (https://github.com/manuelbieh)
|
8
|
+
*/
|
9
|
+
|
10
|
+
// html2pdf.js
|
11
|
+
var page = new WebPage();
|
12
|
+
var system = require( 'system' );
|
13
|
+
|
14
|
+
page.viewportSize = {
|
15
|
+
width: 1024,
|
16
|
+
height: 768
|
17
|
+
};
|
18
|
+
|
19
|
+
page.paperSize = {
|
20
|
+
format: 'letter',
|
21
|
+
orientation: 'landscape',
|
22
|
+
margin: {
|
23
|
+
left: '0',
|
24
|
+
right: '0',
|
25
|
+
top: '0',
|
26
|
+
bottom: '0'
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
var revealFile = system.args[1] || 'index.html?print-pdf';
|
31
|
+
var slideFile = system.args[2] || 'slides.pdf';
|
32
|
+
|
33
|
+
if( slideFile.match( /\.pdf$/gi ) === null ) {
|
34
|
+
slideFile += '.pdf';
|
35
|
+
}
|
36
|
+
|
37
|
+
console.log( 'Printing PDF...' );
|
38
|
+
|
39
|
+
page.open( revealFile, function( status ) {
|
40
|
+
console.log( 'Printed succesfully' );
|
41
|
+
page.render( slideFile );
|
42
|
+
phantom.exit();
|
43
|
+
} );
|
44
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* Touch-based remote controller for your presentation courtesy
|
3
|
+
* of the folks at http://remotes.io
|
4
|
+
*/
|
5
|
+
|
6
|
+
(function(window){
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Detects if we are dealing with a touch enabled device (with some false positives)
|
10
|
+
* Borrowed from modernizr: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touch.js
|
11
|
+
*/
|
12
|
+
var hasTouch = (function(){
|
13
|
+
return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
|
14
|
+
})();
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Detects if notes are enable and the current page is opened inside an /iframe
|
18
|
+
* this prevents loading Remotes.io several times
|
19
|
+
*/
|
20
|
+
var remotesAndIsNotes = (function(){
|
21
|
+
return !(window.RevealNotes && self == top);
|
22
|
+
})();
|
23
|
+
|
24
|
+
if(!hasTouch && !remotesAndIsNotes){
|
25
|
+
head.ready( 'remotes.ne.min.js', function() {
|
26
|
+
new Remotes("preview")
|
27
|
+
.on("swipe-left", function(e){ Reveal.right(); })
|
28
|
+
.on("swipe-right", function(e){ Reveal.left(); })
|
29
|
+
.on("swipe-up", function(e){ Reveal.down(); })
|
30
|
+
.on("swipe-down", function(e){ Reveal.up(); })
|
31
|
+
.on("tap", function(e){ Reveal.next(); })
|
32
|
+
.on("zoom-out", function(e){ Reveal.toggleOverview(true); })
|
33
|
+
.on("zoom-in", function(e){ Reveal.toggleOverview(false); })
|
34
|
+
;
|
35
|
+
} );
|
36
|
+
|
37
|
+
head.js('https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js');
|
38
|
+
}
|
39
|
+
})(window);
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/*
|
2
|
+
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
|
3
|
+
* by navigatating to that slide and highlighting it.
|
4
|
+
*
|
5
|
+
* By Jon Snyder <snyder.jon@gmail.com>, February 2013
|
6
|
+
*/
|
7
|
+
|
8
|
+
var RevealSearch = (function() {
|
9
|
+
|
10
|
+
var matchedSlides;
|
11
|
+
var currentMatchedIndex;
|
12
|
+
var searchboxDirty;
|
13
|
+
var myHilitor;
|
14
|
+
|
15
|
+
// Original JavaScript code by Chirp Internet: www.chirp.com.au
|
16
|
+
// Please acknowledge use of this code by including this header.
|
17
|
+
// 2/2013 jon: modified regex to display any match, not restricted to word boundaries.
|
18
|
+
|
19
|
+
function Hilitor(id, tag)
|
20
|
+
{
|
21
|
+
|
22
|
+
var targetNode = document.getElementById(id) || document.body;
|
23
|
+
var hiliteTag = tag || "EM";
|
24
|
+
var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM|SPAN)$");
|
25
|
+
var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
|
26
|
+
var wordColor = [];
|
27
|
+
var colorIdx = 0;
|
28
|
+
var matchRegex = "";
|
29
|
+
var matchingSlides = [];
|
30
|
+
|
31
|
+
this.setRegex = function(input)
|
32
|
+
{
|
33
|
+
input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
|
34
|
+
matchRegex = new RegExp("(" + input + ")","i");
|
35
|
+
}
|
36
|
+
|
37
|
+
this.getRegex = function()
|
38
|
+
{
|
39
|
+
return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
|
40
|
+
}
|
41
|
+
|
42
|
+
// recursively apply word highlighting
|
43
|
+
this.hiliteWords = function(node)
|
44
|
+
{
|
45
|
+
if(node == undefined || !node) return;
|
46
|
+
if(!matchRegex) return;
|
47
|
+
if(skipTags.test(node.nodeName)) return;
|
48
|
+
|
49
|
+
if(node.hasChildNodes()) {
|
50
|
+
for(var i=0; i < node.childNodes.length; i++)
|
51
|
+
this.hiliteWords(node.childNodes[i]);
|
52
|
+
}
|
53
|
+
if(node.nodeType == 3) { // NODE_TEXT
|
54
|
+
if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
|
55
|
+
//find the slide's section element and save it in our list of matching slides
|
56
|
+
var secnode = node.parentNode;
|
57
|
+
while (secnode.nodeName != 'SECTION') {
|
58
|
+
secnode = secnode.parentNode;
|
59
|
+
}
|
60
|
+
|
61
|
+
var slideIndex = Reveal.getIndices(secnode);
|
62
|
+
var slidelen = matchingSlides.length;
|
63
|
+
var alreadyAdded = false;
|
64
|
+
for (var i=0; i < slidelen; i++) {
|
65
|
+
if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
|
66
|
+
alreadyAdded = true;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
if (! alreadyAdded) {
|
70
|
+
matchingSlides.push(slideIndex);
|
71
|
+
}
|
72
|
+
|
73
|
+
if(!wordColor[regs[0].toLowerCase()]) {
|
74
|
+
wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
|
75
|
+
}
|
76
|
+
|
77
|
+
var match = document.createElement(hiliteTag);
|
78
|
+
match.appendChild(document.createTextNode(regs[0]));
|
79
|
+
match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
|
80
|
+
match.style.fontStyle = "inherit";
|
81
|
+
match.style.color = "#000";
|
82
|
+
|
83
|
+
var after = node.splitText(regs.index);
|
84
|
+
after.nodeValue = after.nodeValue.substring(regs[0].length);
|
85
|
+
node.parentNode.insertBefore(match, after);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
// remove highlighting
|
91
|
+
this.remove = function()
|
92
|
+
{
|
93
|
+
var arr = document.getElementsByTagName(hiliteTag);
|
94
|
+
while(arr.length && (el = arr[0])) {
|
95
|
+
el.parentNode.replaceChild(el.firstChild, el);
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
// start highlighting at target node
|
100
|
+
this.apply = function(input)
|
101
|
+
{
|
102
|
+
if(input == undefined || !input) return;
|
103
|
+
this.remove();
|
104
|
+
this.setRegex(input);
|
105
|
+
this.hiliteWords(targetNode);
|
106
|
+
return matchingSlides;
|
107
|
+
};
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
function openSearch() {
|
112
|
+
//ensure the search term input dialog is visible and has focus:
|
113
|
+
var inputbox = document.getElementById("searchinput");
|
114
|
+
inputbox.style.display = "inline";
|
115
|
+
inputbox.focus();
|
116
|
+
inputbox.select();
|
117
|
+
}
|
118
|
+
|
119
|
+
function toggleSearch() {
|
120
|
+
var inputbox = document.getElementById("searchinput");
|
121
|
+
if (inputbox.style.display !== "inline") {
|
122
|
+
openSearch();
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
inputbox.style.display = "none";
|
126
|
+
myHilitor.remove();
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function doSearch() {
|
131
|
+
//if there's been a change in the search term, perform a new search:
|
132
|
+
if (searchboxDirty) {
|
133
|
+
var searchstring = document.getElementById("searchinput").value;
|
134
|
+
|
135
|
+
//find the keyword amongst the slides
|
136
|
+
myHilitor = new Hilitor("slidecontent");
|
137
|
+
matchedSlides = myHilitor.apply(searchstring);
|
138
|
+
currentMatchedIndex = 0;
|
139
|
+
}
|
140
|
+
|
141
|
+
//navigate to the next slide that has the keyword, wrapping to the first if necessary
|
142
|
+
if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) {
|
143
|
+
currentMatchedIndex = 0;
|
144
|
+
}
|
145
|
+
if (matchedSlides.length > currentMatchedIndex) {
|
146
|
+
Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
|
147
|
+
currentMatchedIndex++;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
var dom = {};
|
152
|
+
dom.wrapper = document.querySelector( '.reveal' );
|
153
|
+
|
154
|
+
if( !dom.wrapper.querySelector( '.searchbox' ) ) {
|
155
|
+
var searchElement = document.createElement( 'div' );
|
156
|
+
searchElement.id = "searchinputdiv";
|
157
|
+
searchElement.classList.add( 'searchdiv' );
|
158
|
+
searchElement.style.position = 'absolute';
|
159
|
+
searchElement.style.top = '10px';
|
160
|
+
searchElement.style.left = '10px';
|
161
|
+
//embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
|
162
|
+
searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
|
163
|
+
dom.wrapper.appendChild( searchElement );
|
164
|
+
}
|
165
|
+
|
166
|
+
document.getElementById("searchbutton").addEventListener( 'click', function(event) {
|
167
|
+
doSearch();
|
168
|
+
}, false );
|
169
|
+
|
170
|
+
document.getElementById("searchinput").addEventListener( 'keyup', function( event ) {
|
171
|
+
switch (event.keyCode) {
|
172
|
+
case 13:
|
173
|
+
event.preventDefault();
|
174
|
+
doSearch();
|
175
|
+
searchboxDirty = false;
|
176
|
+
break;
|
177
|
+
default:
|
178
|
+
searchboxDirty = true;
|
179
|
+
}
|
180
|
+
}, false );
|
181
|
+
|
182
|
+
// Open the search when the 's' key is hit (yes, this conflicts with the notes plugin, disabling for now)
|
183
|
+
/*
|
184
|
+
document.addEventListener( 'keydown', function( event ) {
|
185
|
+
// Disregard the event if the target is editable or a
|
186
|
+
// modifier is present
|
187
|
+
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
|
188
|
+
|
189
|
+
if( event.keyCode === 83 ) {
|
190
|
+
event.preventDefault();
|
191
|
+
openSearch();
|
192
|
+
}
|
193
|
+
}, false );
|
194
|
+
*/
|
195
|
+
return { open: openSearch };
|
196
|
+
})();
|