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,97 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
|
7
|
+
<title>reveal.js - Markdown Demo</title>
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="../../css/reveal.css">
|
10
|
+
<link rel="stylesheet" href="../../css/theme/default.css" id="theme">
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
|
15
|
+
<div class="reveal">
|
16
|
+
|
17
|
+
<div class="slides">
|
18
|
+
|
19
|
+
<!-- Use external markdown resource, and separate slides by three newlines; vertical slides by two newlines -->
|
20
|
+
<section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section>
|
21
|
+
|
22
|
+
<!-- Slides are separated by three dashes (quick 'n dirty regular expression) -->
|
23
|
+
<section data-markdown data-separator="---">
|
24
|
+
<script type="text/template">
|
25
|
+
## Demo 1
|
26
|
+
Slide 1
|
27
|
+
---
|
28
|
+
## Demo 1
|
29
|
+
Slide 2
|
30
|
+
---
|
31
|
+
## Demo 1
|
32
|
+
Slide 3
|
33
|
+
</script>
|
34
|
+
</section>
|
35
|
+
|
36
|
+
<!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes -->
|
37
|
+
<section data-markdown data-separator="^\n---\n$" data-vertical="^\n--\n$">
|
38
|
+
<script type="text/template">
|
39
|
+
## Demo 2
|
40
|
+
Slide 1.1
|
41
|
+
|
42
|
+
--
|
43
|
+
|
44
|
+
## Demo 2
|
45
|
+
Slide 1.2
|
46
|
+
|
47
|
+
---
|
48
|
+
|
49
|
+
## Demo 2
|
50
|
+
Slide 2
|
51
|
+
</script>
|
52
|
+
</section>
|
53
|
+
|
54
|
+
<!-- No "extra" slides, since there are no separators defined (so they'll become horizontal rulers) -->
|
55
|
+
<section data-markdown>
|
56
|
+
<script type="text/template">
|
57
|
+
A
|
58
|
+
|
59
|
+
---
|
60
|
+
|
61
|
+
B
|
62
|
+
|
63
|
+
---
|
64
|
+
|
65
|
+
C
|
66
|
+
</script>
|
67
|
+
</section>
|
68
|
+
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
<script src="../../lib/js/head.min.js"></script>
|
73
|
+
<script src="../../js/reveal.js"></script>
|
74
|
+
|
75
|
+
<script>
|
76
|
+
|
77
|
+
Reveal.initialize({
|
78
|
+
controls: true,
|
79
|
+
progress: true,
|
80
|
+
history: true,
|
81
|
+
center: true,
|
82
|
+
|
83
|
+
theme: Reveal.getQueryHash().theme,
|
84
|
+
transition: Reveal.getQueryHash().transition || 'default',
|
85
|
+
|
86
|
+
// Optional libraries used to extend on reveal.js
|
87
|
+
dependencies: [
|
88
|
+
{ src: '../../lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
89
|
+
{ src: 'marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
90
|
+
{ src: 'markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }
|
91
|
+
]
|
92
|
+
});
|
93
|
+
|
94
|
+
</script>
|
95
|
+
|
96
|
+
</body>
|
97
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Markdown Demo
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
## External 1.1
|
6
|
+
|
7
|
+
Content 1.1
|
8
|
+
|
9
|
+
|
10
|
+
## External 1.2
|
11
|
+
|
12
|
+
Content 1.2
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
## External 2
|
17
|
+
|
18
|
+
Content 2.1
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
## External 3.1
|
23
|
+
|
24
|
+
Content 3.1
|
25
|
+
|
26
|
+
|
27
|
+
## External 3.2
|
28
|
+
|
29
|
+
Content 3.2
|
@@ -0,0 +1,190 @@
|
|
1
|
+
// From https://gist.github.com/1343518
|
2
|
+
// Modified by Hakim to handle Markdown indented with tabs
|
3
|
+
(function(){
|
4
|
+
|
5
|
+
if( typeof marked === 'undefined' ) {
|
6
|
+
throw 'The reveal.js Markdown plugin requires marked to be loaded';
|
7
|
+
}
|
8
|
+
|
9
|
+
var stripLeadingWhitespace = function(section) {
|
10
|
+
|
11
|
+
var template = section.querySelector( 'script' );
|
12
|
+
|
13
|
+
// strip leading whitespace so it isn't evaluated as code
|
14
|
+
var text = ( template || section ).textContent;
|
15
|
+
|
16
|
+
var leadingWs = text.match(/^\n?(\s*)/)[1].length,
|
17
|
+
leadingTabs = text.match(/^\n?(\t*)/)[1].length;
|
18
|
+
|
19
|
+
if( leadingTabs > 0 ) {
|
20
|
+
text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
|
21
|
+
}
|
22
|
+
else if( leadingWs > 1 ) {
|
23
|
+
text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
|
24
|
+
}
|
25
|
+
|
26
|
+
return text;
|
27
|
+
|
28
|
+
};
|
29
|
+
|
30
|
+
var twrap = function(el) {
|
31
|
+
return '<script type="text/template">' + el + '</script>';
|
32
|
+
};
|
33
|
+
|
34
|
+
var getForwardedAttributes = function(section) {
|
35
|
+
var attributes = section.attributes;
|
36
|
+
var result = [];
|
37
|
+
|
38
|
+
for( var i = 0, len = attributes.length; i < len; i++ ) {
|
39
|
+
var name = attributes[i].name,
|
40
|
+
value = attributes[i].value;
|
41
|
+
|
42
|
+
// disregard attributes that are used for markdown loading/parsing
|
43
|
+
if( /data\-(markdown|separator|vertical)/gi.test( name ) ) continue;
|
44
|
+
|
45
|
+
if( value ) {
|
46
|
+
result.push( name + '=' + value );
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
result.push( name );
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
return result.join( ' ' );
|
54
|
+
}
|
55
|
+
|
56
|
+
var slidifyMarkdown = function(markdown, separator, vertical, attributes) {
|
57
|
+
|
58
|
+
separator = separator || '^\n---\n$';
|
59
|
+
|
60
|
+
var reSeparator = new RegExp(separator + (vertical ? '|' + vertical : ''), 'mg'),
|
61
|
+
reHorSeparator = new RegExp(separator),
|
62
|
+
matches,
|
63
|
+
lastIndex = 0,
|
64
|
+
isHorizontal,
|
65
|
+
wasHorizontal = true,
|
66
|
+
content,
|
67
|
+
sectionStack = [],
|
68
|
+
markdownSections = '';
|
69
|
+
|
70
|
+
// iterate until all blocks between separators are stacked up
|
71
|
+
while( matches = reSeparator.exec(markdown) ) {
|
72
|
+
|
73
|
+
// determine direction (horizontal by default)
|
74
|
+
isHorizontal = reHorSeparator.test(matches[0]);
|
75
|
+
|
76
|
+
if( !isHorizontal && wasHorizontal ) {
|
77
|
+
// create vertical stack
|
78
|
+
sectionStack.push([]);
|
79
|
+
}
|
80
|
+
|
81
|
+
// pluck slide content from markdown input
|
82
|
+
content = markdown.substring(lastIndex, matches.index);
|
83
|
+
|
84
|
+
if( isHorizontal && wasHorizontal ) {
|
85
|
+
// add to horizontal stack
|
86
|
+
sectionStack.push(content);
|
87
|
+
} else {
|
88
|
+
// add to vertical stack
|
89
|
+
sectionStack[sectionStack.length-1].push(content);
|
90
|
+
}
|
91
|
+
|
92
|
+
lastIndex = reSeparator.lastIndex;
|
93
|
+
wasHorizontal = isHorizontal;
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
// add the remaining slide
|
98
|
+
(wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1]).push(markdown.substring(lastIndex));
|
99
|
+
|
100
|
+
// flatten the hierarchical stack, and insert <section data-markdown> tags
|
101
|
+
for( var k = 0, klen = sectionStack.length; k < klen; k++ ) {
|
102
|
+
// horizontal
|
103
|
+
if( typeof sectionStack[k] === 'string' ) {
|
104
|
+
markdownSections += '<section '+ attributes +' data-markdown>' + twrap( sectionStack[k] ) + '</section>';
|
105
|
+
}
|
106
|
+
// vertical
|
107
|
+
else {
|
108
|
+
markdownSections += '<section '+ attributes +'>' +
|
109
|
+
'<section data-markdown>' + sectionStack[k].map(twrap).join('</section><section data-markdown>') + '</section>' +
|
110
|
+
'</section>';
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
return markdownSections;
|
115
|
+
};
|
116
|
+
|
117
|
+
var querySlidingMarkdown = function() {
|
118
|
+
|
119
|
+
var sections = document.querySelectorAll( '[data-markdown]'),
|
120
|
+
section;
|
121
|
+
|
122
|
+
for( var j = 0, jlen = sections.length; j < jlen; j++ ) {
|
123
|
+
|
124
|
+
section = sections[j];
|
125
|
+
|
126
|
+
if( section.getAttribute('data-markdown').length ) {
|
127
|
+
|
128
|
+
var xhr = new XMLHttpRequest(),
|
129
|
+
url = section.getAttribute('data-markdown');
|
130
|
+
|
131
|
+
xhr.onreadystatechange = function () {
|
132
|
+
if( xhr.readyState === 4 ) {
|
133
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
134
|
+
section.outerHTML = slidifyMarkdown( xhr.responseText, section.getAttribute('data-separator'), section.getAttribute('data-vertical'), getForwardedAttributes(section) );
|
135
|
+
} else {
|
136
|
+
section.outerHTML = '<section data-state="alert">ERROR: The attempt to fetch ' + url + ' failed with the HTTP status ' + xhr.status +
|
137
|
+
'. Check your browser\'s JavaScript console for more details.' +
|
138
|
+
'<p>Remember that you need to serve the presentation HTML from a HTTP server and the Markdown file must be there too.</p></section>';
|
139
|
+
}
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
xhr.open('GET', url, false);
|
144
|
+
try {
|
145
|
+
xhr.send();
|
146
|
+
} catch (e) {
|
147
|
+
alert('Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e);
|
148
|
+
}
|
149
|
+
|
150
|
+
} else if( section.getAttribute('data-separator') ) {
|
151
|
+
|
152
|
+
var markdown = stripLeadingWhitespace(section);
|
153
|
+
section.outerHTML = slidifyMarkdown( markdown, section.getAttribute('data-separator'), section.getAttribute('data-vertical'), getForwardedAttributes(section) );
|
154
|
+
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
};
|
159
|
+
|
160
|
+
var queryMarkdownSlides = function() {
|
161
|
+
|
162
|
+
var sections = document.querySelectorAll( '[data-markdown]');
|
163
|
+
|
164
|
+
for( var j = 0, jlen = sections.length; j < jlen; j++ ) {
|
165
|
+
|
166
|
+
makeHtml(sections[j]);
|
167
|
+
|
168
|
+
}
|
169
|
+
|
170
|
+
};
|
171
|
+
|
172
|
+
var makeHtml = function(section) {
|
173
|
+
|
174
|
+
var notes = section.querySelector( 'aside.notes' );
|
175
|
+
|
176
|
+
var markdown = stripLeadingWhitespace(section);
|
177
|
+
|
178
|
+
section.innerHTML = marked(markdown);
|
179
|
+
|
180
|
+
if( notes ) {
|
181
|
+
section.appendChild( notes );
|
182
|
+
}
|
183
|
+
|
184
|
+
};
|
185
|
+
|
186
|
+
querySlidingMarkdown();
|
187
|
+
|
188
|
+
queryMarkdownSlides();
|
189
|
+
|
190
|
+
})();
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* marked - a markdown parser
|
3
|
+
* Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
|
4
|
+
* https://github.com/chjj/marked
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
|
8
|
+
text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";block.html=replace(block.html)("comment",/\x3c!--[\s\S]*?--\x3e/)("closed",
|
9
|
+
/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1",
|
10
|
+
"\\2")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm)if(this.options.tables)this.rules=block.tables;else this.rules=block.gfm}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};
|
11
|
+
Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1)this.tokens.push({type:"space"})}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,
|
12
|
+
"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,
|
13
|
+
"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i<item.align.length;i++)if(/^ *-+: *$/.test(item.align[i]))item.align[i]="right";else if(/^ *:-+: *$/.test(item.align[i]))item.align[i]="center";else if(/^ *:-+ *$/.test(item.align[i]))item.align[i]="left";else item.align[i]=null;for(i=0;i<item.cells.length;i++)item.cells[i]=item.cells[i].split(/ *\| */);this.tokens.push(item);continue}if(cap=this.rules.lheading.exec(src)){src=
|
14
|
+
src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[2]==="="?1:2,text:cap[1]});continue}if(cap=this.rules.hr.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"hr"});continue}if(cap=this.rules.blockquote.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"blockquote_start"});cap=cap[0].replace(/^ *> ?/gm,"");this.token(cap,top);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);
|
15
|
+
bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i<l;i++){item=cap[i];space=item.length;item=item.replace(/^ *([*+-]|\d+\.) +/,"");if(~item.indexOf("\n ")){space-=item.length;item=!this.options.pedantic?item.replace(new RegExp("^ {1,"+space+"}","gm"),""):item.replace(/^ {1,4}/gm,"")}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap[i+1])[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+
|
16
|
+
1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item[item.length-1]==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script",text:cap[0]});continue}if(top&&
|
17
|
+
(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i<item.align.length;i++)if(/^ *-+: *$/.test(item.align[i]))item.align[i]="right";else if(/^ *:-+: *$/.test(item.align[i]))item.align[i]=
|
18
|
+
"center";else if(/^ *:-+ *$/.test(item.align[i]))item.align[i]="left";else item.align[i]=null;for(i=0;i<item.cells.length;i++)item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(item);continue}if(top&&(cap=this.rules.paragraph.exec(src))){src=src.substring(cap[0].length);this.tokens.push({type:"paragraph",text:cap[1][cap[1].length-1]==="\n"?cap[1].slice(0,-1):cap[1]});continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"text",
|
19
|
+
text:cap[0]});continue}if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0));}return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^\x3c!--[\s\S]*?--\x3e|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
|
20
|
+
code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};inline._inside=/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/;inline._href=/\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
21
|
+
em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;
|
22
|
+
if(!this.links)throw new Error("Tokens array requires a `links` property.");if(this.options.gfm)if(this.options.breaks)this.rules=inline.breaks;else this.rules=inline.gfm;else if(this.options.pedantic)this.rules=inline.pedantic}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);
|
23
|
+
out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1][6]===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+='<a href="'+href+'">'+text+"</a>";continue}if(cap=this.rules.url.exec(src)){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+='<a href="'+href+'">'+text+"</a>";continue}if(cap=this.rules.tag.exec(src)){src=src.substring(cap[0].length);
|
24
|
+
out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);out+=this.outputLink(cap,{href:cap[2],title:cap[3]});continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0][0];src=cap[0].substring(1)+src;continue}out+=this.outputLink(cap,link);continue}if(cap=this.rules.strong.exec(src)){src=
|
25
|
+
src.substring(cap[0].length);out+="<strong>"+this.output(cap[2]||cap[1])+"</strong>";continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+="<em>"+this.output(cap[2]||cap[1])+"</em>";continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+="<code>"+escape(cap[2],true)+"</code>";continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+="<br>";continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+="<del>"+
|
26
|
+
this.output(cap[1])+"</del>";continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(cap[0]);continue}if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0));}return out};InlineLexer.prototype.outputLink=function(cap,link){if(cap[0][0]!=="!")return'<a href="'+escape(link.href)+'"'+(link.title?' title="'+escape(link.title)+'"':"")+">"+this.output(cap[1])+"</a>";else return'<img src="'+escape(link.href)+'" alt="'+escape(cap[1])+'"'+(link.title?' title="'+
|
27
|
+
escape(link.title)+'"':"")+">"};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>0.5)ch="x"+ch.toString(16);out+="&#"+ch+";"}return out};function Parser(options){this.tokens=[];this.token=null;
|
28
|
+
this.options=options||marked.defaults}Parser.parse=function(src,options){var parser=new Parser(options);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options);this.tokens=src.reverse();var out="";while(this.next())out+=this.tok();return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;
|
29
|
+
while(this.peek().type==="text")body+="\n"+this.next().text;return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"<hr>\n";case "heading":return"<h"+this.token.depth+">"+this.inline.output(this.token.text)+"</h"+this.token.depth+">\n";case "code":if(this.options.highlight){var code=this.options.highlight(this.token.text,this.token.lang);if(code!=null&&code!==this.token.text){this.token.escaped=true;this.token.text=code}}if(!this.token.escaped)this.token.text=
|
30
|
+
escape(this.token.text,true);return"<pre><code"+(this.token.lang?' class="'+this.options.langPrefix+this.token.lang+'"':"")+">"+this.token.text+"</code></pre>\n";case "table":var body="",heading,i,row,cell,j;body+="<thead>\n<tr>\n";for(i=0;i<this.token.header.length;i++){heading=this.inline.output(this.token.header[i]);body+=this.token.align[i]?'<th align="'+this.token.align[i]+'">'+heading+"</th>\n":"<th>"+heading+"</th>\n"}body+="</tr>\n</thead>\n";body+="<tbody>\n";for(i=0;i<this.token.cells.length;i++){row=
|
31
|
+
this.token.cells[i];body+="<tr>\n";for(j=0;j<row.length;j++){cell=this.inline.output(row[j]);body+=this.token.align[j]?'<td align="'+this.token.align[j]+'">'+cell+"</td>\n":"<td>"+cell+"</td>\n"}body+="</tr>\n"}body+="</tbody>\n";return"<table>\n"+body+"</table>\n";case "blockquote_start":var body="";while(this.next().type!=="blockquote_end")body+=this.tok();return"<blockquote>\n"+body+"</blockquote>\n";case "list_start":var type=this.token.ordered?"ol":"ul",body="";while(this.next().type!=="list_end")body+=
|
32
|
+
this.tok();return"<"+type+">\n"+body+"</"+type+">\n";case "list_item_start":var body="";while(this.next().type!=="list_item_end")body+=this.token.type==="text"?this.parseText():this.tok();return"<li>"+body+"</li>\n";case "loose_item_start":var body="";while(this.next().type!=="list_item_end")body+=this.tok();return"<li>"+body+"</li>\n";case "html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case "paragraph":return"<p>"+this.inline.output(this.token.text)+
|
33
|
+
"</p>\n";case "text":return"<p>"+this.parseText()+"</p>\n"}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=
|
34
|
+
1,target,key;for(;i<arguments.length;i++){target=arguments[i];for(key in target)if(Object.prototype.hasOwnProperty.call(target,key))obj[key]=target[key]}return obj}function marked(src,opt,callback){if(callback||typeof opt==="function"){if(!callback){callback=opt;opt=null}if(opt)opt=merge({},marked.defaults,opt);var tokens=Lexer.lex(tokens,opt),highlight=opt.highlight,pending=0,l=tokens.length,i=0;if(!highlight||highlight.length<3)return callback(null,Parser.parse(tokens,opt));var done=function(){delete opt.highlight;
|
35
|
+
var out=Parser.parse(tokens,opt);opt.highlight=highlight;return callback(null,out)};for(;i<l;i++)(function(token){if(token.type!=="code")return;pending++;return highlight(token.text,token.lang,function(err,code){if(code==null||code===token.text)return--pending||done();token.text=code;token.escaped=true;--pending||done()})})(tokens[i]);return}try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+="\nPlease report this to https://github.com/chjj/marked.";
|
36
|
+
if((opt||marked.defaults).silent)return"<p>An error occured:</p><pre>"+escape(e.message+"",true)+"</pre>";throw e;}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:""};marked.Parser=Parser;marked.parser=Parser.parse;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;
|
37
|
+
marked.parse=marked;if(typeof exports==="object")module.exports=marked;else if(typeof define==="function"&&define.amd)define(function(){return marked});else this.marked=marked}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
|
@@ -0,0 +1,13 @@
|
|
1
|
+
(function() {
|
2
|
+
var multiplex = Reveal.getConfig().multiplex;
|
3
|
+
var socketId = multiplex.id;
|
4
|
+
var socket = io.connect(multiplex.url);
|
5
|
+
|
6
|
+
socket.on(multiplex.id, function(data) {
|
7
|
+
// ignore data from sockets that aren't ours
|
8
|
+
if (data.socketId !== socketId) { return; }
|
9
|
+
if( window.location.host === 'localhost:1947' ) return;
|
10
|
+
|
11
|
+
Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote');
|
12
|
+
});
|
13
|
+
}());
|
@@ -0,0 +1,56 @@
|
|
1
|
+
var express = require('express');
|
2
|
+
var fs = require('fs');
|
3
|
+
var io = require('socket.io');
|
4
|
+
var crypto = require('crypto');
|
5
|
+
|
6
|
+
var app = express.createServer();
|
7
|
+
var staticDir = express.static;
|
8
|
+
|
9
|
+
io = io.listen(app);
|
10
|
+
|
11
|
+
var opts = {
|
12
|
+
port: 1948,
|
13
|
+
baseDir : __dirname + '/../../'
|
14
|
+
};
|
15
|
+
|
16
|
+
io.sockets.on('connection', function(socket) {
|
17
|
+
socket.on('slidechanged', function(slideData) {
|
18
|
+
if (typeof slideData.secret == 'undefined' || slideData.secret == null || slideData.secret === '') return;
|
19
|
+
if (createHash(slideData.secret) === slideData.socketId) {
|
20
|
+
slideData.secret = null;
|
21
|
+
socket.broadcast.emit(slideData.socketId, slideData);
|
22
|
+
};
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
app.configure(function() {
|
27
|
+
[ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) {
|
28
|
+
app.use('/' + dir, staticDir(opts.baseDir + dir));
|
29
|
+
});
|
30
|
+
});
|
31
|
+
|
32
|
+
app.get("/", function(req, res) {
|
33
|
+
res.writeHead(200, {'Content-Type': 'text/html'});
|
34
|
+
fs.createReadStream(opts.baseDir + '/index.html').pipe(res);
|
35
|
+
});
|
36
|
+
|
37
|
+
app.get("/token", function(req,res) {
|
38
|
+
var ts = new Date().getTime();
|
39
|
+
var rand = Math.floor(Math.random()*9999999);
|
40
|
+
var secret = ts.toString() + rand.toString();
|
41
|
+
res.send({secret: secret, socketId: createHash(secret)});
|
42
|
+
});
|
43
|
+
|
44
|
+
var createHash = function(secret) {
|
45
|
+
var cipher = crypto.createCipher('blowfish', secret);
|
46
|
+
return(cipher.final('hex'));
|
47
|
+
};
|
48
|
+
|
49
|
+
// Actually listen
|
50
|
+
app.listen(opts.port || null);
|
51
|
+
|
52
|
+
var brown = '\033[33m',
|
53
|
+
green = '\033[32m',
|
54
|
+
reset = '\033[0m';
|
55
|
+
|
56
|
+
console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset );
|
@@ -0,0 +1,50 @@
|
|
1
|
+
(function() {
|
2
|
+
// don't emit events from inside the previews themselves
|
3
|
+
if ( window.location.search.match( /receiver/gi ) ) { return; }
|
4
|
+
var multiplex = Reveal.getConfig().multiplex;
|
5
|
+
|
6
|
+
var socket = io.connect(multiplex.url);
|
7
|
+
|
8
|
+
var notify = function( slideElement, indexh, indexv, origin ) {
|
9
|
+
if( typeof origin === 'undefined' && origin !== 'remote' ) {
|
10
|
+
var nextindexh;
|
11
|
+
var nextindexv;
|
12
|
+
|
13
|
+
var fragmentindex = Reveal.getIndices().f;
|
14
|
+
if (typeof fragmentindex == 'undefined') {
|
15
|
+
fragmentindex = 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
|
19
|
+
nextindexh = indexh;
|
20
|
+
nextindexv = indexv + 1;
|
21
|
+
} else {
|
22
|
+
nextindexh = indexh + 1;
|
23
|
+
nextindexv = 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
var slideData = {
|
27
|
+
indexh : indexh,
|
28
|
+
indexv : indexv,
|
29
|
+
indexf : fragmentindex,
|
30
|
+
nextindexh : nextindexh,
|
31
|
+
nextindexv : nextindexv,
|
32
|
+
secret: multiplex.secret,
|
33
|
+
socketId : multiplex.id
|
34
|
+
};
|
35
|
+
|
36
|
+
socket.emit('slidechanged', slideData);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
Reveal.addEventListener( 'slidechanged', function( event ) {
|
41
|
+
notify( event.currentSlide, event.indexh, event.indexv, event.origin );
|
42
|
+
} );
|
43
|
+
|
44
|
+
var fragmentNotify = function( event ) {
|
45
|
+
notify( Reveal.getCurrentSlide(), Reveal.getIndices().h, Reveal.getIndices().v, event.origin );
|
46
|
+
};
|
47
|
+
|
48
|
+
Reveal.addEventListener( 'fragmentshown', fragmentNotify );
|
49
|
+
Reveal.addEventListener( 'fragmenthidden', fragmentNotify );
|
50
|
+
}());
|