-
Notifications
You must be signed in to change notification settings - Fork 0
/
jmpress.allplugins.min.js
7 lines (7 loc) · 5.44 KB
/
jmpress.allplugins.min.js
1
2
3
4
5
6
7
/*!
* plugin for jmpress.js v0.4.5
*
* Copyright 2014 Kyle Robinson Young @shama & Tobias Koppers @sokra
* Licensed MIT
* http://www.opensource.org/licenses/mit-license.php
*/!function(a,b){"use strict";a.jmpress("register","toggle",function(c,d,e){var f=this;a(b).bind("keydown",function(b){b.keyCode===c&&(a(f).jmpress("initialized")?a(f).jmpress("deinit"):a(f).jmpress(d))}),e&&a(f).jmpress(d)})}(jQuery,document,window),function(a){"use strict";function b(b,c,d){if(b.secondary&&-1!==b.secondary.split(" ").indexOf(c)){for(var e in b)if(e.length>9&&0===e.indexOf("secondary")){var f=b[e],g=e.substr(9);g=g.substr(0,1).toLowerCase()+g.substr(1),b[e]=b[g],b[g]=f}a(this).jmpress("reapply",a(d))}}a.jmpress("initStep",function(a,b){for(var c in b.data)0===c.indexOf("secondary")&&(b.stepData[c]=b.data[c])}),a.jmpress("beforeActive",function(c,d){b.call(d.jmpress,a(c).data("stepData"),"self",c);var e=a(c).parent();a(e).children(d.settings.stepSelector).each(function(c,e){var f=a(e).data("stepData");b.call(d.jmpress,f,"siblings",e)});for(var f=1;f<d.parents.length;f++)a(d.parents[f]).children(d.settings.stepSelector).each()}),a.jmpress("setInactive",function(c,d){function e(c,e){var f=a(e).data("stepData");b.call(d.jmpress,f,"grandchildren",e)}b.call(d.jmpress,a(c).data("stepData"),"self",c);var f=a(c).parent();a(f).children(d.settings.stepSelector).each(function(c,e){var f=a(e).data("stepData");b.call(d.jmpress,f,"siblings",e)});for(var g=1;g<d.parents.length;g++)a(d.parents[g]).children(d.settings.stepSelector).each(e)})}(jQuery,document,window),function(a,b,c,d){"use strict";a.jmpress("defaults").duration={defaultValue:-1,defaultAction:"next",barSelector:d,barProperty:"width",barPropertyStart:"0",barPropertyEnd:"100%"},a.jmpress("initStep",function(a,b){b.stepData.duration=b.data.duration&&parseInt(b.data.duration,10),b.stepData.durationAction=b.data.durationAction}),a.jmpress("setInactive",function(b,c){var d=c.settings,e=d.duration,f=c.current;if(c.stepData.duration||e.defaultValue,f.durationTimeout){if(e.barSelector){var g={transitionProperty:e.barProperty,transitionDuration:"0",transitionDelay:"0",transitionTimingFunction:"linear"};g[e.barProperty]=e.barPropertyStart;var h=a(e.barSelector);a.jmpress("css",h,g),h.each(function(b,c){var d=a(c).next(),e=a(c).parent();a(c).detach(),d.length?d.insertBefore(c):e.append(c)})}clearTimeout(f.durationTimeout),delete f.durationTimeout}}),a.jmpress("setActive",function(b,c){var e=c.settings,f=e.duration,g=c.current,h=c.stepData.duration||f.defaultValue;if(h&&h>0){if(f.barSelector){var i={transitionProperty:f.barProperty,transitionDuration:h-2*e.transitionDuration/3-100+"ms",transitionDelay:2*e.transitionDuration/3+"ms",transitionTimingFunction:"linear"};i[f.barProperty]=f.barPropertyEnd,a.jmpress("css",a(f.barSelector),i)}var j=this;g.durationTimeout&&(clearTimeout(g.durationTimeout),g.durationTimeout=d),g.durationTimeout=setTimeout(function(){var b=c.stepData.durationAction||f.defaultAction;a(j).jmpress(b)},h)}})}(jQuery,document,window),function(a,b,c){"use strict";var d=a.jmpress,e="jmpress-presentation-";d("defaults").presentationMode={use:!0,url:"presentation-screen.html",notesUrl:!1,transferredValues:["userZoom","userTranslateX","userTranslateY"]},d("defaults").keyboard.keys[80]="presentationPopup",d("afterInit",function(b,d){var f=d.current;if(f.selectMessageListeners=[],d.settings.presentationMode.use){c.addEventListener("message",function(b){try{if("string"!=typeof b.data||0!==b.data.indexOf(e))return;var g=JSON.parse(b.data.slice(e.length));switch(g.type){case"select":a.each(d.settings.presentationMode.transferredValues,function(a,b){d.current[b]=g[b]}),/[a-z0-9\-]+/i.test(g.targetId)&&typeof g.substep in{number:1,undefined:1}?a(d.jmpress).jmpress("select",{step:"#"+g.targetId,substep:g.substep},g.reason):a.error("For security reasons the targetId must match /[a-z0-9\\-]+/i and substep must be a number.");break;case"listen":f.selectMessageListeners.push(b.source);break;case"ok":clearTimeout(f.presentationPopupTimeout);break;case"read":try{b.source.postMessage(e+JSON.stringify({type:"url",url:c.location.href,notesUrl:d.settings.presentationMode.notesUrl}),"*")}catch(h){a.error("Cannot post message to source: "+h)}break;default:throw"Unknown message type: "+g.type}}catch(h){a.error("Received message is malformed: "+h)}});try{c.parent&&c.parent!==c&&c.parent.postMessage(e+JSON.stringify({type:"afterInit"}),"*")}catch(g){a.error("Cannot post message to parent: "+g)}}}),d("afterDeinit",function(b,d){if(d.settings.presentationMode.use)try{c.parent&&c.parent!==c&&c.parent.postMessage(e+JSON.stringify({type:"afterDeinit"}),"*")}catch(f){a.error("Cannot post message to parent: "+f)}}),d("setActive",function(b,c){var d=a(c.delegatedFrom).attr("id"),f=c.substep,g=c.reason;a.each(c.current.selectMessageListeners,function(b,h){try{var i={type:"select",targetId:d,substep:f,reason:g};a.each(c.settings.presentationMode.transferredValues,function(a,b){i[b]=c.current[b]}),h.postMessage(e+JSON.stringify(i),"*")}catch(j){a.error("Cannot post message to listener: "+j)}})}),d("register","presentationPopup",function(){function b(){f.jmpress("current").presentationPopupTimeout=setTimeout(b,100);try{d.postMessage(e+JSON.stringify({type:"url",url:c.location.href,notesUrl:f.jmpress("settings").presentationMode.notesUrl}),"*")}catch(a){}}var d,f=a(this);f.jmpress("settings").presentationMode.use&&(d=c.open(a(this).jmpress("settings").presentationMode.url),f.jmpress("current").presentationPopupTimeout=setTimeout(b,100))})}(jQuery,document,window);