wordpress/php-fpm/wordpress_files/plugins/pdf-embedder/js/all-pdfemb-basic.min.js

1 line
19 KiB
JavaScript
Raw Normal View History

2020-05-22 03:40:23 +02:00
var pdfembGrabToPan=function(){function e(e){this.element=e.element,this.document=e.element.ownerDocument,"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget),this.onActiveChanged=e.onActiveChanged,this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.toggle=this.toggle.bind(this),this._onmousedown=this._onmousedown.bind(this),this._onmousemove=this._onmousemove.bind(this),this._onmousewheel=this._onmousewheel.bind(this),this._endPan=this._endPan.bind(this),(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}var t;e.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.addEventListener("mousewheel",this._onmousewheel),this.element.addEventListener("wheel",this._onmousewheel),this.element.addEventListener("DOMMouseScroll",this._onmousewheel),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged)&&this.onActiveChanged(!0)},deactivate:function(){this.active&&(this.active=!1,this.element.removeEventListener("mousedown",this._onmousedown,!0),this._endPan(),this.element.classList.remove(this.CSS_CLASS_GRAB),this.onActiveChanged)&&this.onActiveChanged(!1)},toggle:function(){this.active?this.deactivate():this.activate()},ignoreTarget:function(e){return e[t]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(e){if(0===e.button&&!this.ignoreTarget(e.target)){this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,this.clientXStart=e.clientX,this.clientYStart=e.clientY,this.document.addEventListener("mousemove",this._onmousemove,!0),this.document.addEventListener("mouseup",this._endPan,!0),this.element.addEventListener("scroll",this._endPan,!0),e.preventDefault(),e.stopPropagation(),this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var t=document.activeElement;t&&!t.contains(e.target)&&t.blur()}},_onmousemove:function(e){var t;this.element.removeEventListener("scroll",this._endPan,!0),(t="buttons"in e&&n?!(1|e.buttons):i||o?0===e.which:void 0)?this._endPan():(t=e.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(e.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-t,this.overlay.parentNode||document.body.appendChild(this.overlay))},_onmousewheel:function(e){this.element.removeEventListener("scroll",this._endPan,!0);var t=.5;e.deltaMode&&(1==e.deltaMode&&(t=10),2==e.deltaMode&&(t=1e3));var n=e.deltaY?-e.deltaY:e.wheelDelta?e.wheelDelta:-e.detail;if(this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,t*=n,this.element.scrollTop=this.scrollTopStart-t,this.overlay.parentNode||document.body.appendChild(this.overlay),this.element.scrollTop!=this.scrollTopStart||0==t)return e.preventDefault(),!1},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0),this.document.removeEventListener("mousemove",this._onmousemove,!0),this.document.removeEventListener("mouseup",this._endPan,!0),this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}},["webkitM","mozM","msM","oM","m"].some(function(e){return(e+="atches")in document.documentElement&&(t=e),(e+="Selector")in document.documentElement&&(t=e),t});var n=!document.documentMode||9<document.documentMode,a=window.chrome,i=a&&(a.webstore||a.app),o=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return e}(),PDFEMB_NS={};jQuery(document).ready(function(e){var t,n=(t=document.createElement("canvas").getContext("2d"),(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1));PDFEMB_NS.PIXEL_RATIO=n,createHiDPICanvas=function(e,t,a){a||(a=n);var i=document.createElement("canvas");return i.width=e*a,i.height=t*a,i.style.width=e+"px",i.style.height=t+"px",i.getContext("2d").setTransform(a,0,0,a,0,0),i};var a=0,i=0;!function(){var e=docu