slideoff 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +218 -0
  5. data/bin/slideoff +127 -0
  6. data/lib/slideoff/config_builder.rb +60 -0
  7. data/lib/slideoff/flickr_api.rb +50 -0
  8. data/lib/slideoff/flickr_image.rb +92 -0
  9. data/lib/slideoff/markdown.rb +145 -0
  10. data/lib/slideoff/presentation.rb +90 -0
  11. data/lib/slideoff/remote_api.rb +53 -0
  12. data/lib/slideoff/routes.rb +20 -0
  13. data/lib/slideoff/server.rb +50 -0
  14. data/lib/slideoff/slides_api.rb +59 -0
  15. data/lib/slideoff/utils.rb +453 -0
  16. data/lib/slideoff.rb +15 -0
  17. data/themes/3d_slideshow/README +2 -0
  18. data/themes/3d_slideshow/css/main.css +232 -0
  19. data/themes/3d_slideshow/css/reset.css +57 -0
  20. data/themes/3d_slideshow/index.erb +31 -0
  21. data/themes/3d_slideshow/js/slideshow.js +288 -0
  22. data/themes/CSSS/README +2 -0
  23. data/themes/CSSS/css/slideshow.css +304 -0
  24. data/themes/CSSS/css/theme.css +250 -0
  25. data/themes/CSSS/images/rainbow-wood.jpg +0 -0
  26. data/themes/CSSS/index.erb +36 -0
  27. data/themes/CSSS/js/classList.js +116 -0
  28. data/themes/CSSS/js/prefixfree.min.js +5 -0
  29. data/themes/CSSS/js/slideshow.js +621 -0
  30. data/themes/common/css/pygments/colorful.css +62 -0
  31. data/themes/common/css/pygments/manni.css +61 -0
  32. data/themes/common/css/pygments/native.css +70 -0
  33. data/themes/common/css/pygments/solarized.css +66 -0
  34. data/themes/common/fonts/DroidSansMono.svg +626 -0
  35. data/themes/common/fonts/DroidSansMono.ttf +0 -0
  36. data/themes/common/fonts/Lato-BoldItalic.woff +0 -0
  37. data/themes/common/fonts/Lato-Italic.woff +0 -0
  38. data/themes/common/fonts/Lato-bold.woff +0 -0
  39. data/themes/common/fonts/Lato.woff +0 -0
  40. data/themes/common/fonts/OpenSans-Bold.woff +0 -0
  41. data/themes/common/fonts/OpenSans-BoldItalic.woff +0 -0
  42. data/themes/common/fonts/OpenSans-Italic.woff +0 -0
  43. data/themes/common/fonts/OpenSans.woff +0 -0
  44. data/themes/common/fonts/PTMono.woff +0 -0
  45. data/themes/common/fonts/PTSans.Bold.Italic.woff +0 -0
  46. data/themes/common/fonts/PTSans.Bold.woff +0 -0
  47. data/themes/common/fonts/PTSans.Italic.woff +0 -0
  48. data/themes/common/fonts/PTSans.Narrow.Bold.woff +0 -0
  49. data/themes/common/fonts/PTSans.Narrow.woff +0 -0
  50. data/themes/common/fonts/PTSans.woff +0 -0
  51. data/themes/common/fonts/TargetBlank.otf +0 -0
  52. data/themes/common/fonts/TargetBlank.svg +14 -0
  53. data/themes/common/fonts/YanoneKaffeesatz-Bold.woff +0 -0
  54. data/themes/common/fonts/YanoneKaffeesatz-Regular.woff +0 -0
  55. data/themes/common/fonts/crimson_text.ttf +0 -0
  56. data/themes/common/fonts/crimson_text_bold.ttf +0 -0
  57. data/themes/common/fonts/crimson_text_semibold.ttf +0 -0
  58. data/themes/common/fonts/league_gothic-webfont.ttf +0 -0
  59. data/themes/html5rocks/README +2 -0
  60. data/themes/html5rocks/css/default.css +501 -0
  61. data/themes/html5rocks/css/moon.css +543 -0
  62. data/themes/html5rocks/css/sand.css +508 -0
  63. data/themes/html5rocks/css/sea_wave.css +492 -0
  64. data/themes/html5rocks/index.erb +64 -0
  65. data/themes/html5rocks/js/slides.js +464 -0
  66. data/themes/io2012/README +2 -0
  67. data/themes/io2012/css/default.css +1481 -0
  68. data/themes/io2012/css/fonts.css +24 -0
  69. data/themes/io2012/css/phone.css +27 -0
  70. data/themes/io2012/images/google_developers_icon_128.png +0 -0
  71. data/themes/io2012/images/io2012_logo.png +0 -0
  72. data/themes/io2012/index.erb +73 -0
  73. data/themes/io2012/js/hammer.js +586 -0
  74. data/themes/io2012/js/modernizr.custom.45394.js +4 -0
  75. data/themes/io2012/js/order.js +8 -0
  76. data/themes/io2012/js/polyfills/classList.min.js +2 -0
  77. data/themes/io2012/js/polyfills/dataset.min.js +2 -0
  78. data/themes/io2012/js/polyfills/history.min.js +1 -0
  79. data/themes/io2012/js/prettify/lang-apollo.js +2 -0
  80. data/themes/io2012/js/prettify/lang-clj.js +18 -0
  81. data/themes/io2012/js/prettify/lang-css.js +2 -0
  82. data/themes/io2012/js/prettify/lang-go.js +1 -0
  83. data/themes/io2012/js/prettify/lang-hs.js +2 -0
  84. data/themes/io2012/js/prettify/lang-lisp.js +3 -0
  85. data/themes/io2012/js/prettify/lang-lua.js +2 -0
  86. data/themes/io2012/js/prettify/lang-ml.js +2 -0
  87. data/themes/io2012/js/prettify/lang-n.js +4 -0
  88. data/themes/io2012/js/prettify/lang-proto.js +1 -0
  89. data/themes/io2012/js/prettify/lang-scala.js +2 -0
  90. data/themes/io2012/js/prettify/lang-sql.js +2 -0
  91. data/themes/io2012/js/prettify/lang-tex.js +1 -0
  92. data/themes/io2012/js/prettify/lang-vb.js +2 -0
  93. data/themes/io2012/js/prettify/lang-vhdl.js +3 -0
  94. data/themes/io2012/js/prettify/lang-wiki.js +2 -0
  95. data/themes/io2012/js/prettify/lang-xq.js +3 -0
  96. data/themes/io2012/js/prettify/lang-yaml.js +2 -0
  97. data/themes/io2012/js/prettify/prettify.css +1 -0
  98. data/themes/io2012/js/prettify/prettify.js +28 -0
  99. data/themes/io2012/js/require-1.0.8.min.js +33 -0
  100. data/themes/io2012/js/slide-controller.js +109 -0
  101. data/themes/io2012/js/slide-deck.js +768 -0
  102. data/themes/io2012/js/slides.js +5 -0
  103. data/themes/memories/README +5 -0
  104. data/themes/memories/css/fonts.css +25 -0
  105. data/themes/memories/css/slideshow.css +286 -0
  106. data/themes/memories/css/theme.css +183 -0
  107. data/themes/memories/index.erb +37 -0
  108. data/themes/memories/js/prefixfree.min.js +13 -0
  109. data/themes/memories/js/slideshow.js +577 -0
  110. data/themes/modern/LICENSE +20 -0
  111. data/themes/modern/README.md +52 -0
  112. data/themes/modern/css/GENERATED_CONTENT +0 -0
  113. data/themes/modern/css/defaults.css +0 -0
  114. data/themes/modern/css/fonts.css +166 -0
  115. data/themes/modern/css/pygments/colorful.css +215 -0
  116. data/themes/modern/css/pygments/github.css +208 -0
  117. data/themes/modern/css/pygments/solarized-dark.css +213 -0
  118. data/themes/modern/css/pygments/solarized-light.css +213 -0
  119. data/themes/modern/css/reset.css +41 -0
  120. data/themes/modern/css/screen.css +1183 -0
  121. data/themes/modern/fonts/Collegiate.woff +0 -0
  122. data/themes/modern/fonts/GoudyBookletter.1911.woff +0 -0
  123. data/themes/modern/fonts/Inconsolata.Bold.woff +0 -0
  124. data/themes/modern/fonts/Inconsolata.woff +0 -0
  125. data/themes/modern/fonts/Junction.woff +0 -0
  126. data/themes/modern/fonts/LiberationMono.Bold.woff +0 -0
  127. data/themes/modern/fonts/LiberationMono.BoldItalic.woff +0 -0
  128. data/themes/modern/fonts/LiberationMono.Italic.woff +0 -0
  129. data/themes/modern/fonts/LiberationMono.Regular.woff +0 -0
  130. data/themes/modern/fonts/OpenSans.Bold.woff +0 -0
  131. data/themes/modern/fonts/OpenSans.BoldItalic.woff +0 -0
  132. data/themes/modern/fonts/OpenSans.ExtraBold.woff +0 -0
  133. data/themes/modern/fonts/OpenSans.ExtraBoldItalic.woff +0 -0
  134. data/themes/modern/fonts/OpenSans.Italic.woff +0 -0
  135. data/themes/modern/fonts/OpenSans.Light.woff +0 -0
  136. data/themes/modern/fonts/OpenSans.LightItalic.woff +0 -0
  137. data/themes/modern/fonts/OpenSans.Regular.woff +0 -0
  138. data/themes/modern/fonts/OpenSans.Semibold.woff +0 -0
  139. data/themes/modern/fonts/OpenSans.SemiboldItalic.woff +0 -0
  140. data/themes/modern/fonts/PTMono.woff +0 -0
  141. data/themes/modern/fonts/PTSans.Bold.Italic.woff +0 -0
  142. data/themes/modern/fonts/PTSans.Bold.woff +0 -0
  143. data/themes/modern/fonts/PTSans.Italic.woff +0 -0
  144. data/themes/modern/fonts/PTSans.Narrow.Bold.woff +0 -0
  145. data/themes/modern/fonts/PTSans.woff +0 -0
  146. data/themes/modern/fonts/Raleway.Thin.woff +0 -0
  147. data/themes/modern/fonts/STIXGeneral.Bold.woff +0 -0
  148. data/themes/modern/fonts/STIXGeneral.BoldItalic.woff +0 -0
  149. data/themes/modern/fonts/STIXGeneral.Italic.woff +0 -0
  150. data/themes/modern/fonts/STIXGeneral.Regular.woff +0 -0
  151. data/themes/modern/fonts/YanoneKaffeesatz.Bold.woff +0 -0
  152. data/themes/modern/fonts/YanoneKaffeesatz.ExtraLight.woff +0 -0
  153. data/themes/modern/fonts/YanoneKaffeesatz.Light.woff +0 -0
  154. data/themes/modern/fonts/YanoneKaffeesatz.Regular.woff +0 -0
  155. data/themes/modern/images/cc/by.svg +29 -0
  156. data/themes/modern/images/cc/cc-white.svg +23 -0
  157. data/themes/modern/images/cc/cc.svg +23 -0
  158. data/themes/modern/images/cc/nc-eu.svg +21 -0
  159. data/themes/modern/images/cc/nc-jp.svg +18 -0
  160. data/themes/modern/images/cc/nc.svg +23 -0
  161. data/themes/modern/images/cc/nd.svg +20 -0
  162. data/themes/modern/images/cc/pd.svg +24 -0
  163. data/themes/modern/images/cc/remix.svg +20 -0
  164. data/themes/modern/images/cc/sa.svg +22 -0
  165. data/themes/modern/images/cc/sampling.plus.svg +33 -0
  166. data/themes/modern/images/cc/sampling.svg +36 -0
  167. data/themes/modern/images/cc/share.svg +22 -0
  168. data/themes/modern/images/cc/zero.svg +24 -0
  169. data/themes/modern/images/flickr.svg +65 -0
  170. data/themes/modern/images/mesh.png +0 -0
  171. data/themes/modern/images/mesh@2x.png +0 -0
  172. data/themes/modern/images/progress-grayDark.svg +55 -0
  173. data/themes/modern/images/progress.svg +3 -0
  174. data/themes/modern/index.erb +76 -0
  175. data/themes/modern/js/highcharts.js +294 -0
  176. data/themes/modern/js/jquery-2.1.0.min.js +4 -0
  177. data/themes/modern/js/script.coffee +480 -0
  178. data/themes/modern/js/script.js +678 -0
  179. data/themes/modern/styles/_box.scss +89 -0
  180. data/themes/modern/styles/_figure.scss +81 -0
  181. data/themes/modern/styles/_full.scss +74 -0
  182. data/themes/modern/styles/_increment.scss +38 -0
  183. data/themes/modern/styles/_list.scss +129 -0
  184. data/themes/modern/styles/_progress.scss +19 -0
  185. data/themes/modern/styles/defaults.scss +46 -0
  186. data/themes/modern/styles/fonts.scss +197 -0
  187. data/themes/modern/styles/pygments/_solarized.scss +82 -0
  188. data/themes/modern/styles/pygments/colorful.scss +67 -0
  189. data/themes/modern/styles/pygments/github.scss +67 -0
  190. data/themes/modern/styles/pygments/solarized-dark.scss +15 -0
  191. data/themes/modern/styles/pygments/solarized-light.scss +15 -0
  192. data/themes/modern/styles/reset.scss +46 -0
  193. data/themes/modern/styles/screen.scss +841 -0
  194. data/themes/reveal/README +2 -0
  195. data/themes/reveal/css/main.css +1029 -0
  196. data/themes/reveal/css/reset.css +57 -0
  197. data/themes/reveal/index.erb +102 -0
  198. data/themes/reveal/js/classList.js +2 -0
  199. data/themes/reveal/js/head.min.js +8 -0
  200. data/themes/reveal/js/reveal.js +951 -0
  201. data/themes/shower/README +2 -0
  202. data/themes/shower/css/fonts.css +50 -0
  203. data/themes/shower/css/reset.css +42 -0
  204. data/themes/shower/css/style.css +418 -0
  205. data/themes/shower/images/grid.png +0 -0
  206. data/themes/shower/images/linen.png +0 -0
  207. data/themes/shower/images/ribbon.svg +4 -0
  208. data/themes/shower/index.erb +35 -0
  209. data/themes/shower/js/script.js +325 -0
  210. data/themes/template/README +5 -0
  211. data/themes/template/css/reset.css +42 -0
  212. data/themes/template/index.erb +35 -0
  213. data/themes/template/js/prefixfree.min.js +13 -0
  214. metadata +343 -0
