@@ -111,382 +111,6 @@ $body$
111111$for(include-after)$
112112$include-after$
113113$endfor$
114−<!-- {{{{ dzslides core
115−#
116−#
117−# __ __ __ . __ ___ __
118−# | \ / /__` | | | \ |__ /__`
119−# |__/ /_ .__/ |___ | |__/ |___ .__/ core :€
120−#
121−#
122−# The following block of code is not supposed to be edited.
123−# But if you want to change the behavior of these slides,
124−# feel free to hack it!
125−#
126−-->
127−
128−<!-- Default Style -->
129−<style>
130− * { margin: 0; padding: 0; }
131− details { display: none; }
132− body {
133− width: 800px; height: 600px;
134− margin-left: -400px; margin-top: -300px;
135− position: absolute; top: 50%; left: 50%;
136− overflow: hidden;
137− }
138− section {
139− position: absolute;
140− pointer-events: none;
141− width: 100%; height: 100%;
142− }
143− section[aria-selected] { pointer-events: auto; }
144− html { overflow: hidden; }
145− body { display: none; }
146− body.loaded { display: block; }
147− .incremental {visibility: hidden; }
148− .incremental[active] {visibility: visible; }
149−</style>
150−
151−<script>
152− var Dz = {
153− remoteWindows: [],
154− idx: -1,
155− step: 0,
156− slides: null,
157− params: {
158− autoplay: "1"
159− }
160− };
161−
162− Dz.init = function() {
163− document.body.className = "loaded";
164− this.slides = $$$$("body > section");
165− this.setupParams();
166− this.onhashchange();
167− this.setupTouchEvents();
168− this.onresize();
169− }
170−
171− Dz.setupParams = function() {
172− var p = window.location.search.substr(1).split('&');
173− p.forEach(function(e, i, a) {
174− var keyVal = e.split('=');
175− Dz.params[keyVal[0]] = decodeURIComponent(keyVal[1]);
176− });
177− }
178−
179− Dz.onkeydown = function(aEvent) {
180− // Don't intercept keyboard shortcuts
181− if (aEvent.altKey
182− || aEvent.ctrlKey
183− || aEvent.metaKey
184− || aEvent.shiftKey) {
185− return;
186− }
187− if ( aEvent.keyCode == 37 // left arrow
188− || aEvent.keyCode == 38 // up arrow
189− || aEvent.keyCode == 33 // page up
190− ) {
191− aEvent.preventDefault();
192− this.back();
193− }
194− if ( aEvent.keyCode == 39 // right arrow
195− || aEvent.keyCode == 40 // down arrow
196− || aEvent.keyCode == 34 // page down
197− ) {
198− aEvent.preventDefault();
199− this.forward();
200− }
201− if (aEvent.keyCode == 35) { // end
202− aEvent.preventDefault();
203− this.goEnd();
204− }
205− if (aEvent.keyCode == 36) { // home
206− aEvent.preventDefault();
207− this.goStart();
208− }
209− if (aEvent.keyCode == 32) { // space
210− aEvent.preventDefault();
211− this.toggleContent();
212− }
213− }
214−
215− /* Touch Events */
216−
217− Dz.setupTouchEvents = function() {
218− var orgX, newX;
219− var tracking = false;
220−
221− var db = document.body;
222− db.addEventListener("touchstart", start.bind(this), false);
223− db.addEventListener("touchmove", move.bind(this), false);
224−
225− function start(aEvent) {
226− aEvent.preventDefault();
227− tracking = true;
228− orgX = aEvent.changedTouches[0].pageX;
229− }
230−
231− function move(aEvent) {
232− if (!tracking) return;
233− newX = aEvent.changedTouches[0].pageX;
234− if (orgX - newX > 100) {
235− tracking = false;
236− this.forward();
237− } else {
238− if (orgX - newX < -100) {
239− tracking = false;
240− this.back();
241− }
242− }
243− }
244− }
245−
246− /* Adapt the size of the slides to the window */
247−
248− Dz.onresize = function() {
249− var db = document.body;
250− var sx = db.clientWidth / window.innerWidth;
251− var sy = db.clientHeight / window.innerHeight;
252− var transform = "scale(" + (1/Math.max(sx, sy)) + ")";
253−
254− db.style.MozTransform = transform;
255− db.style.WebkitTransform = transform;
256− db.style.OTransform = transform;
257− db.style.msTransform = transform;
258− db.style.transform = transform;
259− }
260−
261−
262− Dz.getDetails = function(aIdx) {
263− var s = $$("section:nth-of-type(" + aIdx + ")");
264− var d = s.$$("details");
265− return d ? d.innerHTML : "";
266− }
267−
268− Dz.onmessage = function(aEvent) {
269− var argv = aEvent.data.split(" "), argc = argv.length;
270− argv.forEach(function(e, i, a) { a[i] = decodeURIComponent(e) });
271− var win = aEvent.source;
272− if (argv[0] === "REGISTER" && argc === 1) {
273− this.remoteWindows.push(win);
274− this.postMsg(win, "REGISTERED", document.title, this.slides.length);
275− this.postMsg(win, "CURSOR", this.idx + "." + this.step);
276− return;
277− }
278− if (argv[0] === "BACK" && argc === 1)
279− this.back();
280− if (argv[0] === "FORWARD" && argc === 1)
281− this.forward();
282− if (argv[0] === "START" && argc === 1)
283− this.goStart();
284− if (argv[0] === "END" && argc === 1)
285− this.goEnd();
286− if (argv[0] === "TOGGLE_CONTENT" && argc === 1)
287− this.toggleContent();
288− if (argv[0] === "SET_CURSOR" && argc === 2)
289− window.location.hash = "#" + argv[1];
290− if (argv[0] === "GET_CURSOR" && argc === 1)
291− this.postMsg(win, "CURSOR", this.idx + "." + this.step);
292− if (argv[0] === "GET_NOTES" && argc === 1)
293− this.postMsg(win, "NOTES", this.getDetails(this.idx));
294− }
295−
296− Dz.toggleContent = function() {
297− // If a Video is present in this new slide, play it.
298− // If a Video is present in the previous slide, stop it.
299− var s = $$("section[aria-selected]");
300− if (s) {
301− var video = s.$$("video");
302− if (video) {
303− if (video.ended || video.paused) {
304− video.play();
305− } else {
306− video.pause();
307− }
308− }
309− }
310− }
311−
312− Dz.setCursor = function(aIdx, aStep) {
313− // If the user change the slide number in the URL bar, jump
314− // to this slide.
315− aStep = (aStep != 0 && typeof aStep !== "undefined") ? "." + aStep : ".0";
316− window.location.hash = "#" + aIdx + aStep;
317− }
318−
319− Dz.onhashchange = function() {
320− var cursor = window.location.hash.split("#"),
321− newidx = 1,
322− newstep = 0;
323− if (cursor.length == 2) {
324− newidx = ~~cursor[1].split(".")[0];
325− newstep = ~~cursor[1].split(".")[1];
326− if (newstep > Dz.slides[newidx - 1].$$$$('.incremental > *').length) {
327− newstep = 0;
328− newidx++;
329− }
330− }
331− if (newidx != this.idx) {
332− this.setSlide(newidx);
333− }
334− if (newstep != this.step) {
335− this.setIncremental(newstep);
336− }
337− for (var i = 0; i < this.remoteWindows.length; i++) {
338− this.postMsg(this.remoteWindows[i], "CURSOR", this.idx + "." + this.step);
339− }
340− }
341−
342− Dz.back = function() {
343− if (this.idx == 1 && this.step == 0) {
344− return;
345− }
346− if (this.step == 0) {
347− this.setCursor(this.idx - 1,
348− this.slides[this.idx - 2].$$$$('.incremental > *').length);
349− } else {
350− this.setCursor(this.idx, this.step - 1);
351− }
352− }
353−
354− Dz.forward = function() {
355− if (this.idx >= this.slides.length &&
356− this.step >= this.slides[this.idx - 1].$$$$('.incremental > *').length) {
357− return;
358− }
359− if (this.step >= this.slides[this.idx - 1].$$$$('.incremental > *').length) {
360− this.setCursor(this.idx + 1, 0);
361− } else {
362− this.setCursor(this.idx, this.step + 1);
363− }
364− }
365−
366− Dz.goStart = function() {
367− this.setCursor(1, 0);
368− }
369−
370− Dz.goEnd = function() {
371− var lastIdx = this.slides.length;
372− var lastStep = this.slides[lastIdx - 1].$$$$('.incremental > *').length;
373− this.setCursor(lastIdx, lastStep);
374− }
375−
376− Dz.setSlide = function(aIdx) {
377− this.idx = aIdx;
378− var old = $$("section[aria-selected]");
379− var next = $$("section:nth-of-type("+ this.idx +")");
380− if (old) {
381− old.removeAttribute("aria-selected");
382− var video = old.$$("video");
383− if (video) {
384− video.pause();
385− }
386− }
387− if (next) {
388− next.setAttribute("aria-selected", "true");
389− var video = next.$$("video");
390− if (video && !!+this.params.autoplay) {
391− video.play();
392− }
393− } else {
394− // That should not happen
395− this.idx = -1;
396− // console.warn("Slide doesn't exist.");
397− }
398− }
399−
400− Dz.setIncremental = function(aStep) {
401− this.step = aStep;
402− var old = this.slides[this.idx - 1].$$('.incremental > *[aria-selected]');
403− if (old) {
404− old.removeAttribute('aria-selected');
405− }
406− var incrementals = this.slides[this.idx - 1].$$$$('.incremental');
407− if (this.step <= 0) {
408− incrementals.forEach(function(aNode) {
409− aNode.removeAttribute('active');
410− });
411− return;
412− }
413− var next = this.slides[this.idx - 1].$$$$('.incremental > *')[this.step - 1];
414− if (next) {
415− next.setAttribute('aria-selected', true);
416− next.parentNode.setAttribute('active', true);
417− var found = false;
418− incrementals.forEach(function(aNode) {
419− if (aNode != next.parentNode)
420− if (found)
421− aNode.removeAttribute('active');
422− else
423− aNode.setAttribute('active', true);
424− else
425− found = true;
426− });
427− } else {
428− setCursor(this.idx, 0);
429− }
430− return next;
431− }
432−
433− Dz.postMsg = function(aWin, aMsg) { // [arg0, [arg1...]]
434− aMsg = [aMsg];
435− for (var i = 2; i < arguments.length; i++)
436− aMsg.push(encodeURIComponent(arguments[i]));
437− aWin.postMessage(aMsg.join(" "), "*");
438− }
439−
440− window.onload = Dz.init.bind(Dz);
441− window.onkeydown = Dz.onkeydown.bind(Dz);
442− window.onresize = Dz.onresize.bind(Dz);
443− window.onhashchange = Dz.onhashchange.bind(Dz);
444− window.onmessage = Dz.onmessage.bind(Dz);
445−</script>
446−
447−
448−<script> // Helpers
449− if (!Function.prototype.bind) {
450− Function.prototype.bind = function (oThis) {
451−
452− // closest thing possible to the ECMAScript 5 internal IsCallable
453− // function
454− if (typeof this !== "function")
455− throw new TypeError(
456− "Function.prototype.bind - what is trying to be fBound is not callable"
457− );
458−
459− var aArgs = Array.prototype.slice.call(arguments, 1),
460− fToBind = this,
461− fNOP = function () {},
462− fBound = function () {
463− return fToBind.apply( this instanceof fNOP ? this : oThis || window,
464− aArgs.concat(Array.prototype.slice.call(arguments)));
465− };
466−
467− fNOP.prototype = this.prototype;
468− fBound.prototype = new fNOP();
469−
470− return fBound;
471− };
472− }
473−
474− var $$ = (HTMLElement.prototype.$$ = function(aQuery) {
475− return this.querySelector(aQuery);
476− }).bind(document);
477−
478− var $$$$ = (HTMLElement.prototype.$$$$ = function(aQuery) {
479− return this.querySelectorAll(aQuery);
480− }).bind(document);
481−
482− NodeList.prototype.forEach = function(fun) {
483− if (typeof fun !== "function") throw new TypeError();
484− for (var i = 0; i < this.length; i++) {
485− fun.call(this, this[i]);
486− }
487− }
488−
489−</script>
490−
114+$dzslides-core$
491115</body>
492116</html>