slideshow-service 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +71 -0
- data/lib/slideshow/service/public/slideshow-csss/classList.js +116 -0
- data/lib/slideshow/service/public/slideshow-csss/logo.svg +52 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/code-highlight.js +114 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-controls.js +40 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-edit.js +132 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/css-snippets.js +89 -0
- data/lib/slideshow/service/public/slideshow-csss/plugins/incrementable.js +94 -0
- data/lib/slideshow/service/public/slideshow-csss/prefixfree.min.js +10 -0
- data/lib/slideshow/service/public/slideshow-csss/reusable.css +118 -0
- data/lib/slideshow/service/public/slideshow-csss/slides.html +90 -0
- data/lib/slideshow/service/public/slideshow-csss/slideshow.css +282 -0
- data/lib/slideshow/service/public/slideshow-csss/slideshow.js +508 -0
- data/lib/slideshow/service/public/slideshow-csss/style.css +45 -0
- data/lib/slideshow/service/public/slideshow-csss/theme.css +247 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-fold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-nofold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold-dim.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet-unfold.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/bullet.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/example.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/example.svg +223 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face1.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face2.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face3.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/face4.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-bright.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/fold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/icon-blue.png +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/keys2.jpg +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/nofold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-bright.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-dim.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold-dim.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold.bmp +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/unfold.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-blue.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-blue.svg +14 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-slanted.jpg +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-white.gif +0 -0
- data/lib/slideshow/service/public/slideshow-slidy/graphics/w3c-logo-white.svg +14 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html +80 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.ca +52 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.de +96 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.en +81 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.es +52 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.fr +118 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.hu +98 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.nl +82 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pl +76 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pt-br +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.pt_br +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.html.sv +75 -0
- data/lib/slideshow/service/public/slideshow-slidy/help/help.pt-br.html +95 -0
- data/lib/slideshow/service/public/slideshow-slidy/scripts/slidy.js +2952 -0
- data/lib/slideshow/service/public/slideshow-slidy/slides.blank.html +26 -0
- data/lib/slideshow/service/public/slideshow-slidy/slides.w3c.html +62 -0
- data/lib/slideshow/service/public/slideshow-slidy/styles/slidy.css +401 -0
- data/lib/slideshow/service/public/slideshow-slidy/styles/w3c-blue.css +493 -0
- data/lib/slideshow/service/version.rb +1 -2
- data/lib/slideshow/service/views/_editor.erb +7 -4
- data/lib/slideshow/service.rb +47 -19
- metadata +73 -2
@@ -0,0 +1,508 @@
|
|
1
|
+
/**
|
2
|
+
* CSSS javascript code
|
3
|
+
* @author Lea Verou (http://leaverou.me)
|
4
|
+
* @version 2.0
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Make the environment a bit friendlier
|
9
|
+
*/
|
10
|
+
function $(expr, con) { return (con || document).querySelector(expr); }
|
11
|
+
function $$(expr, con) { return [].slice.call((con || document).querySelectorAll(expr)); }
|
12
|
+
|
13
|
+
(function(head, body){
|
14
|
+
|
15
|
+
// Check for classList support and include the polyfill if it's not supported
|
16
|
+
if(!('classList' in body)) {
|
17
|
+
var thisScript = $('script[src$="slideshow.js"]'),
|
18
|
+
script = document.createElement('script');
|
19
|
+
script.src = thisScript.src.replace(/\bslideshow\.js/, 'classList.js');
|
20
|
+
thisScript.parentNode.insertBefore(script, thisScript);
|
21
|
+
}
|
22
|
+
|
23
|
+
// Cache <title> element, we may need it for slides that don't have titles
|
24
|
+
var documentTitle = document.title + '';
|
25
|
+
|
26
|
+
var self = window.SlideShow = function(container, slide) {
|
27
|
+
var me = this;
|
28
|
+
|
29
|
+
// Set instance
|
30
|
+
if(!window.slideshow) {
|
31
|
+
window.slideshow = this;
|
32
|
+
}
|
33
|
+
|
34
|
+
this.container = container = container || body;
|
35
|
+
|
36
|
+
// Current slide
|
37
|
+
this.index = this.slide = slide || 0;
|
38
|
+
|
39
|
+
// Current .delayed item in the slide
|
40
|
+
this.item = 0;
|
41
|
+
|
42
|
+
// Create timer, if needed
|
43
|
+
this.duration = container.getAttribute('data-duration');
|
44
|
+
|
45
|
+
if(this.duration > 0) {
|
46
|
+
var timer = document.createElement('div');
|
47
|
+
|
48
|
+
timer.id = 'timer';
|
49
|
+
timer.setAttribute('style', PrefixFree.prefixCSS('transition: ' + this.duration * 60 + 's linear;'));
|
50
|
+
container.appendChild(timer);
|
51
|
+
|
52
|
+
setTimeout(function() {
|
53
|
+
timer.className = 'end';
|
54
|
+
}, 1);
|
55
|
+
}
|
56
|
+
|
57
|
+
// Create slide indicator
|
58
|
+
this.indicator = document.createElement('div');
|
59
|
+
|
60
|
+
this.indicator.id = 'indicator';
|
61
|
+
container.appendChild(this.indicator);
|
62
|
+
|
63
|
+
// Get the slide elements into an array
|
64
|
+
this.slides = $$('.slide', container);
|
65
|
+
|
66
|
+
// Order of the slides
|
67
|
+
this.order = [];
|
68
|
+
|
69
|
+
for(var i=0; i<this.slides.length; i++) {
|
70
|
+
var slide = this.slides[i]; // to speed up references
|
71
|
+
|
72
|
+
// Asign ids to slides that don't have one
|
73
|
+
if(!slide.id) {
|
74
|
+
slide.id = 'slide' + (i+1);
|
75
|
+
}
|
76
|
+
|
77
|
+
// Set data-title attribute to the title of the slide
|
78
|
+
if(!slide.title) {
|
79
|
+
// no title attribute, fetch title from heading(s)
|
80
|
+
var heading = $('hgroup', slide) || $('h1,h2,h3,h4,h5,h6', slide);
|
81
|
+
|
82
|
+
if(heading && heading.textContent.trim()) {
|
83
|
+
slide.setAttribute('data-title', heading.textContent);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
// The title attribute is set, use that
|
88
|
+
slide.setAttribute('data-title', slide.title);
|
89
|
+
slide.removeAttribute('title');
|
90
|
+
}
|
91
|
+
|
92
|
+
slide.setAttribute('data-index', i);
|
93
|
+
|
94
|
+
var imp = slide.getAttribute('data-import'),
|
95
|
+
imported = imp? this.getSlideById(imp) : null;
|
96
|
+
|
97
|
+
this.order.push(imported? +imported.getAttribute('data-index') : i);
|
98
|
+
}
|
99
|
+
|
100
|
+
if(window.name === 'projector' && window.opener && opener.slideshow) {
|
101
|
+
document.body.classList.add('projector');
|
102
|
+
this.presenter = opener.slideshow;
|
103
|
+
this.presenter.projector = this;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Adjust the font-size when the window is resized
|
107
|
+
addEventListener('resize', this, false);
|
108
|
+
|
109
|
+
// In some browsers DOMContentLoaded is too early, so try again onload
|
110
|
+
addEventListener('load', this, false);
|
111
|
+
|
112
|
+
addEventListener('hashchange', this, false);
|
113
|
+
|
114
|
+
// If there's already a hash, update current slide number...
|
115
|
+
this.handleEvent({type: 'hashchange'});
|
116
|
+
|
117
|
+
document.addEventListener('keyup', this, false);
|
118
|
+
document.addEventListener('keydown', this, false);
|
119
|
+
|
120
|
+
// Rudimentary style[scoped] polyfill
|
121
|
+
$$('style[scoped]', container).forEach(function(style) {
|
122
|
+
var rulez = style.sheet.cssRules,
|
123
|
+
parentid = style.parentNode.id || self.getSlide(style).id;
|
124
|
+
|
125
|
+
for(var j=rulez.length; j--;) {
|
126
|
+
var cssText = rulez[j].cssText.replace(/^|,/g, function($0) {
|
127
|
+
return '#' + parentid + ' ' + $0
|
128
|
+
});
|
129
|
+
|
130
|
+
style.sheet.deleteRule(0);
|
131
|
+
style.sheet.insertRule(cssText, 0);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
|
135
|
+
// Process iframe slides
|
136
|
+
$$('.slide > iframe:only-child', container).forEach(function(iframe) {
|
137
|
+
var slide = iframe.parentNode,
|
138
|
+
h = document.createElement('h1'),
|
139
|
+
a = document.createElement('a'),
|
140
|
+
src = iframe.src || iframe.getAttribute('data-src');
|
141
|
+
|
142
|
+
slide.classList.add('iframe');
|
143
|
+
slide.classList.add('dont-resize');
|
144
|
+
|
145
|
+
var title = iframe.title || src.replace(/\/#?$/, '')
|
146
|
+
.replace(/^\w+:\/\/w{0,3}\.?/, '');
|
147
|
+
|
148
|
+
a.href = iframe.src;
|
149
|
+
a.target = '_blank';
|
150
|
+
a.textContent = title;
|
151
|
+
h.appendChild(a);
|
152
|
+
|
153
|
+
slide.appendChild(h);
|
154
|
+
});
|
155
|
+
}
|
156
|
+
|
157
|
+
self.prototype = {
|
158
|
+
handleEvent: function(evt) {
|
159
|
+
switch(evt.type) {
|
160
|
+
/**
|
161
|
+
Keyboard navigation
|
162
|
+
Ctrl+G : Go to slide...
|
163
|
+
Ctrl+H : Show thumbnails and go to slide
|
164
|
+
Ctrl+P : Presenter view
|
165
|
+
(Shift instead of Ctrl works too)
|
166
|
+
*/
|
167
|
+
case 'keyup':
|
168
|
+
if(evt.ctrlKey || evt.shiftKey) {
|
169
|
+
switch(evt.keyCode) {
|
170
|
+
case 71: // G
|
171
|
+
var slide = prompt('Which slide?');
|
172
|
+
me.goto(+slide? slide - 1 : slide);
|
173
|
+
break;
|
174
|
+
case 72: // H
|
175
|
+
if(body.classList.contains('show-thumbnails')) {
|
176
|
+
body.classList.remove('show-thumbnails');
|
177
|
+
body.classList.remove('headers-only');
|
178
|
+
}
|
179
|
+
else {
|
180
|
+
body.classList.add('show-thumbnails');
|
181
|
+
|
182
|
+
if(!evt.shiftKey || !evt.ctrlKey) {
|
183
|
+
body.classList.add('headers-only');
|
184
|
+
}
|
185
|
+
|
186
|
+
body.addEventListener('click', function(evt) {
|
187
|
+
var slide = evt.target;
|
188
|
+
|
189
|
+
while(slide && !slide.classList.contains('slide')) {
|
190
|
+
slide = slide.parentNode;
|
191
|
+
}
|
192
|
+
|
193
|
+
if(slide) {
|
194
|
+
this.goto(slide.id);
|
195
|
+
setTimeout(function() { me.adjustFontSize(); }, 1000); // for Opera
|
196
|
+
}
|
197
|
+
|
198
|
+
body.classList.remove('show-thumbnails');
|
199
|
+
body.classList.remove('headers-only');
|
200
|
+
}, false);
|
201
|
+
}
|
202
|
+
break;
|
203
|
+
case 74: // J
|
204
|
+
if(body.classList.contains('hide-elements')) {
|
205
|
+
body.classList.remove('hide-elements');
|
206
|
+
}
|
207
|
+
else {
|
208
|
+
body.classList.add('hide-elements');
|
209
|
+
}
|
210
|
+
break;
|
211
|
+
case 80: // P
|
212
|
+
// Open new window for attendee view
|
213
|
+
this.projector = open(location, 'projector');
|
214
|
+
|
215
|
+
// Get the focus back
|
216
|
+
window.focus();
|
217
|
+
|
218
|
+
// Switch this one to presenter view
|
219
|
+
body.classList.add('presenter');
|
220
|
+
}
|
221
|
+
}
|
222
|
+
break;
|
223
|
+
case 'keydown':
|
224
|
+
/**
|
225
|
+
Keyboard navigation
|
226
|
+
Home : First slide
|
227
|
+
End : Last slide
|
228
|
+
Space/Up/Right arrow : Next item/slide
|
229
|
+
Ctrl + Space/Up/Right arrow : Next slide
|
230
|
+
Down/Left arrow : Previous item/slide
|
231
|
+
Ctrl + Down/Left arrow : Previous slide
|
232
|
+
(Shift instead of Ctrl works too)
|
233
|
+
*/
|
234
|
+
if(evt.target === body || evt.target === body.parentNode || evt.altKey) {
|
235
|
+
if(evt.keyCode >= 32 && evt.keyCode <= 40) {
|
236
|
+
evt.preventDefault();
|
237
|
+
}
|
238
|
+
|
239
|
+
switch(evt.keyCode) {
|
240
|
+
case 33: //page up
|
241
|
+
this.previous();
|
242
|
+
break;
|
243
|
+
case 34: //page down
|
244
|
+
this.next();
|
245
|
+
break;
|
246
|
+
case 35: // end
|
247
|
+
this.end();
|
248
|
+
break;
|
249
|
+
case 36: // home
|
250
|
+
this.start();
|
251
|
+
break;
|
252
|
+
case 37: // <-
|
253
|
+
case 38: // up arrow
|
254
|
+
this.previous(evt.ctrlKey || evt.shiftKey);
|
255
|
+
break;
|
256
|
+
case 32: // space
|
257
|
+
case 39: // ->
|
258
|
+
case 40: // down arrow
|
259
|
+
this.next(evt.ctrlKey || evt.shiftKey);
|
260
|
+
break;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
break;
|
264
|
+
case 'load':
|
265
|
+
case 'resize':
|
266
|
+
this.adjustFontSize();
|
267
|
+
break;
|
268
|
+
case 'hashchange':
|
269
|
+
this.goto(location.hash.substr(1) || 0);
|
270
|
+
}
|
271
|
+
},
|
272
|
+
|
273
|
+
start: function() {
|
274
|
+
this.goto(0);
|
275
|
+
},
|
276
|
+
|
277
|
+
end: function() {
|
278
|
+
this.goto(this.slides.length - 1);
|
279
|
+
},
|
280
|
+
|
281
|
+
/**
|
282
|
+
@param hard {Boolean} Whether to advance to the next slide (true) or
|
283
|
+
just the next step (which could very well be showing a list item)
|
284
|
+
*/
|
285
|
+
next: function(hard) {
|
286
|
+
if(!hard && this.items.length) {
|
287
|
+
this.nextItem();
|
288
|
+
}
|
289
|
+
else {
|
290
|
+
this.goto(this.index + 1);
|
291
|
+
|
292
|
+
this.item = 0;
|
293
|
+
|
294
|
+
// Mark all items as not displayed, if there are any
|
295
|
+
if(this.items.length) {
|
296
|
+
for (var i=0; i<this.items.length; i++) {
|
297
|
+
if(this.items[i].classList) {
|
298
|
+
this.items[i].classList.remove('displayed');
|
299
|
+
this.items[i].classList.remove('current');
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
},
|
305
|
+
|
306
|
+
nextItem: function() {
|
307
|
+
if(this.item < this.items.length) {
|
308
|
+
this.gotoItem(++this.item);
|
309
|
+
}
|
310
|
+
else {
|
311
|
+
this.item = 0;
|
312
|
+
this.next(true);
|
313
|
+
}
|
314
|
+
},
|
315
|
+
|
316
|
+
previous: function(hard) {
|
317
|
+
if(!hard && this.item > 0) {
|
318
|
+
this.previousItem();
|
319
|
+
}
|
320
|
+
else {
|
321
|
+
this.goto(this.index - 1);
|
322
|
+
|
323
|
+
this.item = this.items.length;
|
324
|
+
|
325
|
+
// Mark all items as displayed, if there are any
|
326
|
+
if(this.items.length) {
|
327
|
+
for (var i=0; i<this.items.length; i++) {
|
328
|
+
if(this.items[i].classList) {
|
329
|
+
this.items[i].classList.add('displayed');
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
// Mark the last one as current
|
334
|
+
var lastItem = this.items[this.items.length - 1];
|
335
|
+
|
336
|
+
lastItem.classList.remove('displayed');
|
337
|
+
lastItem.classList.add('current');
|
338
|
+
}
|
339
|
+
}
|
340
|
+
},
|
341
|
+
|
342
|
+
previousItem: function() {
|
343
|
+
this.gotoItem(--this.item);
|
344
|
+
},
|
345
|
+
|
346
|
+
getSlideById: function(id) {
|
347
|
+
return $('.slide#' + id, this.container);
|
348
|
+
},
|
349
|
+
|
350
|
+
/**
|
351
|
+
Go to an aribtary slide
|
352
|
+
@param which {String|Integer} Which slide (identifier or slide number)
|
353
|
+
*/
|
354
|
+
goto: function(which) {
|
355
|
+
var slide;
|
356
|
+
|
357
|
+
// We have to remove it to prevent multiple calls to goto messing up
|
358
|
+
// our current item (and there's no point either, so we save on performance)
|
359
|
+
window.removeEventListener('hashchange', this, false);
|
360
|
+
|
361
|
+
var id;
|
362
|
+
|
363
|
+
if(which + 0 === which && which in this.slides) {
|
364
|
+
// Argument is a valid slide number
|
365
|
+
this.index = which;
|
366
|
+
this.slide = this.order[which]
|
367
|
+
|
368
|
+
slide = this.slides[this.slide];
|
369
|
+
|
370
|
+
location.hash = '#' + slide.id;
|
371
|
+
}
|
372
|
+
else if(which + '' === which) { // Argument is a slide id
|
373
|
+
slide = this.getSlideById(which);
|
374
|
+
|
375
|
+
if(slide) {
|
376
|
+
this.slide = this.index = +slide.getAttribute('data-index');
|
377
|
+
location.hash = '#' + which;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
if(slide) { // Slide actually changed, perform any other tasks needed
|
382
|
+
document.title = slide.getAttribute('data-title') || documentTitle;
|
383
|
+
|
384
|
+
this.adjustFontSize();
|
385
|
+
|
386
|
+
this.indicator.textContent = this.index;
|
387
|
+
|
388
|
+
// Update items collection
|
389
|
+
this.items = $$('.delayed, .delayed-children > *', this.slides[this.slide]);
|
390
|
+
this.item = 0;
|
391
|
+
|
392
|
+
this.projector && this.projector.goto(which);
|
393
|
+
|
394
|
+
// Update next/previous
|
395
|
+
for (var i=this.slides.length; i--;) {
|
396
|
+
this.slides[i].classList.remove('previous');
|
397
|
+
this.slides[i].classList.remove('next');
|
398
|
+
}
|
399
|
+
|
400
|
+
this.slides.previous = this.slides[this.order[this.index - 1]];
|
401
|
+
this.slides.next = this.slides[this.order[this.index + 1]];
|
402
|
+
|
403
|
+
this.slides.previous && this.slides.previous.classList.add('previous');
|
404
|
+
this.slides.next && this.slides.next.classList.add('next');
|
405
|
+
}
|
406
|
+
|
407
|
+
// If you attach the listener immediately again then it will catch the event
|
408
|
+
// We have to do it asynchronously
|
409
|
+
var me = this;
|
410
|
+
setTimeout(function() {
|
411
|
+
addEventListener('hashchange', me, false);
|
412
|
+
}, 1000);
|
413
|
+
},
|
414
|
+
|
415
|
+
gotoItem: function(which) {
|
416
|
+
this.item = which;
|
417
|
+
|
418
|
+
var items = this.items, classes;
|
419
|
+
|
420
|
+
for(var i=items.length; i-- > 0;) {
|
421
|
+
classes = this.items[i].classList;
|
422
|
+
|
423
|
+
classes.remove('current');
|
424
|
+
classes.remove('displayed');
|
425
|
+
}
|
426
|
+
|
427
|
+
for(var i=this.item - 1; i-- > 0;) {
|
428
|
+
this.items[i].classList.add('displayed');
|
429
|
+
}
|
430
|
+
|
431
|
+
if(this.item > 0) {
|
432
|
+
this.items[this.item - 1].classList.add('current');
|
433
|
+
}
|
434
|
+
|
435
|
+
this.projector && this.projector.gotoItem(which);
|
436
|
+
},
|
437
|
+
|
438
|
+
adjustFontSize: function() {
|
439
|
+
// Cache long lookup chains, for performance
|
440
|
+
var bodyStyle = body.style,
|
441
|
+
scrollRoot = document[document.documentElement.scrollHeight? 'documentElement' : 'body'],
|
442
|
+
innerHeight = window.innerHeight,
|
443
|
+
innerWidth = window.innerWidth,
|
444
|
+
slide = this.slides[this.slide];
|
445
|
+
|
446
|
+
// Clear previous styles
|
447
|
+
bodyStyle.fontSize = '';
|
448
|
+
|
449
|
+
if(body.classList.contains('show-thumbnails')
|
450
|
+
|| slide.classList.contains('dont-resize')) {
|
451
|
+
return;
|
452
|
+
}
|
453
|
+
|
454
|
+
for(
|
455
|
+
var percent = 100;
|
456
|
+
(scrollRoot.scrollHeight > innerHeight || scrollRoot.scrollWidth > innerWidth) && percent >= 35;
|
457
|
+
percent-=5
|
458
|
+
) {
|
459
|
+
bodyStyle.fontSize = percent + '%';
|
460
|
+
}
|
461
|
+
|
462
|
+
// Individual slide
|
463
|
+
|
464
|
+
if(slide.clientHeight && slide.clientWidth) {
|
465
|
+
// Strange FF bug: scrollHeight doesn't work properly with overflow:hidden
|
466
|
+
var previousStyle = slide.getAttribute('style');
|
467
|
+
slide.style.overflow = 'auto';
|
468
|
+
|
469
|
+
for(
|
470
|
+
;
|
471
|
+
(slide.scrollHeight > slide.clientHeight || slide.scrollWidth > slide.clientWidth) && percent >= 35;
|
472
|
+
percent--
|
473
|
+
) {
|
474
|
+
bodyStyle.fontSize = percent + '%';
|
475
|
+
}
|
476
|
+
|
477
|
+
slide.setAttribute('style', previousStyle);
|
478
|
+
}
|
479
|
+
},
|
480
|
+
|
481
|
+
// Is the element on the current slide?
|
482
|
+
onCurrent: function(element) {
|
483
|
+
var slide = self.getSlide(element);
|
484
|
+
|
485
|
+
if(slide) {
|
486
|
+
return '#' + slide.id === location.hash;
|
487
|
+
}
|
488
|
+
|
489
|
+
return false;
|
490
|
+
}
|
491
|
+
};
|
492
|
+
|
493
|
+
/**********************************************
|
494
|
+
* Static methods
|
495
|
+
**********************************************/
|
496
|
+
|
497
|
+
// Helper method for plugins
|
498
|
+
self.getSlide = function(element) {
|
499
|
+
var slide = element;
|
500
|
+
|
501
|
+
while (slide && slide.classList && !slide.classList.contains('slide')) {
|
502
|
+
slide = slide.parentNode;
|
503
|
+
}
|
504
|
+
|
505
|
+
return slide;
|
506
|
+
}
|
507
|
+
|
508
|
+
})(document.head || document.getElementsByTagName('head')[0], document.body);
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#intro {
|
2
|
+
background: rgba(0,0,0,.7);
|
3
|
+
padding: 0;
|
4
|
+
border: 0;
|
5
|
+
}
|
6
|
+
|
7
|
+
#intro h1 {
|
8
|
+
width: 60%;
|
9
|
+
min-height: 500px;
|
10
|
+
margin: 5% auto 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
#intro .attribution {
|
14
|
+
font-family: Helvetica, sans-serif;
|
15
|
+
font-weight: bold;
|
16
|
+
text-align: center;
|
17
|
+
font-size: 100%;
|
18
|
+
/* line-height: .3; */
|
19
|
+
/* color: rgba(0,0,0,.7); */
|
20
|
+
text-shadow: none;
|
21
|
+
/* background: url(img/rainbow-wood.jpg) bottom; */
|
22
|
+
padding:.6em 0 0;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
#css-controls-demo label {
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
|
31
|
+
@media only screen and (-webkit-min-device-pixel-ratio:0) {
|
32
|
+
/* hack to avoid using the Object element in Safari/WebKit, due to WebKit Bug 27190 */
|
33
|
+
object[type="image/svg+xml"] {
|
34
|
+
display: none;
|
35
|
+
}
|
36
|
+
|
37
|
+
#intro h1 {
|
38
|
+
background: url(logo.svg) no-repeat center;
|
39
|
+
background-size:100% auto;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
/*
|
44
|
+
{{ more_content_for_css }}
|
45
|
+
*/
|