@@ -0,0 +1,678 @@
1
+ // Generated by CoffeeScript 1.7.1
2
+ var Mode, Slide, SlideInitializer, Transform, UserInterface, startEventSourceHandler;
3
+
4
+ Highcharts.setOptions({
5
+ colors: ['#96000F', '#E10019', '#AAA5A0', '#46413C', '#327D91', '#4BBEE1', '#560F32', '#821350', '#006450', '#009682', '#697D19', '#9BC328', '#AA5500', '#FF8200'],
6
+ credits: {
7
+ enabled: true
8
+ },
9
+ legend: {
10
+ enabled: false
11
+ },
12
+ tooltip: {
13
+ enabled: false
14
+ },
15
+ title: {
16
+ text: ''
17
+ },
18
+ chart: {
19
+ backgroundColor: 'rgba(0,0,0,0)',
20
+ plotBackgroundColor: null,
21
+ plotBorderWidth: null,
22
+ plotShadow: false,
23
+ margin: [0, 0, 0, 0],
24
+ style: {
25
+ fontFamily: 'Open Sans Light',
26
+ fontSize: '20px',
27
+ color: 'black'
28
+ }
29
+ }
30
+ });
31
+
32
+ Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
33
+ return {
34
+ radialGradient: {
35
+ cx: 0.5,
36
+ cy: 0.3,
37
+ r: 0.7
38
+ },
39
+ stops: [[0, color], [1, Highcharts.Color(color).brighten(-0.3).get('rgb')]]
40
+ };
41
+ });
42
+
43
+ $.fn.extend({
44
+ typewriter: function() {
45
+ this.each(function() {
46
+ var $el, progress, str, timer;
47
+ $el = $(this);
48
+ str = $el.text();
49
+ progress = 0;
50
+ $el.text('');
51
+ return timer = setInterval(function() {
52
+ $el.text(str.substring(0, progress) + '_');
53
+ if (progress >= str.length) {
54
+ clearInterval(timer);
55
+ $el.text(str);
56
+ }
57
+ return progress++;
58
+ }, 100);
59
+ });
60
+ return this;
61
+ },
62
+ textfill: function(maxFontSize, maxWords) {
63
+ maxFontSize = parseInt(maxFontSize, 10) || 0;
64
+ maxWords = parseInt(maxWords, 10) || 3;
65
+ return this.each(function() {
66
+ var calcSize, fontSize, maxHeight, maxWidth, newText, orgText, self, splittedText, word, words, _i, _len;
67
+ calcSize = function(text) {
68
+ var multiplier, newSize, ourText, scrollHeight;
69
+ ourText = $("<span>" + text + "</span>").appendTo(self);
70
+ multiplier = maxWidth / ourText.width();
71
+ newSize = fontSize * (multiplier - 0.1);
72
+ ourText.css("fontSize", (maxFontSize > 0 && newSize > maxFontSize ? maxFontSize : newSize));
73
+ ourText.css("lineHeight", "1em");
74
+ scrollHeight = self[0].scrollHeight;
75
+ if (scrollHeight > maxHeight) {
76
+ multiplier = maxHeight / scrollHeight;
77
+ newSize = newSize * multiplier;
78
+ ourText.css("fontSize", (maxFontSize > 0 && newSize > maxFontSize ? maxFontSize : newSize));
79
+ ourText.css("lineHeight", "1em");
80
+ }
81
+ };
82
+ self = $(this);
83
+ orgText = self.text();
84
+ fontSize = parseInt(self.css("fontSize"), 10);
85
+ maxHeight = self.height();
86
+ maxWidth = self.width();
87
+ splittedText = self.html().split(/\s+|<.+?>/);
88
+ words = [];
89
+ for (_i = 0, _len = splittedText.length; _i < _len; _i++) {
90
+ word = splittedText[_i];
91
+ if (word && (word.empty == null)) {
92
+ words.push(word);
93
+ }
94
+ }
95
+ self.empty();
96
+ if (words.length > maxWords) {
97
+ while (words.length > 0) {
98
+ newText = words.splice(0, maxWords).join(" ");
99
+ console.log;
100
+ calcSize(newText);
101
+ self.append("<br>");
102
+ }
103
+ } else {
104
+ calcSize(orgText);
105
+ }
106
+ });
107
+ }
108
+ });
109
+
110
+ Transform = (function() {
111
+ function Transform() {}
112
+
113
+ Transform.body = document.body;
114
+
115
+ Transform.get = function() {
116
+ var denominator;
117
+ denominator = Math.max(this.body.clientWidth / window.innerWidth, this.body.clientHeight / window.innerHeight);
118
+ return "scale(" + (1 / denominator) + ")";
119
+ };
120
+
121
+ Transform.apply = function(transform) {
122
+ this.body.style.WebkitTransform = transform;
123
+ this.body.style.MozTransform = transform;
124
+ this.body.style.msTransform = transform;
125
+ this.body.style.OTransform = transform;
126
+ return this.body.style.transform = transform;
127
+ };
128
+
129
+ Transform.scale = function() {
130
+ return Transform.apply(Transform.get());
131
+ };
132
+
133
+ Transform.reset = function() {
134
+ return Transform.apply('none');
135
+ };
136
+
137
+ return Transform;
138
+
139
+ })();
140
+
141
+ Mode = (function() {
142
+ function Mode() {}
143
+
144
+ Mode.body = document.body;
145
+
146
+ Mode.dispatchSingleSlideMode = function(e) {
147
+ var presentSlideId, slide, slideId;
148
+ slideId = Mode.findSlideId(e.target);
149
+ presentSlideId = slideId != null;
150
+ if (presentSlideId && Mode.isListMode()) {
151
+ Mode.enterSlideMode();
152
+ slide = Slide.fromSlideId(slideId);
153
+ slide.goto();
154
+ return slide.replaceHistory();
155
+ }
156
+ };
157
+
158
+ Mode.enterSlideMode = function() {
159
+ this.body.className = "full";
160
+ return Transform.scale();
161
+ };
162
+
163
+ Mode.enterListMode = function() {
164
+ this.body.className = "list";
165
+ return Transform.reset();
166
+ };
167
+
168
+ Mode.isListMode = function() {
169
+ return !this.body.classList.contains("full");
170
+ };
171
+
172
+ Mode.isSlideMode = function() {
173
+ return !Mode.isListMode();
174
+ };
175
+
176
+ Mode.switchToListMode = function() {
177
+ var slide;
178
+ Mode.enterListMode();
179
+ slide = Slide.current();
180
+ slide.pushHistory();
181
+ return slide.scrollTo();
182
+ };
183
+
184
+ Mode.switchToSlideMode = function() {
185
+ var slide;
186
+ Mode.enterSlideMode();
187
+ slide = Slide.current();
188
+ slide.pushHistory();
189
+ return slide.updateProgress();
190
+ };
191
+
192
+ Mode.reload = function() {
193
+ var _ref;
194
+ Slide.current() || Slide.first().goto();
195
+ if (window.location.search.substr(1) === 'full') {
196
+ return Mode.enterSlideMode();
197
+ } else {
198
+ Mode.enterListMode();
199
+ return (_ref = Slide.current()) != null ? _ref.scrollTo() : void 0;
200
+ }
201
+ };
202
+
203
+ Mode.findSlideId = function(node) {
204
+ while ("BODY" !== node.nodeName && "HTML" !== node.nodeName) {
205
+ if (node.classList.contains("slide")) {
206
+ return node.id;
207
+ }
208
+ node = node.parentNode;
209
+ }
210
+ return null;
211
+ };
212
+
213
+ return Mode;
214
+
215
+ })();
216
+
217
+ SlideInitializer = (function() {
218
+ function SlideInitializer() {}
219
+
220
+ SlideInitializer.init = function() {
221
+ var $slides, slide, totalSize, _i, _len, _results;
222
+ $slides = $('.slide').not('.disabled');
223
+ totalSize = $slides.length;
224
+ _results = [];
225
+ for (_i = 0, _len = $slides.length; _i < _len; _i++) {
226
+ slide = $slides[_i];
227
+ SlideInitializer.initSlideNumber(slide, totalSize);
228
+ SlideInitializer.initIncremental(slide);
229
+ SlideInitializer.initPause(slide);
230
+ _results.push(SlideInitializer.initTypewriter(slide));
231
+ }
232
+ return _results;
233
+ };
234
+
235
+ SlideInitializer.initMouseClick = function() {
236
+ $('body').click(function(e) {
237
+ if (e.which === 1) {
238
+ e.preventDefault();
239
+ return UserInterface.nextStep();
240
+ }
241
+ });
242
+ return $('body').on('contextmenu', function(e) {
243
+ e.preventDefault();
244
+ return UserInterface.prevStep();
245
+ });
246
+ };
247
+
248
+ SlideInitializer.initSlideNumber = function(slide, total) {
249
+ var slideNum;
250
+ slideNum = $(slide).index() - $(slide).prevAll('.slide.disabled').length;
251
+ return $(slide).attr('data-slide', slideNum).attr('data-slides', total);
252
+ };
253
+
254
+ SlideInitializer.initIncremental = function(slide) {
255
+ var $slide;
256
+ $slide = $(slide);
257
+ if ($slide.hasClass('incr-list')) {
258
+ $slide.find('> div > ul > li:first-child').addClass('current');
259
+ $slide.find('> div > ol > li:first-child').addClass('current');
260
+ $slide.find('> div > ul > li:not(:first-child)').addClass('inactive');
261
+ $slide.find('> div > ol > li:not(:first-child)').addClass('inactive');
262
+ }
263
+ if ($slide.hasClass('incr-code')) {
264
+ $slide.find('pre > code:first-child').addClass('current');
265
+ $slide.find('pre > code:not(:first-child)').addClass('inactive');
266
+ }
267
+ if ($slide.hasClass('incr-table')) {
268
+ $slide.find('table > tbody > tr:first-child').addClass('current');
269
+ return $slide.find('table > tbody > tr:not(:first-child)').addClass('inactive');
270
+ }
271
+ };
272
+
273
+ SlideInitializer.initPause = function(slide) {
274
+ var i, last, pause, pauses, wrappable, _i, _len, _results;
275
+ pauses = $(slide).find(".pause");
276
+ _results = [];
277
+ for (i = _i = 0, _len = pauses.length; _i < _len; i = ++_i) {
278
+ pause = pauses[i];
279
+ last = i === pauses.length - 1;
280
+ if (last) {
281
+ wrappable = $(pause).nextAll();
282
+ } else {
283
+ wrappable = $(pause).nextUntil(".pause");
284
+ }
285
+ _results.push(wrappable != null ? wrappable.wrapAll('<div class="inactive"></div>') : void 0);
286
+ }
287
+ return _results;
288
+ };
289
+
290
+ SlideInitializer.initTypewriter = function(slide) {
291
+ if ($(slide).hasClass('typewriter')) {
292
+ return $(slide).find('pre[data-lang=sh] code').addClass('inactive');
293
+ }
294
+ };
295
+
296
+ SlideInitializer.initBodyClasses = function() {
297
+ return $.each(this.bodyClasses, function(klass) {
298
+ return $('body').addClass(klass.split('=')[0]);
299
+ });
300
+ };
301
+
302
+ SlideInitializer.bodyClasses = function() {
303
+ return window.location.search.replace(/^\?/, '').split('&');
304
+ };
305
+
306
+ return SlideInitializer;
307
+
308
+ })();
309
+
310
+ Slide = (function() {
311
+ function Slide(slideNumber) {
312
+ this.$element = $(this.slideList()[this.slideNumber]);
313
+ this.slideNumber = this.normalizeSlideNumber(slideNumber);
314
+ this.id = this.slideList()[this.slideNumber].id;
315
+ this.progress = $(".progress div").first();
316
+ }
317
+
318
+ Slide.slideList = function() {
319
+ var slide, slideList, slides, _i, _len;
320
+ slides = $("div.slide").not('.disabled');
321
+ slideList = [];
322
+ for (_i = 0, _len = slides.length; _i < _len; _i++) {
323
+ slide = slides[_i];
324
+ slideList.push({
325
+ id: slide.id
326
+ });
327
+ }
328
+ return slideList;
329
+ };
330
+
331
+ Slide.current = function() {
332
+ var id;
333
+ id = window.location.hash.substr(1);
334
+ return Slide.fromSlideId(id);
335
+ };
336
+
337
+ Slide.prototype.nextSection = function() {
338
+ var next;
339
+ next = this.nextSectionId();
340
+ return Slide.fromSlideId("slide-" + next + "-0");
341
+ };
342
+
343
+ Slide.prototype.prevSection = function() {
344
+ var prev;
345
+ prev = this.prevSectionId();
346
+ return Slide.fromSlideId("slide-" + prev + "-0");
347
+ };
348
+
349
+ Slide.prototype.sectionId = function() {
350
+ return parseInt(this.id.replace(/slide-/, '').split('-')[0], 10);
351
+ };
352
+
353
+ Slide.prototype.nextSectionId = function() {
354
+ return this.normalizeSectionNumber(this.sectionId() + 1);
355
+ };
356
+
357
+ Slide.prototype.prevSectionId = function() {
358
+ return this.normalizeSectionNumber(this.sectionId() - 1);
359
+ };
360
+
361
+ Slide.currentSectionId = function() {
362
+ return Slide.current().sectionId();
363
+ };
364
+
365
+ Slide.fromSlideId = function(slideId) {
366
+ var index, slide, _i, _len, _ref;
367
+ _ref = Slide.slideList();
368
+ for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {
369
+ slide = _ref[index];
370
+ if (slideId === slide.id) {
371
+ return new Slide(index);
372
+ }
373
+ }
374
+ return null;
375
+ };
376
+
377
+ Slide.first = function() {
378
+ return new Slide(0);
379
+ };
380
+
381
+ Slide.last = function() {
382
+ return new Slide(this.slideList().length - 1);
383
+ };
384
+
385
+ Slide.prototype.getHash = function() {
386
+ return "#" + this.id;
387
+ };
388
+
389
+ Slide.prototype.html = function() {
390
+ return $(this.getHash());
391
+ };
392
+
393
+ Slide.prototype.goto = function() {
394
+ var hash;
395
+ hash = this.getHash();
396
+ window.location.hash = hash;
397
+ $('body').trigger('goto.slideoff', {
398
+ target: hash
399
+ });
400
+ $('body').trigger(hash + '.goto.slideoff', {
401
+ target: hash
402
+ });
403
+ if (Mode.isSlideMode()) {
404
+ return this.updateProgress();
405
+ }
406
+ };
407
+
408
+ Slide.prototype.scrollTo = function() {
409
+ return window.scrollTo(0, this.offsetTop());
410
+ };
411
+
412
+ Slide.prototype.offsetTop = function() {
413
+ var _ref;
414
+ return (_ref = this.html()) != null ? _ref.offset().top : void 0;
415
+ };
416
+
417
+ Slide.prototype.next = function() {
418
+ return new Slide(this.slideNumber + 1);
419
+ };
420
+
421
+ Slide.prototype.prev = function() {
422
+ return new Slide(this.slideNumber - 1);
423
+ };
424
+
425
+ Slide.prototype.pushHistory = function() {
426
+ return history.pushState(null, null, this.historyPath());
427
+ };
428
+
429
+ Slide.prototype.replaceHistory = function() {
430
+ return history.replaceState(null, null, this.historyPath());
431
+ };
432
+
433
+ Slide.prototype.containsInactive = function() {
434
+ return this.firstInactiveElement().length > 0;
435
+ };
436
+
437
+ Slide.prototype.firstInactiveElement = function() {
438
+ return this.html().find('.inactive').first();
439
+ };
440
+
441
+ Slide.prototype.removePresentElement = function() {
442
+ return this.html().find('.current').first().removeClass('current');
443
+ };
444
+
445
+ Slide.prototype.nextInactive = function() {
446
+ var element;
447
+ if (!this.containsInactive()) {
448
+ this.html().removeClass('incr');
449
+ }
450
+ element = this.firstInactiveElement();
451
+ this.html().find('.current').first().addClass('visited');
452
+ this.removePresentElement();
453
+ element.removeClass('inactive');
454
+ if (element.is("pre[data-lang=sh] code")) {
455
+ return element.typewriter();
456
+ } else {
457
+ return element.addClass('current');
458
+ }
459
+ };
460
+
461
+ Slide.prototype.slideList = function() {
462
+ return Slide.slideList();
463
+ };
464
+
465
+ Slide.prototype.normalizeSlideNumber = function(slideNumber) {
466
+ var lastIndex;
467
+ lastIndex = this.slideList().length - 1;
468
+ return this.range(0, slideNumber, lastIndex);
469
+ };
470
+
471
+ Slide.prototype.normalizeSectionNumber = function(sectionNumber) {
472
+ var lastIndex;
473
+ lastIndex = this.html().data('sections') - 1;
474
+ return this.range(0, sectionNumber, lastIndex);
475
+ };
476
+
477
+ Slide.prototype.updateProgress = function() {
478
+ var width;
479
+ if (this.progress == null) {
480
+ return;
481
+ }
482
+ width = (100 / (this.slideList().length - 1) * this.slideNumber).toFixed(2);
483
+ return this.progress.width("" + width + "%");
484
+ };
485
+
486
+ Slide.prototype.historyPath = function() {
487
+ var path;
488
+ path = window.location.pathname;
489
+ if (Mode.isSlideMode()) {
490
+ path += "?full";
491
+ }
492
+ path += this.getHash();
493
+ return path;
494
+ };
495
+
496
+ Slide.prototype.range = function(min, i, max) {
497
+ return Math.min(Math.max(min, i), max);
498
+ };
499
+
500
+ return Slide;
501
+
502
+ })();
503
+
504
+ UserInterface = (function() {
505
+ function UserInterface() {}
506
+
507
+ UserInterface.gotoFirstSlide = function() {
508
+ return Slide.first().goto();
509
+ };
510
+
511
+ UserInterface.gotoLastSlide = function() {
512
+ return Slide.last().goto();
513
+ };
514
+
515
+ UserInterface.nextStep = function() {
516
+ var slide;
517
+ slide = Slide.current();
518
+ if (Mode.isSlideMode() && slide.containsInactive()) {
519
+ return slide.nextInactive();
520
+ } else {
521
+ slide.html().removeClass('incr');
522
+ slide.removePresentElement();
523
+ return slide.next().goto();
524
+ }
525
+ };
526
+
527
+ UserInterface.prevStep = function() {
528
+ return Slide.current().prev().goto();
529
+ };
530
+
531
+ UserInterface.nextBigStep = function() {
532
+ return Slide.current().nextSection().goto();
533
+ };
534
+
535
+ UserInterface.prevBigStep = function() {
536
+ return Slide.current().prevSection().goto();
537
+ };
538
+
539
+ UserInterface.conditionalStep = function(prev) {
540
+ var method;
541
+ method = prev ? 'prev' : 'next';
542
+ return UserInterface[method + 'Step']();
543
+ };
544
+
545
+ UserInterface.resize = function() {
546
+ if (Mode.isSlideMode()) {
547
+ return Transform.scale();
548
+ }
549
+ };
550
+
551
+ UserInterface.init = function() {
552
+ var slide;
553
+ if (Mode.isSlideMode()) {
554
+ Mode.enterSlideMode();
555
+ slide = Slide.current() || Slide.first();
556
+ slide.replaceHistory();
557
+ return slide.updateProgress();
558
+ }
559
+ };
560
+
561
+ UserInterface.switchToListMode = function(e) {
562
+ if (Mode.isSlideMode()) {
563
+ e.preventDefault();
564
+ return Mode.switchToListMode();
565
+ }
566
+ };
567
+
568
+ UserInterface.switchToSlideMode = function(e) {
569
+ if (Mode.isListMode()) {
570
+ e.preventDefault();
571
+ return Mode.switchToSlideMode();
572
+ }
573
+ };
574
+
575
+ return UserInterface;
576
+
577
+ })();
578
+
579
+ startEventSourceHandler = function(uri) {
580
+ var source;
581
+ if (window["EventSource"] == null) {
582
+ return;
583
+ }
584
+ source = new EventSource(uri);
585
+ return source.onmessage = function(e) {
586
+ switch (e.data) {
587
+ case "next":
588
+ return UserInterface.nextStep();
589
+ case "prev":
590
+ return UserInterface.prevStep();
591
+ case "up":
592
+ return UserInterface.switchToListMode(e);
593
+ case "down":
594
+ return UserInterface.switchToSlideMode(e);
595
+ default:
596
+ return console.log(e);
597
+ }
598
+ };
599
+ };
600
+
601
+ $(function() {
602
+ SlideInitializer.init();
603
+ window.addEventListener("DOMContentLoaded", function() {
604
+ return UserInterface.init();
605
+ }, false);
606
+ window.addEventListener("popstate", function(e) {
607
+ return Mode.reload();
608
+ }, false);
609
+ window.addEventListener("resize", function(e) {
610
+ return UserInterface.resize();
611
+ }, false);
612
+ document.addEventListener("keyup", function(e) {
613
+ if (e.altKey || e.ctrlKey || e.metaKey) {
614
+ return;
615
+ }
616
+ switch (e.which) {
617
+ case 116:
618
+ case 13:
619
+ if (Slide.current() != null) {
620
+ return UserInterface.switchToSlideMode(e);
621
+ }
622
+ break;
623
+ case 27:
624
+ return UserInterface.switchToListMode(e);
625
+ case 33:
626
+ case 38:
627
+ case 37:
628
+ case 72:
629
+ case 75:
630
+ e.preventDefault();
631
+ if (e.shiftKey) {
632
+ return UserInterface.prevBigStep();
633
+ } else {
634
+ return UserInterface.prevStep();
635
+ }
636
+ break;
637
+ case 34:
638
+ case 40:
639
+ case 39:
640
+ case 76:
641
+ case 74:
642
+ e.preventDefault();
643
+ if (e.shiftKey) {
644
+ return UserInterface.nextBigStep();
645
+ } else {
646
+ return UserInterface.nextStep();
647
+ }
648
+ break;
649
+ case 36:
650
+ e.preventDefault();
651
+ return UserInterface.gotoFirstSlide();
652
+ case 35:
653
+ e.preventDefault();
654
+ return UserInterface.gotoLastSlide();
655
+ case 9:
656
+ case 32:
657
+ e.preventDefault();
658
+ return UserInterface.conditionalStep(e.shiftKey);
659
+ }
660
+ }, false);
661
+ document.addEventListener("click", Mode.dispatchSingleSlideMode, false);
662
+ document.addEventListener("touchend", Mode.dispatchSingleSlideMode, false);
663
+ document.addEventListener("touchstart", function(e) {
664
+ var x;
665
+ if (Mode.isSlideMode()) {
666
+ x = e.touches[0].pageX;
667
+ return UserInterface.conditionalStep(x <= window.innerWidth / 2);
668
+ }
669
+ }, false);
670
+ document.addEventListener("touchmove", function(e) {
671
+ if (Mode.isSlideMode()) {
672
+ return e.preventDefault();
673
+ }
674
+ }, false);
675
+ return window.setTimeout(function() {
676
+ return startEventSourceHandler("/remote/sub/events");
677
+ }, 100);
678
+ });