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,256 @@
|
|
1
|
+
// Custom reveal.js integration
|
2
|
+
(function(){
|
3
|
+
var isEnabled = true;
|
4
|
+
|
5
|
+
document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) {
|
6
|
+
if( event.altKey && isEnabled ) {
|
7
|
+
event.preventDefault();
|
8
|
+
zoom.to({ element: event.target, pan: false });
|
9
|
+
}
|
10
|
+
} );
|
11
|
+
|
12
|
+
Reveal.addEventListener( 'overviewshown', function() { isEnabled = false; } );
|
13
|
+
Reveal.addEventListener( 'overviewhidden', function() { isEnabled = true; } );
|
14
|
+
})();
|
15
|
+
|
16
|
+
/*!
|
17
|
+
* zoom.js 0.2 (modified version for use with reveal.js)
|
18
|
+
* http://lab.hakim.se/zoom-js
|
19
|
+
* MIT licensed
|
20
|
+
*
|
21
|
+
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
|
22
|
+
*/
|
23
|
+
var zoom = (function(){
|
24
|
+
|
25
|
+
// The current zoom level (scale)
|
26
|
+
var level = 1;
|
27
|
+
|
28
|
+
// The current mouse position, used for panning
|
29
|
+
var mouseX = 0,
|
30
|
+
mouseY = 0;
|
31
|
+
|
32
|
+
// Timeout before pan is activated
|
33
|
+
var panEngageTimeout = -1,
|
34
|
+
panUpdateInterval = -1;
|
35
|
+
|
36
|
+
var currentOptions = null;
|
37
|
+
|
38
|
+
// Check for transform support so that we can fallback otherwise
|
39
|
+
var supportsTransforms = 'WebkitTransform' in document.body.style ||
|
40
|
+
'MozTransform' in document.body.style ||
|
41
|
+
'msTransform' in document.body.style ||
|
42
|
+
'OTransform' in document.body.style ||
|
43
|
+
'transform' in document.body.style;
|
44
|
+
|
45
|
+
if( supportsTransforms ) {
|
46
|
+
// The easing that will be applied when we zoom in/out
|
47
|
+
document.body.style.transition = 'transform 0.8s ease';
|
48
|
+
document.body.style.OTransition = '-o-transform 0.8s ease';
|
49
|
+
document.body.style.msTransition = '-ms-transform 0.8s ease';
|
50
|
+
document.body.style.MozTransition = '-moz-transform 0.8s ease';
|
51
|
+
document.body.style.WebkitTransition = '-webkit-transform 0.8s ease';
|
52
|
+
}
|
53
|
+
|
54
|
+
// Zoom out if the user hits escape
|
55
|
+
document.addEventListener( 'keyup', function( event ) {
|
56
|
+
if( level !== 1 && event.keyCode === 27 ) {
|
57
|
+
zoom.out();
|
58
|
+
}
|
59
|
+
}, false );
|
60
|
+
|
61
|
+
// Monitor mouse movement for panning
|
62
|
+
document.addEventListener( 'mousemove', function( event ) {
|
63
|
+
if( level !== 1 ) {
|
64
|
+
mouseX = event.clientX;
|
65
|
+
mouseY = event.clientY;
|
66
|
+
}
|
67
|
+
}, false );
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Applies the CSS required to zoom in, prioritizes use of CSS3
|
71
|
+
* transforms but falls back on zoom for IE.
|
72
|
+
*
|
73
|
+
* @param {Number} pageOffsetX
|
74
|
+
* @param {Number} pageOffsetY
|
75
|
+
* @param {Number} elementOffsetX
|
76
|
+
* @param {Number} elementOffsetY
|
77
|
+
* @param {Number} scale
|
78
|
+
*/
|
79
|
+
function magnify( pageOffsetX, pageOffsetY, elementOffsetX, elementOffsetY, scale ) {
|
80
|
+
|
81
|
+
if( supportsTransforms ) {
|
82
|
+
var origin = pageOffsetX +'px '+ pageOffsetY +'px',
|
83
|
+
transform = 'translate('+ -elementOffsetX +'px,'+ -elementOffsetY +'px) scale('+ scale +')';
|
84
|
+
|
85
|
+
document.body.style.transformOrigin = origin;
|
86
|
+
document.body.style.OTransformOrigin = origin;
|
87
|
+
document.body.style.msTransformOrigin = origin;
|
88
|
+
document.body.style.MozTransformOrigin = origin;
|
89
|
+
document.body.style.WebkitTransformOrigin = origin;
|
90
|
+
|
91
|
+
document.body.style.transform = transform;
|
92
|
+
document.body.style.OTransform = transform;
|
93
|
+
document.body.style.msTransform = transform;
|
94
|
+
document.body.style.MozTransform = transform;
|
95
|
+
document.body.style.WebkitTransform = transform;
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
// Reset all values
|
99
|
+
if( scale === 1 ) {
|
100
|
+
document.body.style.position = '';
|
101
|
+
document.body.style.left = '';
|
102
|
+
document.body.style.top = '';
|
103
|
+
document.body.style.width = '';
|
104
|
+
document.body.style.height = '';
|
105
|
+
document.body.style.zoom = '';
|
106
|
+
}
|
107
|
+
// Apply scale
|
108
|
+
else {
|
109
|
+
document.body.style.position = 'relative';
|
110
|
+
document.body.style.left = ( - ( pageOffsetX + elementOffsetX ) / scale ) + 'px';
|
111
|
+
document.body.style.top = ( - ( pageOffsetY + elementOffsetY ) / scale ) + 'px';
|
112
|
+
document.body.style.width = ( scale * 100 ) + '%';
|
113
|
+
document.body.style.height = ( scale * 100 ) + '%';
|
114
|
+
document.body.style.zoom = scale;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
level = scale;
|
119
|
+
|
120
|
+
if( level !== 1 && document.documentElement.classList ) {
|
121
|
+
document.documentElement.classList.add( 'zoomed' );
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
document.documentElement.classList.remove( 'zoomed' );
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Pan the document when the mosue cursor approaches the edges
|
130
|
+
* of the window.
|
131
|
+
*/
|
132
|
+
function pan() {
|
133
|
+
var range = 0.12,
|
134
|
+
rangeX = window.innerWidth * range,
|
135
|
+
rangeY = window.innerHeight * range,
|
136
|
+
scrollOffset = getScrollOffset();
|
137
|
+
|
138
|
+
// Up
|
139
|
+
if( mouseY < rangeY ) {
|
140
|
+
window.scroll( scrollOffset.x, scrollOffset.y - ( 1 - ( mouseY / rangeY ) ) * ( 14 / level ) );
|
141
|
+
}
|
142
|
+
// Down
|
143
|
+
else if( mouseY > window.innerHeight - rangeY ) {
|
144
|
+
window.scroll( scrollOffset.x, scrollOffset.y + ( 1 - ( window.innerHeight - mouseY ) / rangeY ) * ( 14 / level ) );
|
145
|
+
}
|
146
|
+
|
147
|
+
// Left
|
148
|
+
if( mouseX < rangeX ) {
|
149
|
+
window.scroll( scrollOffset.x - ( 1 - ( mouseX / rangeX ) ) * ( 14 / level ), scrollOffset.y );
|
150
|
+
}
|
151
|
+
// Right
|
152
|
+
else if( mouseX > window.innerWidth - rangeX ) {
|
153
|
+
window.scroll( scrollOffset.x + ( 1 - ( window.innerWidth - mouseX ) / rangeX ) * ( 14 / level ), scrollOffset.y );
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
function getScrollOffset() {
|
158
|
+
return {
|
159
|
+
x: window.scrollX !== undefined ? window.scrollX : window.pageXOffset,
|
160
|
+
y: window.scrollY !== undefined ? window.scrollY : window.pageXYffset
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
return {
|
165
|
+
/**
|
166
|
+
* Zooms in on either a rectangle or HTML element.
|
167
|
+
*
|
168
|
+
* @param {Object} options
|
169
|
+
* - element: HTML element to zoom in on
|
170
|
+
* OR
|
171
|
+
* - x/y: coordinates in non-transformed space to zoom in on
|
172
|
+
* - width/height: the portion of the screen to zoom in on
|
173
|
+
* - scale: can be used instead of width/height to explicitly set scale
|
174
|
+
*/
|
175
|
+
to: function( options ) {
|
176
|
+
// Due to an implementation limitation we can't zoom in
|
177
|
+
// to another element without zooming out first
|
178
|
+
if( level !== 1 ) {
|
179
|
+
zoom.out();
|
180
|
+
}
|
181
|
+
else {
|
182
|
+
options.x = options.x || 0;
|
183
|
+
options.y = options.y || 0;
|
184
|
+
|
185
|
+
// If an element is set, that takes precedence
|
186
|
+
if( !!options.element ) {
|
187
|
+
// Space around the zoomed in element to leave on screen
|
188
|
+
var padding = 20;
|
189
|
+
|
190
|
+
options.width = options.element.getBoundingClientRect().width + ( padding * 2 );
|
191
|
+
options.height = options.element.getBoundingClientRect().height + ( padding * 2 );
|
192
|
+
options.x = options.element.getBoundingClientRect().left - padding;
|
193
|
+
options.y = options.element.getBoundingClientRect().top - padding;
|
194
|
+
}
|
195
|
+
|
196
|
+
// If width/height values are set, calculate scale from those values
|
197
|
+
if( options.width !== undefined && options.height !== undefined ) {
|
198
|
+
options.scale = Math.max( Math.min( window.innerWidth / options.width, window.innerHeight / options.height ), 1 );
|
199
|
+
}
|
200
|
+
|
201
|
+
if( options.scale > 1 ) {
|
202
|
+
options.x *= options.scale;
|
203
|
+
options.y *= options.scale;
|
204
|
+
|
205
|
+
var scrollOffset = getScrollOffset();
|
206
|
+
|
207
|
+
if( options.element ) {
|
208
|
+
scrollOffset.x -= ( window.innerWidth - ( options.width * options.scale ) ) / 2;
|
209
|
+
}
|
210
|
+
|
211
|
+
magnify( scrollOffset.x, scrollOffset.y, options.x, options.y, options.scale );
|
212
|
+
|
213
|
+
if( options.pan !== false ) {
|
214
|
+
|
215
|
+
// Wait with engaging panning as it may conflict with the
|
216
|
+
// zoom transition
|
217
|
+
panEngageTimeout = setTimeout( function() {
|
218
|
+
panUpdateInterval = setInterval( pan, 1000 / 60 );
|
219
|
+
}, 800 );
|
220
|
+
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
currentOptions = options;
|
225
|
+
}
|
226
|
+
},
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Resets the document zoom state to its default.
|
230
|
+
*/
|
231
|
+
out: function() {
|
232
|
+
clearTimeout( panEngageTimeout );
|
233
|
+
clearInterval( panUpdateInterval );
|
234
|
+
|
235
|
+
var scrollOffset = getScrollOffset();
|
236
|
+
|
237
|
+
if( currentOptions && currentOptions.element ) {
|
238
|
+
scrollOffset.x -= ( window.innerWidth - ( currentOptions.width * currentOptions.scale ) ) / 2;
|
239
|
+
}
|
240
|
+
|
241
|
+
magnify( scrollOffset.x, scrollOffset.y, 0, 0, 1 );
|
242
|
+
|
243
|
+
level = 1;
|
244
|
+
},
|
245
|
+
|
246
|
+
// Alias
|
247
|
+
magnify: function( options ) { this.to( options ) },
|
248
|
+
reset: function() { this.out() },
|
249
|
+
|
250
|
+
zoomLevel: function() {
|
251
|
+
return level;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
})();
|
256
|
+
|
data/bin/slippery
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
data/code_of_conduct.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect
|
4
|
+
all people who contribute through reporting issues, posting feature
|
5
|
+
requests, updating documentation, submitting pull requests or patches,
|
6
|
+
and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a
|
9
|
+
harassment-free experience for everyone, regardless of level of
|
10
|
+
experience, gender, gender identity and expression, sexual
|
11
|
+
orientation, disability, personal appearance, body size, race, age, or
|
12
|
+
religion.
|
13
|
+
|
14
|
+
Examples of unacceptable behavior by participants include the use of
|
15
|
+
sexual language or imagery, derogatory comments or personal attacks,
|
16
|
+
trolling, public or private harassment, insults, or other
|
17
|
+
unprofessional conduct.
|
18
|
+
|
19
|
+
Project maintainers have the right and responsibility to remove, edit,
|
20
|
+
or reject comments, commits, code, wiki edits, issues, and other
|
21
|
+
contributions that are not aligned to this Code of Conduct. Project
|
22
|
+
maintainers who do not follow the Code of Conduct may be removed from
|
23
|
+
the project team.
|
24
|
+
|
25
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior
|
26
|
+
may be reported by opening an issue or contacting one or more of the
|
27
|
+
project maintainers.
|
28
|
+
|
29
|
+
This Code of Conduct is adapted from the
|
30
|
+
[Contributor Covenant](http:contributor-covenant.org), version 1.0.0,
|
31
|
+
available at
|
32
|
+
[http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/lib/slippery.rb
CHANGED
@@ -3,8 +3,7 @@ require 'pathname'
|
|
3
3
|
require 'open-uri'
|
4
4
|
require 'forwardable'
|
5
5
|
|
6
|
-
require 'kramdown'
|
7
|
-
require 'hexp'
|
6
|
+
require 'hexp/kramdown'
|
8
7
|
require 'concord'
|
9
8
|
require 'asset_packer'
|
10
9
|
|
@@ -18,7 +17,6 @@ module Slippery
|
|
18
17
|
end
|
19
18
|
|
20
19
|
require 'slippery/version'
|
21
|
-
require 'slippery/converter'
|
22
20
|
require 'slippery/document'
|
23
21
|
require 'slippery/presentation'
|
24
22
|
|
@@ -29,8 +27,12 @@ require 'slippery/processors/graphviz_dot'
|
|
29
27
|
require 'slippery/processors/hr_to_sections'
|
30
28
|
require 'slippery/processors/add_highlight'
|
31
29
|
|
30
|
+
require 'slippery/processor'
|
32
31
|
require 'slippery/processors/impress_js/add_impress_js'
|
33
32
|
require 'slippery/processors/impress_js/auto_offsets'
|
33
|
+
require 'slippery/processors/jquery'
|
34
|
+
require 'slippery/processors/fathom_js'
|
35
|
+
require 'slippery/processors/deck_js'
|
34
36
|
|
35
37
|
require 'slippery/processors/reveal_js/add_reveal_js'
|
36
38
|
|
data/lib/slippery/document.rb
CHANGED
@@ -7,11 +7,11 @@ module Slippery
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def kramdown_document
|
10
|
-
@kramdown_document ||= Kramdown::Document.new(@markdown, input: 'GFM')
|
10
|
+
@kramdown_document ||= ::Kramdown::Document.new(@markdown, input: 'GFM')
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_hexp
|
14
|
-
@hexp ||=
|
14
|
+
@hexp ||= Hexp::Kramdown.convert(kramdown_document)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -4,7 +4,6 @@ module Slippery
|
|
4
4
|
|
5
5
|
DEFAULT_OPTIONS = {
|
6
6
|
type: :reveal_js,
|
7
|
-
local: true,
|
8
7
|
history: true
|
9
8
|
}.freeze
|
10
9
|
|
@@ -23,6 +22,16 @@ module Slippery
|
|
23
22
|
reveal_js: [
|
24
23
|
Processors::HrToSections.new(H[:section]),
|
25
24
|
Processors::RevealJs::AddRevealJs.new(js_options),
|
25
|
+
],
|
26
|
+
fathom_js: [
|
27
|
+
Processors::HrToSections.new(H[:div, class: 'slide']),
|
28
|
+
Processors::JQuery.new(js_options),
|
29
|
+
Processors::FathomJs.new(js_options),
|
30
|
+
],
|
31
|
+
deck_js: [
|
32
|
+
Processors::HrToSections.new(H[:section, class: 'slide']),
|
33
|
+
Processors::JQuery.new(js_options),
|
34
|
+
Processors::DeckJs.new(js_options),
|
26
35
|
]
|
27
36
|
}[@options[:type]]
|
28
37
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Slippery
|
2
|
+
class Processor
|
3
|
+
include ProcessorHelpers
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def options
|
10
|
+
if defaults = self.class.const_get(:DEFAULT_OPTIONS)
|
11
|
+
defaults.merge(@options)
|
12
|
+
else
|
13
|
+
@options
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -7,13 +7,14 @@ module Slippery
|
|
7
7
|
def asset_uri(path)
|
8
8
|
"file://" + Slippery::ROOT.join('assets', path).to_s
|
9
9
|
end
|
10
|
+
module_function :asset_uri
|
10
11
|
|
11
12
|
def include_local_javascript(element, path)
|
12
|
-
element.add javascript_include_tag(path)
|
13
|
+
element.add javascript_include_tag(asset_uri(path))
|
13
14
|
end
|
14
15
|
|
15
16
|
def include_local_css(element, path)
|
16
|
-
element.add stylesheet_link_tag(path)
|
17
|
+
element.add stylesheet_link_tag(asset_uri(path))
|
17
18
|
end
|
18
19
|
|
19
20
|
def javascript_include_tag(path)
|
@@ -28,7 +29,19 @@ module Slippery
|
|
28
29
|
Hash[*attrs.flat_map { |k, v| ["data-#{k}", v] }]
|
29
30
|
end
|
30
31
|
|
32
|
+
def hash_to_js(hsh)
|
33
|
+
hsh.map { |k, v| "#{k}:#{v.inspect}" }.join(',') #:(
|
34
|
+
end
|
35
|
+
|
36
|
+
def call(doc)
|
37
|
+
doc.process(*self.class.processors.map {|name| send(name) })
|
38
|
+
end
|
39
|
+
|
31
40
|
module ClassMethods
|
41
|
+
def processors
|
42
|
+
@processors ||= []
|
43
|
+
end
|
44
|
+
|
32
45
|
def processor(name, selector = nil, &blk)
|
33
46
|
if selector
|
34
47
|
define_method name do
|
@@ -37,6 +50,7 @@ module Slippery
|
|
37
50
|
else
|
38
51
|
define_method name { ->(node) { blk.call(node) } }
|
39
52
|
end
|
53
|
+
processors << name
|
40
54
|
end
|
41
55
|
end
|
42
56
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Slippery
|
2
2
|
module Processors
|
3
3
|
class AddHighlight
|
4
|
+
include ProcessorHelpers
|
4
5
|
|
5
6
|
DEFAULT_STYLE = :default
|
6
7
|
DEFAULT_VERSION = '8.0'
|
@@ -11,9 +12,15 @@ module Slippery
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def call(doc)
|
15
|
+
# css = "http://yandex.st/highlightjs/#{@version}/styles/#{@style}.min.css"
|
16
|
+
# js = "http://yandex.st/highlightjs/#{@version}/highlight.min.js"
|
17
|
+
|
18
|
+
js = asset_uri('highlight.js/highlight.pack.js')
|
19
|
+
css = asset_uri('highlight.js/highlight-0.8.default.min.css')
|
20
|
+
|
14
21
|
doc.rewrite 'head' do |head|
|
15
|
-
head <<= H[:link, rel: "stylesheet", href:
|
16
|
-
head <<= H[:script, src:
|
22
|
+
head <<= H[:link, rel: "stylesheet", href: css]
|
23
|
+
head <<= H[:script, src: js]
|
17
24
|
head <<= H[:script, 'hljs.initHighlightingOnLoad();']
|
18
25
|
end
|
19
26
|
end
|