This repository was archived by the owner on Sep 30, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
394 lines (373 loc) · 20.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<!doctype html>
<html>
<head>
<!--
JS-Point developed by Kent C. Dodds (http://kent.doddsfamily.us)
Libraries used: impress.js distributed under MIT license.
-->
<script>
var totalSlides = 15; //How many slides were exported from your presentation?
//Do you have any slides between which you don't want any animation?
var slideGroups = [
{
start: 1,
end: 3,
key: 's'
}
];
</script>
<title>JS-Point Presentation</title> <!-- What is shown in the title bar -->
<!-- Simple CSS I would recommend changing the background color of the body -->
<style type="text/css">
body {
background-color: rgb(0,0,0);
font-family: sans-serif;
}
* {
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-ms-transition: opacity 1s;
-o-transition: opacity 1s;
transition: opacity 1s;
}
/* fade out inactive slides */
img:not(.active) {
opacity: 0;
}
#shortcutsOverlay {
opacity: 0;
position: absolute;
background-color: rgba(255,255,255,0.85);
z-index: 1000;
padding-left: 7%;
padding-right: 7%;
padding-bottom: 30px;
left: 0;
right: 0;
top: 0;
}
#dimOverlay {
opacity: 0;
position: absolute;
background-color: black;
z-index: 1001;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
</style>
</head>
<body>
<div id="impress">
<!-- This is where js-point puts the images. Don't put anything here... -->
</div>
<div id="shortcutsOverlay">
<div>
<h1>JS-Point</h1>
<p>Created by Kent C. Dodds using jQuery and jmpress.js</p>
<div>
<h2>Keyboard Shortcuts</h2>
<p>
You have a number of keyboard shortcuts available to you:
<ul>
<li><strong>?</strong>: Access and close this dialog</li>
<li><strong>1</strong>: Go to first slide</li>
<li><strong>2-9</strong>: Go to around that point (percentage-wise) of the presentation</li>
<li><strong>0</strong>: Go to last slide</li>
<li><strong>. (period)</strong>: Dim presentation (press again to bring it back)</li>
<li><strong>Esc</strong>: Restore to presentation mode (remove this dialog, undim presentation)</li>
<li><strong>X</strong>: Export generated templates to console (useful if you want to save transitions)</li>
</ul>
You can also have custom keyboard shortcuts for slide groups.<br />
Simply add a 'key' property to the group with the shortcut key.
</p>
</div>
<div style="display:none;">
<h2>Other Features</h2>
<p>
You can zoom in on a slide using the scroll wheel or + and - keys. (Coming soon... maybe...)
</p>
</div>
</div>
</div>
<div id="dimOverlay"></div>
<!--
Ignore the next script tag below.
It's the library we're using
to make the magic work.
And it's uglified... Nothing to see.
-->
<script>
/**
* impress.js
*
* impress.js is a presentation tool based on the power of CSS3 transforms and transitions
* in modern browsers and inspired by the idea behind prezi.com.
*
*
* Copyright 2011-2012 Bartek Szopka (@bartaz)
*
* Released under the MIT and GPL Licenses.
*
* ------------------------------------------------
* author: Bartek Szopka
* version: 0.5.3
* url: http://bartaz.github.com/impress.js/
* source: http://github.com/bartaz/impress.js/
*/
!function(a,b){"use strict";var c=function(){var b=a.createElement("dummy").style,c="Webkit Moz O ms Khtml".split(" "),d={};return function(a){if("undefined"==typeof d[a]){var e=a.charAt(0).toUpperCase()+a.substr(1),f=(a+" "+c.join(e+" ")+e).split(" ");d[a]=null;for(var g in f)if(void 0!==b[f[g]]){d[a]=f[g];break}}return d[a]}}(),d=function(a){return[].slice.call(a)},e=function(a,b){var d,e;for(d in b)b.hasOwnProperty(d)&&(e=c(d),null!==e&&(a.style[e]=b[d]));return a},f=function(a,b){return isNaN(a)?b||0:Number(a)},g=function(b){return a.getElementById(b)},h=function(b,c){return c=c||a,c.querySelector(b)},i=function(b,c){return c=c||a,d(c.querySelectorAll(b))},j=function(b,c,d){var e=a.createEvent("CustomEvent");e.initCustomEvent(c,!0,!0,d),b.dispatchEvent(e)},k=function(a){return" translate3d("+a.x+"px,"+a.y+"px,"+a.z+"px) "},l=function(a,b){var c=" rotateX("+a.x+"deg) ",d=" rotateY("+a.y+"deg) ",e=" rotateZ("+a.z+"deg) ";return b?e+d+c:c+d+e},m=function(a){return" scale("+a+") "},n=function(a){return" perspective("+a+"px) "},o=function(){return g(b.location.hash.replace(/^#\/?/,""))},p=function(a){var c=b.innerHeight/a.height,d=b.innerWidth/a.width,e=c>d?d:c;return a.maxScale&&e>a.maxScale&&(e=a.maxScale),a.minScale&&e<a.minScale&&(e=a.minScale),e},q=a.body,r=navigator.userAgent.toLowerCase(),s=null!==c("perspective")&&q.classList&&q.dataset&&-1===r.search(/(iphone)|(ipod)|(android)/);s?(q.classList.remove("impress-not-supported"),q.classList.add("impress-supported")):q.className+=" impress-not-supported ";var t={},u={width:1024,height:768,maxScale:1,minScale:0,perspective:1e3,transitionDuration:1e3},v=function(){return!1},w=b.impress=function(c){if(!s)return{init:v,"goto":v,prev:v,next:v};if(c=c||"impress",t["impress-root-"+c])return t["impress-root-"+c];var r={},w=null,x=null,y=null,z=null,A=null,B=g(c),C=a.createElement("div"),D=!1,E=null,F=function(a){E!==a&&(j(a,"impress:stepenter"),E=a)},G=function(a){E===a&&(j(a,"impress:stepleave"),E=null)},H=function(a,b){var c=a.dataset,d={translate:{x:f(c.x),y:f(c.y),z:f(c.z)},rotate:{x:f(c.rotateX),y:f(c.rotateY),z:f(c.rotateZ||c.rotate)},scale:f(c.scale,1),el:a};a.id||(a.id="step-"+(b+1)),r["impress-"+a.id]=d,e(a,{position:"absolute",transform:"translate(-50%,-50%)"+k(d.translate)+l(d.rotate)+m(d.scale),transformStyle:"preserve-3d"})},I=function(){if(!D){var b=h("meta[name='viewport']")||a.createElement("meta");b.content="width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no",b.parentNode!==a.head&&(b.name="viewport",a.head.appendChild(b));var g=B.dataset;z={width:f(g.width,u.width),height:f(g.height,u.height),maxScale:f(g.maxScale,u.maxScale),minScale:f(g.minScale,u.minScale),perspective:f(g.perspective,u.perspective),transitionDuration:f(g.transitionDuration,u.transitionDuration)},A=p(z),d(B.childNodes).forEach(function(a){C.appendChild(a)}),B.appendChild(C),a.documentElement.style.height="100%",e(q,{height:"100%",overflow:"hidden"});var k={position:"absolute",transformOrigin:"top left",transition:"all 0s ease-in-out",transformStyle:"preserve-3d"};e(B,k),e(B,{top:"50%",left:"50%",transform:n(z.perspective/A)+m(A)}),e(C,k),q.classList.remove("impress-disabled"),q.classList.add("impress-enabled"),y=i(".step",B),y.forEach(H),x={translate:{x:0,y:0,z:0},rotate:{x:0,y:0,z:0},scale:1},D=!0,j(B,"impress:init",{api:t["impress-root-"+c]})}},J=function(a){return"number"==typeof a?a=0>a?y[y.length+a]:y[a]:"string"==typeof a&&(a=g(a)),a&&a.id&&r["impress-"+a.id]?a:null},K=null,L=function(a,c){if(!D||!(a=J(a)))return!1;b.scrollTo(0,0);var d=r["impress-"+a.id];w&&(w.classList.remove("active"),q.classList.remove("impress-on-"+w.id)),a.classList.add("active"),q.classList.add("impress-on-"+a.id);var g={rotate:{x:-d.rotate.x,y:-d.rotate.y,z:-d.rotate.z},translate:{x:-d.translate.x,y:-d.translate.y,z:-d.translate.z},scale:1/d.scale},h=g.scale>=x.scale;c=f(c,z.transitionDuration);var i=c/2;a===w&&(A=p(z));var j=g.scale*A;return w&&w!==a&&G(w),e(B,{transform:n(z.perspective/j)+m(j),transitionDuration:c+"ms",transitionDelay:(h?i:0)+"ms"}),e(C,{transform:l(g.rotate,!0)+k(g.translate),transitionDuration:c+"ms",transitionDelay:(h?0:i)+"ms"}),(x.scale===g.scale||x.rotate.x===g.rotate.x&&x.rotate.y===g.rotate.y&&x.rotate.z===g.rotate.z&&x.translate.x===g.translate.x&&x.translate.y===g.translate.y&&x.translate.z===g.translate.z)&&(i=0),x=g,w=a,b.clearTimeout(K),K=b.setTimeout(function(){F(w)},c+i),a},M=function(){var a=y.indexOf(w)-1;return a=a>=0?y[a]:y[y.length-1],L(a)},N=function(){var a=y.indexOf(w)+1;return a=a<y.length?y[a]:y[0],L(a)};return B.addEventListener("impress:init",function(){y.forEach(function(a){a.classList.add("future")}),B.addEventListener("impress:stepenter",function(a){a.target.classList.remove("past"),a.target.classList.remove("future"),a.target.classList.add("present")},!1),B.addEventListener("impress:stepleave",function(a){a.target.classList.remove("present"),a.target.classList.add("past")},!1)},!1),B.addEventListener("impress:init",function(){var a="";B.addEventListener("impress:stepenter",function(c){b.location.hash=a="#/"+c.target.id},!1),b.addEventListener("hashchange",function(){b.location.hash!==a&&L(o())},!1),L(o()||y[0],0)},!1),q.classList.add("impress-disabled"),t["impress-root-"+c]={init:I,"goto":L,next:N,prev:M}};w.supported=s}(document,window),function(a,b){"use strict";var c=function(a,b){var c=null;return function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}};a.addEventListener("impress:init",function(d){var e=d.detail.api;a.addEventListener("keydown",function(a){(9===a.keyCode||a.keyCode>=32&&a.keyCode<=34||a.keyCode>=37&&a.keyCode<=40)&&a.preventDefault()},!1),a.addEventListener("keyup",function(a){if(9===a.keyCode||a.keyCode>=32&&a.keyCode<=34||a.keyCode>=37&&a.keyCode<=40){switch(a.keyCode){case 33:case 37:case 38:e.prev();break;case 9:case 32:case 34:case 39:case 40:e.next()}a.preventDefault()}},!1),a.addEventListener("click",function(b){for(var c=b.target;"A"!==c.tagName&&c!==a.documentElement;)c=c.parentNode;if("A"===c.tagName){var d=c.getAttribute("href");d&&"#"===d[0]&&(c=a.getElementById(d.slice(1)))}e.goto(c)&&(b.stopImmediatePropagation(),b.preventDefault())},!1),a.addEventListener("click",function(b){for(var c=b.target;(!c.classList.contains("step")||c.classList.contains("active"))&&c!==a.documentElement;)c=c.parentNode;e.goto(c)&&b.preventDefault()},!1),a.addEventListener("touchstart",function(a){if(1===a.touches.length){var c=a.touches[0].clientX,d=.3*b.innerWidth,f=null;d>c?f=e.prev():c>b.innerWidth-d&&(f=e.next()),f&&a.preventDefault()}},!1),b.addEventListener("resize",c(function(){e.goto(a.querySelector(".step.active"),500)},250),!1)},!1)}(document,window);
</script>
<!--
This is the script to generate the
positioning for all the slides.
You shouldn't have to mess with this
unless you want to customize a bit.
-->
<script>
(function() {
var jsPointContainer = document.getElementById('impress');
var impressApi = impress();
totalSlides = totalSlides || 8;
slideGroups = slideGroups || [];
var jsPoint = {
appendImages: function() {
var template, id, img;
for (var i = 1; i <= totalSlides; i++) {
id = 'Slide' + i;
img = document.createElement('img');
img.id = id;
img.src = id + '.PNG';
img.className = 'step';
jsPointContainer.appendChild(img);
};
},
toggleElementOpacity: function(element, forcedOpacity) {
var s = element.style;
if (forcedOpacity) {
s.opacity = forcedOpacity;
return;
}
if (!s.opacity || s.opacity === '0') {
s.opacity = '1';
} else {
s.opacity = '0';
}
},
shallowClone: function(originalObject) {
var clone = {};
for (var prop in originalObject) {
clone[prop] = originalObject[prop];
}
return clone;
},
template: {
templates: {},
currentTemplate: {
x: 0,
y: 0,
z: 0,
'rotate-x': 0,
'rotate-y': 0,
'rotate-z': 0
},
generateTemplates: function() {
var template, img, id, prop;
var self = this;
var imgs = document.getElementsByTagName('img');
for (var i = 0, total = imgs.length; i < total; i++) {
img = imgs[i];
id = img.id;
template = self.generateTemplate(id, self.currentTemplate);
self.templates[id] = jsPoint.shallowClone(template);
for (prop in template) {
img.setAttribute('data-' + prop, template[prop]);
}
};
},
generateTemplate: (function() {
var getSlideNumberFromId = function(slideId) {
return parseInt(slideId.replace('Slide', ''));
};
var shouldGenerateNewTemplate = (function() {
return function(slideId) {
var slideNumber = getSlideNumberFromId(slideId);
for (var i = 0, total = slideGroups.length; i < total; i++) {
var group = slideGroups[i];
if (slideNumber > group.start && slideNumber <= group.end) {
return false;
}
}
return true;
};
})();
return function(slideId, template) {
if (shouldGenerateNewTemplate(slideId)) {
return jsPoint.random.randomizeTemplate(template);
} else {
return template;
}
};
})()
},
random: {
randomizeTemplate: function(template) {
template.x += this.getRandomPositionChange();
template.y += this.getRandomPositionChange();
template.z += this.getRandomPositionChange();
var whichToRotate = this.getRandomNumber(0, 4);
switch(whichToRotate) {
case 0:
template['rotate-x'] += this.getRandomRotationChange();
break;
case 1:
template['rotate-x'] += this.getRandomRotationChange();
case 2:
template['rotate-y'] += this.getRandomRotationChange();
break;
case 3:
template['rotate-y'] += this.getRandomRotationChange();
case 4:
template['rotate-z'] += this.getRandomRotationChange();
break;
}
return template;
},
getRandomNumber: function(min, max) {
return Math.floor(Math.random()*(max - min + 1)) + min;
},
getRandomPositionChange: function() {
return this.getRandomNumber(-10, 10)*100;
},
getRandomRotationChange: function() {
return this.getRandomNumber(-2, 2)*90;
}
},
alertForIE: function() {
if (navigator.appName == 'Microsoft Internet Explorer') {
alert("Looks like you're using Internet Explorer. JS-Point transitions don't work in IE. Try using Google Chrome.");
}
},
setupAutoResize: function() {
var getWidthAndHeight = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
w = w.innerWidth || e.clientWidth || g.clientWidth,
h = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {width: w, height: h};
};
var resize = function() {
var img;
var wh = getWidthAndHeight();
var maxHeight = wh.height * .8;
var maxWidth = wh.width * .8;
var imgs = document.getElementsByTagName('img');
for (var i = 0, total = imgs.length; i < total; i++) {
img = imgs[i];
img.style.maxHeight = maxHeight;
img.style.maxWidth = maxWidth;
};
};
resize();
window.onresize = resize;
},
initEventHandlers: function() {
var executeKeyAction;
var shortcutsOverlay = document.getElementById('shortcutsOverlay');
var dimOverlay = document.getElementById('dimOverlay');
var charCode = function(character) {
return character.charCodeAt(0);
}
var fractionOfSlidesToSlice = totalSlides / 9;
// Create keyboard shortcuts.
var keypressKeys = {};
var keydownKeys = {};
var otherChars = {
escapeKey: 27,
questionMark: 63
}
// Numbers 1 - 9 (and 0) shortcuts
keypressKeys[charCode('1')] = function() {
impressApi.goto('Slide1');
};
for (var i = 2; i <= 9; i++) {
keypressKeys[charCode('' + i)] = (function() {
var slideNum = Math.round(fractionOfSlidesToSlice * (i - 1));
var keyFunction = function() {
impressApi.goto('Slide' + slideNum);
};
keyFunction.requirements = function(event) {
return !event.shiftKey && !event.ctrlKey && !event.altKey;
};
return keyFunction;
})();
}
keypressKeys[charCode('0')] = function() {
impressApi.goto('Slide' + totalSlides);
};
// About dialog
keypressKeys[charCode('?')] = function() {
jsPoint.toggleElementOpacity(shortcutsOverlay);
};
// Dim
keypressKeys[charCode('.')] = function() {
jsPoint.toggleElementOpacity(dimOverlay);
};
// Escape
keydownKeys[otherChars.escapeKey] = function(event) {
jsPoint.toggleElementOpacity(shortcutsOverlay, '0');
jsPoint.toggleElementOpacity(dimOverlay, '0');
};
// Export template to console
keypressKeys[charCode('x')] = function(event) {
console.log(JSON.stringify(jsPoint.template.templates, null, 2));
};
// Custom shortcuts (must be the last thing)
for (var i = 0, total = slideGroups.length; i < total; i++) {
var group = slideGroups[i];
var key = group.key;
if (key) {
keypressKeys[charCode(key)] = function() {
impressApi.goto('Slide' + group.start);
};
}
}
executeKeyAction = function(event, keyCollection) {
var key = keyCollection[event.which + ''];
if (key && (!key.requirements || key.requirements(event))) {
key(event);
}
};
document.addEventListener('keypress', function(event) {
executeKeyAction(event, keypressKeys);
}, false);
document.addEventListener('keydown', function(event) {
executeKeyAction(event, keydownKeys);
}, false);
}
};
//Initialize some stuff that doesn't need to wait for the dom.
jsPoint.alertForIE();
//Initialize stuff that does need to wait for the dom.
window.addEventListener('load', function() {
jsPoint.appendImages();
jsPoint.template.generateTemplates();
impressApi.init();
jsPoint.initEventHandlers();
}, false);
})();
</script>
<script>
//Google Analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62924965-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>