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,36 @@
|
|
1
|
+
.goto-form {
|
2
|
+
position: absolute;
|
3
|
+
z-index: 3;
|
4
|
+
bottom: 10px;
|
5
|
+
left: 50%;
|
6
|
+
height: 1.75em;
|
7
|
+
margin: 0 0 0 -9.125em;
|
8
|
+
line-height: 1.75em;
|
9
|
+
padding: 0.625em;
|
10
|
+
display: none;
|
11
|
+
background: #ccc;
|
12
|
+
overflow: hidden;
|
13
|
+
border-radius: 10px;
|
14
|
+
}
|
15
|
+
.goto-form label {
|
16
|
+
font-weight: bold;
|
17
|
+
}
|
18
|
+
.goto-form label, .goto-form input {
|
19
|
+
display: inline-block;
|
20
|
+
font-family: inherit;
|
21
|
+
}
|
22
|
+
.deck-goto .goto-form {
|
23
|
+
display: block;
|
24
|
+
}
|
25
|
+
|
26
|
+
#goto-slide {
|
27
|
+
width: 8.375em;
|
28
|
+
margin: 0 0.625em;
|
29
|
+
height: 1.4375em;
|
30
|
+
}
|
31
|
+
|
32
|
+
@media print {
|
33
|
+
.goto-form, #goto-slide {
|
34
|
+
display: none;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<!-- Place the following snippet at the bottom of the deck container. -->
|
2
|
+
<form action="." method="get" class="goto-form">
|
3
|
+
<label for="goto-slide">Go to slide:</label>
|
4
|
+
<input type="text" name="slidenum" id="goto-slide" list="goto-datalist">
|
5
|
+
<datalist id="goto-datalist"></datalist>
|
6
|
+
<input type="submit" value="Go">
|
7
|
+
</form>
|
@@ -0,0 +1,190 @@
|
|
1
|
+
/*!
|
2
|
+
Deck JS - deck.goto
|
3
|
+
Copyright (c) 2011-2014 Caleb Troughton
|
4
|
+
Dual licensed under the MIT license.
|
5
|
+
https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*
|
9
|
+
This module adds the necessary methods and key bindings to show and hide a form
|
10
|
+
for jumping to any slide number/id in the deck (and processes that form
|
11
|
+
accordingly). The form-showing state is indicated by the presence of a class on
|
12
|
+
the deck container.
|
13
|
+
*/
|
14
|
+
(function($, undefined) {
|
15
|
+
var $document = $(document);
|
16
|
+
var rootCounter;
|
17
|
+
|
18
|
+
var bindKeyEvents = function() {
|
19
|
+
$document.unbind('keydown.deckgoto');
|
20
|
+
$document.bind('keydown.deckgoto', function(event) {
|
21
|
+
var key = $.deck('getOptions').keys.goto;
|
22
|
+
if (event.which === key || $.inArray(event.which, key) > -1) {
|
23
|
+
event.preventDefault();
|
24
|
+
$.deck('toggleGoTo');
|
25
|
+
}
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
var populateDatalist = function() {
|
30
|
+
var options = $.deck('getOptions');
|
31
|
+
var $datalist = $(options.selectors.gotoDatalist);
|
32
|
+
|
33
|
+
$.each($.deck('getSlides'), function(i, $slide) {
|
34
|
+
var id = $slide.attr('id');
|
35
|
+
if (id) {
|
36
|
+
$datalist.append('<option value="' + id + '">');
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
var markRootSlides = function() {
|
42
|
+
var options = $.deck('getOptions');
|
43
|
+
var slideTest = $.map([
|
44
|
+
options.classes.before,
|
45
|
+
options.classes.previous,
|
46
|
+
options.classes.current,
|
47
|
+
options.classes.next,
|
48
|
+
options.classes.after
|
49
|
+
], function(el, i) {
|
50
|
+
return '.' + el;
|
51
|
+
}).join(', ');
|
52
|
+
|
53
|
+
rootCounter = 0;
|
54
|
+
$.each($.deck('getSlides'), function(i, $slide) {
|
55
|
+
var $parentSlides = $slide.parentsUntil(
|
56
|
+
options.selectors.container,
|
57
|
+
slideTest
|
58
|
+
);
|
59
|
+
|
60
|
+
if ($parentSlides.length) {
|
61
|
+
$slide.removeData('rootIndex');
|
62
|
+
}
|
63
|
+
else if (!options.countNested) {
|
64
|
+
++rootCounter;
|
65
|
+
$slide.data('rootIndex', rootCounter);
|
66
|
+
}
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
var handleFormSubmit = function() {
|
71
|
+
var options = $.deck('getOptions');
|
72
|
+
var $form = $(options.selectors.gotoForm);
|
73
|
+
|
74
|
+
$form.unbind('submit.deckgoto');
|
75
|
+
$form.bind('submit.deckgoto', function(event) {
|
76
|
+
var $field = $(options.selectors.gotoInput);
|
77
|
+
var indexOrId = $field.val();
|
78
|
+
var index = parseInt(indexOrId, 10);
|
79
|
+
|
80
|
+
if (!options.countNested) {
|
81
|
+
if (!isNaN(index) && index >= rootCounter) {
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
$.each($.deck('getSlides'), function(i, $slide) {
|
85
|
+
if ($slide.data('rootIndex') === index) {
|
86
|
+
index = i + 1;
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
$.deck('go', isNaN(index) ? indexOrId : index - 1);
|
93
|
+
$.deck('hideGoTo');
|
94
|
+
$field.val('');
|
95
|
+
event.preventDefault();
|
96
|
+
});
|
97
|
+
};
|
98
|
+
|
99
|
+
/*
|
100
|
+
Extends defaults/options.
|
101
|
+
|
102
|
+
options.classes.goto
|
103
|
+
This class is added to the deck container when showing the Go To Slide
|
104
|
+
form.
|
105
|
+
|
106
|
+
options.selectors.gotoDatalist
|
107
|
+
The element that matches this selector is the datalist element that will
|
108
|
+
be populated with options for each of the slide ids. In browsers that
|
109
|
+
support the datalist element, this provides a drop list of slide ids to
|
110
|
+
aid the user in selecting a slide.
|
111
|
+
|
112
|
+
options.selectors.gotoForm
|
113
|
+
The element that matches this selector is the form that is submitted
|
114
|
+
when a user hits enter after typing a slide number/id in the gotoInput
|
115
|
+
element.
|
116
|
+
|
117
|
+
options.selectors.gotoInput
|
118
|
+
The element that matches this selector is the text input field for
|
119
|
+
entering a slide number/id in the Go To Slide form.
|
120
|
+
|
121
|
+
options.keys.goto
|
122
|
+
The numeric keycode used to show the Go To Slide form.
|
123
|
+
|
124
|
+
options.countNested
|
125
|
+
If false, only top level slides will be counted when entering a
|
126
|
+
slide number.
|
127
|
+
*/
|
128
|
+
$.extend(true, $.deck.defaults, {
|
129
|
+
classes: {
|
130
|
+
goto: 'deck-goto'
|
131
|
+
},
|
132
|
+
|
133
|
+
selectors: {
|
134
|
+
gotoDatalist: '#goto-datalist',
|
135
|
+
gotoForm: '.goto-form',
|
136
|
+
gotoInput: '#goto-slide'
|
137
|
+
},
|
138
|
+
|
139
|
+
keys: {
|
140
|
+
goto: 71 // g
|
141
|
+
},
|
142
|
+
|
143
|
+
countNested: true
|
144
|
+
});
|
145
|
+
|
146
|
+
/*
|
147
|
+
jQuery.deck('showGoTo')
|
148
|
+
|
149
|
+
Shows the Go To Slide form by adding the class specified by the goto class
|
150
|
+
option to the deck container.
|
151
|
+
*/
|
152
|
+
$.deck('extend', 'showGoTo', function() {
|
153
|
+
var options = $.deck('getOptions');
|
154
|
+
$.deck('getContainer').addClass(options.classes.goto);
|
155
|
+
$(options.selectors.gotoForm).attr('aria-hidden', false);
|
156
|
+
$(options.selectors.gotoInput).focus();
|
157
|
+
});
|
158
|
+
|
159
|
+
/*
|
160
|
+
jQuery.deck('hideGoTo')
|
161
|
+
|
162
|
+
Hides the Go To Slide form by removing the class specified by the goto class
|
163
|
+
option from the deck container.
|
164
|
+
*/
|
165
|
+
$.deck('extend', 'hideGoTo', function() {
|
166
|
+
var options = $.deck('getOptions');
|
167
|
+
$(options.selectors.gotoInput).blur();
|
168
|
+
$.deck('getContainer').removeClass(options.classes.goto);
|
169
|
+
$(options.selectors.gotoForm).attr('aria-hidden', true);
|
170
|
+
});
|
171
|
+
|
172
|
+
/*
|
173
|
+
jQuery.deck('toggleGoTo')
|
174
|
+
|
175
|
+
Toggles between showing and hiding the Go To Slide form.
|
176
|
+
*/
|
177
|
+
$.deck('extend', 'toggleGoTo', function() {
|
178
|
+
var options = $.deck('getOptions');
|
179
|
+
var hasGotoClass = $.deck('getContainer').hasClass(options.classes.goto);
|
180
|
+
$.deck(hasGotoClass ? 'hideGoTo' : 'showGoTo');
|
181
|
+
});
|
182
|
+
|
183
|
+
$document.bind('deck.init', function() {
|
184
|
+
bindKeyEvents();
|
185
|
+
populateDatalist();
|
186
|
+
markRootSlides();
|
187
|
+
handleFormSubmit();
|
188
|
+
});
|
189
|
+
})(jQuery);
|
190
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.goto-form {
|
2
|
+
position:absolute;
|
3
|
+
z-index:3;
|
4
|
+
bottom:10px;
|
5
|
+
left:50%;
|
6
|
+
height:1.75em;
|
7
|
+
margin:0 0 0 -9.125em;
|
8
|
+
line-height:1.75em;
|
9
|
+
padding:0.625em;
|
10
|
+
display:none;
|
11
|
+
background:#ccc;
|
12
|
+
overflow:hidden;
|
13
|
+
border-radius:10px;
|
14
|
+
|
15
|
+
label {
|
16
|
+
font-weight:bold;
|
17
|
+
}
|
18
|
+
|
19
|
+
label, input {
|
20
|
+
display:inline-block;
|
21
|
+
font-family:inherit;
|
22
|
+
}
|
23
|
+
|
24
|
+
.deck-goto & {
|
25
|
+
display:block;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
#goto-slide {
|
30
|
+
width:8.375em;
|
31
|
+
margin:0 0.625em;
|
32
|
+
height:1.4375em;
|
33
|
+
}
|
34
|
+
|
35
|
+
@media print {
|
36
|
+
.goto-form, #goto-slide {
|
37
|
+
display:none;
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,145 @@
|
|
1
|
+
/*!
|
2
|
+
Deck JS - deck.hash
|
3
|
+
Copyright (c) 2011-2013 Caleb Troughton
|
4
|
+
Dual licensed under the MIT license.
|
5
|
+
https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*
|
9
|
+
This module adds deep linking to individual slides, enables internal links
|
10
|
+
to slides within decks, and updates the address bar with the hash as the user
|
11
|
+
moves through the deck. A permalink anchor is also updated. Standard themes
|
12
|
+
hide this link in browsers that support the History API, and show it for
|
13
|
+
those that do not. Slides that do not have an id are assigned one according to
|
14
|
+
the hashPrefix option. In addition to the on-slide container state class
|
15
|
+
kept by core, this module adds an on-slide state class that uses the id of each
|
16
|
+
slide.
|
17
|
+
*/
|
18
|
+
(function ($, undefined) {
|
19
|
+
var $document = $(document);
|
20
|
+
var $window = $(window);
|
21
|
+
|
22
|
+
/* Collection of internal fragment links in the deck */
|
23
|
+
var $fragmentLinks;
|
24
|
+
|
25
|
+
/*
|
26
|
+
Internal only function. Given a string, extracts the id from the hash,
|
27
|
+
matches it to the appropriate slide, and navigates there.
|
28
|
+
*/
|
29
|
+
var goByHash = function(str) {
|
30
|
+
var id = str.substr(str.indexOf("#") + 1);
|
31
|
+
var slides = $.deck('getSlides');
|
32
|
+
|
33
|
+
$.each(slides, function(i, $slide) {
|
34
|
+
if ($slide.attr('id') === id) {
|
35
|
+
$.deck('go', i);
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
// If we don't set these to 0 the container scrolls due to hashchange
|
41
|
+
if ($.deck('getOptions').preventFragmentScroll) {
|
42
|
+
$.deck('getContainer').scrollLeft(0).scrollTop(0);
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
var assignSlideId = function(i, $slide) {
|
47
|
+
var options = $.deck('getOptions');
|
48
|
+
var currentId = $slide.attr('id');
|
49
|
+
var previouslyAssigned = $slide.data('deckAssignedId') === currentId;
|
50
|
+
if (!currentId || previouslyAssigned) {
|
51
|
+
$slide.attr('id', options.hashPrefix + i);
|
52
|
+
$slide.data('deckAssignedId', options.hashPrefix + i);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
var removeContainerStateClass = function(id) {
|
57
|
+
var options = $.deck('getOptions');
|
58
|
+
$.deck('getContainer').removeClass(options.classes.onPrefix + id);
|
59
|
+
};
|
60
|
+
|
61
|
+
var addContainerStateClass = function(id) {
|
62
|
+
var options = $.deck('getOptions');
|
63
|
+
$.deck('getContainer').addClass(options.classes.onPrefix + id);
|
64
|
+
};
|
65
|
+
|
66
|
+
/*
|
67
|
+
Extends defaults/options.
|
68
|
+
|
69
|
+
options.selectors.hashLink
|
70
|
+
The element matching this selector has its href attribute updated to
|
71
|
+
the hash of the current slide as the user navigates through the deck.
|
72
|
+
|
73
|
+
options.hashPrefix
|
74
|
+
Every slide that does not have an id is assigned one at initialization.
|
75
|
+
Assigned ids take the form of hashPrefix + slideIndex, e.g., slide-0,
|
76
|
+
slide-12, etc.
|
77
|
+
|
78
|
+
options.preventFragmentScroll
|
79
|
+
When deep linking to a hash of a nested slide, this scrolls the deck
|
80
|
+
container to the top, undoing the natural browser behavior of scrolling
|
81
|
+
to the document fragment on load.
|
82
|
+
*/
|
83
|
+
$.extend(true, $.deck.defaults, {
|
84
|
+
selectors: {
|
85
|
+
hashLink: '.deck-permalink'
|
86
|
+
},
|
87
|
+
|
88
|
+
hashPrefix: 'slide-',
|
89
|
+
preventFragmentScroll: true
|
90
|
+
});
|
91
|
+
|
92
|
+
|
93
|
+
$document.bind('deck.init', function() {
|
94
|
+
var options = $.deck('getOptions');
|
95
|
+
var slides = $.deck('getSlides');
|
96
|
+
|
97
|
+
$fragmentLinks = $();
|
98
|
+
$.each(slides, function(i, $slide) {
|
99
|
+
var hash;
|
100
|
+
|
101
|
+
assignSlideId(i, $slide);
|
102
|
+
hash = '#' + $slide.attr('id');
|
103
|
+
if (hash === window.location.hash) {
|
104
|
+
setTimeout(function() {
|
105
|
+
$.deck('go', i);
|
106
|
+
}, 1);
|
107
|
+
}
|
108
|
+
$fragmentLinks = $fragmentLinks.add('a[href="' + hash + '"]');
|
109
|
+
});
|
110
|
+
|
111
|
+
/* Set up first id container state class */
|
112
|
+
if (slides.length) {
|
113
|
+
addContainerStateClass($.deck('getSlide').attr('id'));
|
114
|
+
};
|
115
|
+
});
|
116
|
+
|
117
|
+
/* Update permalink, address bar, and state class on a slide change */
|
118
|
+
$document.bind('deck.change', function(event, from, to) {
|
119
|
+
var hash = '#' + $.deck('getSlide', to).attr('id');
|
120
|
+
var hashPath = window.location.href.replace(/#.*/, '') + hash;
|
121
|
+
var options = $.deck('getOptions');
|
122
|
+
|
123
|
+
removeContainerStateClass($.deck('getSlide', from).attr('id'));
|
124
|
+
addContainerStateClass($.deck('getSlide', to).attr('id'));
|
125
|
+
$(options.selectors.hashLink).attr('href', hashPath);
|
126
|
+
if (Modernizr.history) {
|
127
|
+
window.history.replaceState({}, "", hashPath);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
|
131
|
+
$window.bind('hashchange.deckhash', function(event) {
|
132
|
+
if (event.originalEvent && event.originalEvent.newURL) {
|
133
|
+
goByHash(event.originalEvent.newURL);
|
134
|
+
}
|
135
|
+
else {
|
136
|
+
goByHash(window.location.hash);
|
137
|
+
}
|
138
|
+
})
|
139
|
+
|
140
|
+
$window.bind('load', function() {
|
141
|
+
if ($.deck('getOptions').preventFragmentScroll) {
|
142
|
+
$.deck('getContainer').scrollLeft(0).scrollTop(0);
|
143
|
+
}
|
144
|
+
});
|
145
|
+
})(jQuery);
|