tubestats-presentation/dist/plugin/zoom.js

11 lines
4.5 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=6)}({6:function(e,t,o){"use strict";o.r(t);
/*!
* reveal.js Zoom plugin
*/var n={id:"zoom",init:function(e){e.getRevealElement().addEventListener("mousedown",(function(t){var o=/Linux/.test(window.navigator.platform)?"ctrl":"alt",n=(e.getConfig().zoomKey?e.getConfig().zoomKey:o)+"Key",r=e.getConfig().zoomLevel?e.getConfig().zoomLevel:2;t[n]&&!e.isOverview()&&(t.preventDefault(),i.to({x:t.clientX,y:t.clientY,scale:r,pan:!1}))}))}},i=function(){var e=1,t=0,o=0,n=-1,r=-1,d="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style;function s(t,o){var n=u();if(t.width=t.width||1,t.height=t.height||1,t.x-=(window.innerWidth-t.width*o)/2,t.y-=(window.innerHeight-t.height*o)/2,d)if(1===o)document.body.style.transform="",document.body.style.OTransform="",document.body.style.msTransform="",document.body.style.MozTransform="",document.body.style.WebkitTransform="";else{var i=n.x+"px "+n.y+"px",r="translate("+-t.x+"px,"+-t.y+"px) scale("+o+")";document.body.style.transformOrigin=i,document.body.style.OTransformOrigin=i,document.body.style.msTransformOrigin=i,document.body.style.MozTransformOrigin=i,document.body.style.WebkitTransformOrigin=i,document.body.style.transform=r,document.body.style.OTransform=r,document.body.style.msTransform=r,document.body.style.MozTransform=r,document.body.style.WebkitTransform=r}else 1===o?(document.body.style.position="",document.body.style.left="",document.body.style.top="",document.body.style.width="",document.body.style.height="",document.body.style.zoom=""):(document.body.style.position="relative",document.body.style.left=-(n.x+t.x)/o+"px",document.body.style.top=-(n.y+t.y)/o+"px",document.body.style.width=100*o+"%",document.body.style.height=100*o+"%",document.body.style.zoom=o);e=o,document.documentElement.classList&&(1!==e?document.documentElement.classList.add("zoomed"):document.documentElement.classList.remove("zoomed"))}function l(){var n=.12*window.innerWidth,i=.12*window.innerHeight,r=u();o<i?window.scroll(r.x,r.y-14/e*(1-o/i)):o>window.innerHeight-i&&window.scroll(r.x,r.y+(1-(window.innerHeight-o)/i)*(14/e)),t<n?window.scroll(r.x-14/e*(1-t/n),r.y):t>window.innerWidth-n&&window.scroll(r.x+(1-(window.innerWidth-t)/n)*(14/e),r.y)}function u(){return{x:void 0!==window.scrollX?window.scrollX:window.pageXOffset,y:void 0!==window.scrollY?window.scrollY:window.pageYOffset}}return d&&(document.body.style.transition="transform 0.8s ease",document.body.style.OTransition="-o-transform 0.8s ease",document.body.style.msTransition="-ms-transform 0.8s ease",document.body.style.MozTransition="-moz-transform 0.8s ease",document.body.style.WebkitTransition="-webkit-transform 0.8s ease"),document.addEventListener("keyup",(function(t){1!==e&&27===t.keyCode&&i.out()})),document.addEventListener("mousemove",(function(n){1!==e&&(t=n.clientX,o=n.clientY)})),{to:function(t){if(1!==e)i.out();else{if(t.x=t.x||0,t.y=t.y||0,t.element){var o=t.element.getBoundingClientRect();t.x=o.left-20,t.y=o.top-20,t.width=o.width+40,t.height=o.height+40}void 0!==t.width&&void 0!==t.height&&(t.scale=Math.max(Math.min(window.innerWidth/t.width,window.innerHeight/t.height),1)),t.scale>1&&(t.x*=t.scale,t.y*=t.scale,s(t,t.scale),!1!==t.pan&&(n=setTimeout((function(){r=setInterval(l,1e3/60)}),800)))}},out:function(){clearTimeout(n),clearInterval(r),s({x:0,y:0},1),e=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return e}}}();
/*!
* zoom.js 0.3 (modified for use with reveal.js)
* http://lab.hakim.se/zoom-js
* MIT licensed
*
* Copyright (C) 2011-2014 Hakim El Hattab, http://hakim.se
*/Reveal.registerPlugin(n)}});