PDF Embedder - Version 4.0

Version Description

Download this release

Release Info

Developer levertechadmin
Plugin Icon 128x128 PDF Embedder
Version 4.0
Comparing to
See all releases

Code changes from version 3.2 to 4.0

Files changed (4) hide show
  1. js/all-pdfemb-basic.min.js +38 -53
  2. js/pdfemb-blocks.js +12 -10
  3. pdf_embedder.php +2 -2
  4. readme.txt +5 -5
js/all-pdfemb-basic.min.js CHANGED
@@ -1,53 +1,38 @@
1
- var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,f,g){d!=Array.prototype&&d!=Object.prototype&&(d[f]=g.value)};$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
2
- $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var d=0;return function(f){return $jscomp.SYMBOL_PREFIX+(f||"")+d++}}();
3
- $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var d=$jscomp.global.Symbol.iterator;d||(d=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&$jscomp.defineProperty(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};
4
- $jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var d=$jscomp.global.Symbol.asyncIterator;d||(d=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.arrayIterator=function(d){var f=0;return $jscomp.iteratorPrototype(function(){return f<d.length?{done:!1,value:d[f++]}:{done:!0}})};
5
- $jscomp.iteratorPrototype=function(d){$jscomp.initSymbolIterator();d={next:d};d[$jscomp.global.Symbol.iterator]=function(){return this};return d};$jscomp.makeIterator=function(d){$jscomp.initSymbolIterator();var f=d[Symbol.iterator];return f?f.call(d):$jscomp.arrayIterator(d)};
6
- $jscomp.polyfill=function(d,f,g,k){if(f){g=$jscomp.global;d=d.split(".");for(k=0;k<d.length-1;k++){var e=d[k];e in g||(g[e]={});g=g[e]}d=d[d.length-1];k=g[d];f=f(k);f!=k&&null!=f&&$jscomp.defineProperty(g,d,{configurable:!0,writable:!0,value:f})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
7
- $jscomp.polyfill("Promise",function(d){function f(){this.batch_=null}function g(a){return a instanceof e?a:new e(function(c,b){c(a)})}if(d&&!$jscomp.FORCE_POLYFILL_PROMISE)return d;f.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};f.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var k=$jscomp.global.setTimeout;f.prototype.asyncExecuteFunction=function(a){k(a,
8
- 0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var c=0;c<a.length;++c){var b=a[c];a[c]=null;try{b()}catch(q){this.asyncThrow_(q)}}}this.batch_=null};f.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var e=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var c=this.createResolveAndReject_();try{a(c.resolve,c.reject)}catch(m){c.reject(m)}};e.prototype.createResolveAndReject_=
9
- function(){function a(a){return function(d){b||(b=!0,a.call(c,d))}}var c=this,b=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};e.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof e)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var c=null!=a;break a;case "function":c=!0;break a;default:c=!1}c?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};e.prototype.resolveToNonPromiseObj_=function(a){var c=
10
- void 0;try{c=a.then}catch(m){this.reject_(m);return}"function"==typeof c?this.settleSameAsThenable_(c,a):this.fulfill_(a)};e.prototype.reject_=function(a){this.settle_(2,a)};e.prototype.fulfill_=function(a){this.settle_(1,a)};e.prototype.settle_=function(a,c){if(0!=this.state_)throw Error("Cannot settle("+a+", "+c+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=c;this.executeOnSettledCallbacks_()};e.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
11
- 0;a<this.onSettledCallbacks_.length;++a)b.asyncExecute(this.onSettledCallbacks_[a]);this.onSettledCallbacks_=null}};var b=new f;e.prototype.settleSameAsPromise_=function(a){var c=this.createResolveAndReject_();a.callWhenSettled_(c.resolve,c.reject)};e.prototype.settleSameAsThenable_=function(a,c){var b=this.createResolveAndReject_();try{a.call(c,b.resolve,b.reject)}catch(q){b.reject(q)}};e.prototype.then=function(a,c){function b(a,c){return"function"==typeof a?function(c){try{d(a(c))}catch(n){l(n)}}:
12
- c}var d,l,f=new e(function(a,c){d=a;l=c});this.callWhenSettled_(b(a,d),b(c,l));return f};e.prototype.catch=function(a){return this.then(void 0,a)};e.prototype.callWhenSettled_=function(a,c){function d(){switch(e.state_){case 1:a(e.result_);break;case 2:c(e.result_);break;default:throw Error("Unexpected state: "+e.state_);}}var e=this;null==this.onSettledCallbacks_?b.asyncExecute(d):this.onSettledCallbacks_.push(d)};e.resolve=g;e.reject=function(a){return new e(function(c,b){b(a)})};e.race=function(a){return new e(function(c,
13
- b){for(var d=$jscomp.makeIterator(a),e=d.next();!e.done;e=d.next())g(e.value).callWhenSettled_(c,b)})};e.all=function(a){var c=$jscomp.makeIterator(a),b=c.next();return b.done?g([]):new e(function(a,d){function e(b){return function(c){h[b]=c;f--;0==f&&a(h)}}var h=[],f=0;do h.push(void 0),f++,g(b.value).callWhenSettled_(e(h.length-1),d),b=c.next();while(!b.done)})};return e},"es6","es3");
14
- $jscomp.findInternal=function(d,f,g){d instanceof String&&(d=String(d));for(var k=d.length,e=0;e<k;e++){var b=d[e];if(f.call(g,b,e,d))return{i:e,v:b}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,g){return $jscomp.findInternal(this,d,g).v}},"es6","es3");
15
- var pdfembGrabToPan=function(){function d(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.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);
16
- (this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}d.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!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)},
17
- deactivate:function(){if(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(a){return a[f]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(0===a.button&&!this.ignoreTarget(a.target)){this.scrollLeftStart=
18
- this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var b=document.activeElement;b&&!b.contains(a.target)&&b.blur()}},_onmousemove:function(a){this.element.removeEventListener("scroll",
19
- this._endPan,!0);var c="buttons"in a&&g?!(a.buttons|1):e||b?0===a.which:void 0;c?this._endPan():(c=a.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(a.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-c,this.overlay.parentNode||document.body.appendChild(this.overlay))},_onmousewheel:function(a){this.element.removeEventListener("scroll",this._endPan,!0);var b=.5;a.deltaMode&&(1==a.deltaMode&&(b=10),2==a.deltaMode&&(b=1E3));var d=a.deltaY?-a.deltaY:a.wheelDelta?
20
- a.wheelDelta:-a.detail;this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;b*=d;this.element.scrollTop=this.scrollTopStart-b;this.overlay.parentNode||document.body.appendChild(this.overlay);if(this.element.scrollTop!=this.scrollTopStart||0==b)return a.preventDefault(),!1},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,
21
- !0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var f;["webkitM","mozM","msM","oM","m"].some(function(a){a+="atches";a in document.documentElement&&(f=a);a+="Selector";a in document.documentElement&&(f=a);return f});var g=!document.documentMode||9<document.documentMode,k=window.chrome,e=k&&(k.webstore||k.app),b=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return d}(),PDFEMB_NS={};
22
- jQuery(document).ready(function(d){var f=function(){var b=document.createElement("canvas").getContext("2d");return(window.devicePixelRatio||1)/(b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1)}();PDFEMB_NS.PIXEL_RATIO=f;createHiDPICanvas=function(b,a,c){c||(c=f);var d=document.createElement("canvas");d.width=b*c;d.height=a*c;d.style.width=b+"px";d.style.height=a+"px";d.getContext("2d").setTransform(c,0,
23
- 0,c,0,0);return d};var g=0,k=0;(function(){var b=document.createElement("div");b.style.width="100px";b.style.height="100px";b.style.overflow="scroll";b.style.position="absolute";b.style.top="-9999px";document.body.appendChild(b);g=b.offsetWidth-b.clientWidth;k=b.offsetHeight-b.clientHeight;document.body.removeChild(b)})();PDFEMB_NS.vscrollbarwidth=g;PDFEMB_NS.hscrollbarheight=k;var e=function(b,a,c){this.pdfDoc=b;this.divContainer=a;this.showIsSecure=c;this.initialResize=!1;this.firstPageHeight=this.firstPageWidth=
24
- 0;this.invalidationRound=1;this.currentPageNum=0;this.zoom=100;this.toZoom=this.fromZoom=0};e.prototype.setup=function(){var b=this,a=this.divContainer,c=this.pdfDoc,e=this.showIsSecure;this.numPages=c.numPages;var f=a.data("scrollbar");this.vscrollbar="both"==f||"vertical"==f;this.hscrollbar="both"==f||"horizontal"==f;f="overflow-y: "+(this.vscrollbar?"scroll":"hidden")+"; ";f+="overflow-x: "+(this.hscrollbar?"scroll":"hidden")+"; ";a.empty().append(d("<div></div>",{"class":"pdfemb-pagescontainer",
25
- style:f}));a.data("pdfDoc",c);f=a.data("toolbar");"top"!=f&&"both"!=f||this.addToolbar(!0,"on"==a.data("toolbar-fixed"),e);"bottom"!=f&&"both"!=f||this.addToolbar(!1,"on"==a.data("toolbar-fixed"),e);b.annotationsLayerFactory="undefined"!=typeof PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory?new PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,b){return null}};b.annotationLayerFactories=[];b.textLayerFactory="undefined"!=typeof PDFEMB_NS.pdfembPremiumTextLayerFactory?
26
- new PDFEMB_NS.pdfembPremiumTextLayerFactory:{createTextLayerBuilder:function(a,b){return null}};b.textLayerFactories=[];a.on("pdfembGotopage",function(a,c){c>this.numPages||0>=c||(b.gotoPage(c),b.jumpToTop())});a.on("pdfembGotoHash",function(a,c){c.dest&&(dest=c.dest,"string"===typeof dest?(destString=dest,a=b.pdfDoc.getDestination(dest)):a=Promise.resolve(dest),a.then(function(a){a instanceof Array&&!(1>a.length)&&b.pdfDoc.getPageIndex(a[0]).then(function(a){a+=1;a>b.numPages||0>=a||b.currentPageNum==
27
- a||(b.gotoPage(a),b.jumpToTop())})}))});a.on("pdfembGotoAction",function(a,c){var d=a=b.currentPageNum;switch(c){case "GoBack":--d;break;case "GoForward":++d;break;case "NextPage":++d;break;case "PrevPage":--d;break;case "LastPage":d=b.pageCount;break;case "FirstPage":d=1}d==a||d>b.pageCount||0>=d||b.gotoPage(d)});a.on("pdfembMagnify",function(a){b.magnifyEvent(a)});a.on("pdfembChangeZoom",function(a,c){b.changeZoom(c)});this.pageCount=c.numPages;(!a.data("pagenum")||1>a.data("pagenum")||a.data("pagenum")>
28
- this.pageCount)&&a.data("pagenum",1);a.data("showIsSecure",this.showIsSecure);a.data("pageNumPending",null);c="on"==a.data("fullScreen")?parseInt(a.data("startfpzoom")):parseInt(a.data("startzoom"));if(isNaN(c)||20>c||500<c)c=100;this.zoom=c;100!=c&&a.find("span.pdfemb-zoom").text(c+"%");a.find("span.pdfemb-page-count").text(this.pageCount);this.gotoPage(a.data("pagenum"))};e.prototype.checkForResize=function(){var b=this,a=b.divContainer,c=d(window).height(),e=d(window).width(),f=a.data("checked-window-height"),
29
- l=a.data("checked-window-width");f&&l||(a.data("checked-window-height",c),a.data("checked-window-width",e));if(f!=c||l!=e)b.resizeViewer(),b.resizeInnerDivs(),b.invalidateAllPages(),b.renderPage(this.currentPageNum),b.prerenderNearbyPages(this.currentPageNum),b.pdfembMakeMobile(),a.data("checked-window-height",c),a.data("checked-window-width",e);"true"!=a.data("fullScreenClosed")&&setTimeout(function(){b.checkForResize()},100)};e.prototype.setSizesBasedOnPage=function(b){b=b.getViewport(1);this.pageWidth=
30
- b.width;this.pageHeight=b.height;(0>=this.pageWidth||0>=this.pageHeight)&&this.divContainer.empty().append(document.createTextNode(pdfemb_trans.objectL10n.widthheightinvalid))};e.prototype.createPageInnerDivs=function(){for(var b=this.divContainer.find(".pdfemb-pagescontainer"),a=1;a<=this.pageCount;++a){var c=b.find(".pdfemb-inner-div.pdfemb-page"+a);0==c.length&&(c=d("<div></div>",{"class":"pdfemb-inner-div pdfemb-page"+a}),c.data("pageNum",a),b.append(c))}this.resizeInnerDivs()};e.prototype.addGrabToPan=
31
- function(){var b=this,a=b.divContainer,c=a.find("div.pdfemb-pagescontainer"),e=new pdfembGrabToPan({element:c[0]});a.data("grabtopan",e);c.on("scroll",function(a){var c=b.getTopVisiblePageNum();c!=b.currentPageNum&&(b.currentPageNum=c,b.updatePageNumDisplay(c),b.renderPage(c,!1),b.prerenderNearbyPages(c),b.deallocateFarAwayPages(c));a.stopPropagation()});d(window).resize(function(){setTimeout(function(){b.checkForResize()},100)})};e.prototype.resizeInnerDivs=function(b){var a=this,c=a.wantCanvasWidth,
32
- e=a.wantCanvasHeight,f=a.wantHeight,l=this.divContainer.find(".pdfemb-pagescontainer").find(".pdfemb-inner-div");b&&(l=l.filter(".pdfemb-page"+b));var k=0;l.each(function(f,h){var m=d(h);h=m.data("widthfactor");var g=m.data("heightfactor");h||(h=1);g||(g=1);m.data("invalidation-round",this.invalidationRound-1);m.css("width",c*h);f=e*g+(b==a.numPages||!b&&f==l.length-1?0:2);m.css("height",f);k+=f;f=m.find(".pdfemb-the-canvas");f.css("width",c*h);f.css("height",e*g)});var h=0;!b&&k<f&&(h=(f-k)/2);l.first().css("top",
33
- h)};e.prototype.invalidateAllPages=function(){++this.invalidationRound};e.prototype.prerenderNearbyPages=function(b){var a=3,c=2;100>this.zoom&&(a*=Math.min(Math.ceil(100/this.zoom),10),c*=Math.min(Math.ceil(100/this.zoom),10));for(c=Math.max(1,b-c);c<=Math.min(b+a,this.numPages);++c)c!=b&&this.renderPage(c,!1)};e.prototype.deallocateFarAwayPages=function(b){var a=50,c=50;if(100>this.zoom){var d=Math.min(Math.ceil(100/this.zoom),50);a+=d;c+=d}d=function(a){a=f.find(".pdfemb-page"+a);var b=a.find(".pdfemb-the-canvas");
34
- b.length&&(b.remove(),a.data("invalidation-round",0))};var f=this.divContainer.find("div.pdfemb-pagescontainer"),e;for(e=3;e<b-c;++e)d(e);for(e=b+a;e<this.numPages;++e)d(e)};e.prototype.resizeViewer=function(){var b=this.pageWidth,a=this.pageHeight,c=this.divContainer,d=c.find("div.pdfemb-pagescontainer"),e=d[0].scrollLeft,l=d[0].scrollTop,p=c.parent().width();if("max"==c.data("width"))var h=p;else if("auto"==c.data("width"))h=b;else if(h=parseInt(c.data("width"),10),isNaN(h)||0>=h)h=p;0>=h&&(h=b);
35
- h>p&&0<p&&(h=p);a=a*h/b;var r=this.pdfembWantMobile(h,u);this.wantMobile=r;var t=c.find("div.pdfemb-toolbar-fixed"),n=r?0:t.length,u=parseInt(c.data("height"),10);if(isNaN(u)||0>=u||u>a)u="auto"==c.data("height")?c.parent().height()-n*t.height():a;this.userHeight=u;h=Math.floor(h);a=Math.floor(a);p=100;var v=h-(this.vscrollbar?g:0),w=a-(this.hscrollbar?k:0),B=1;r||(p=this.zoom,v=v*p/100,w=w*p/100,16777E3<v*w*f*f&&(B=16777E3/(v*w*f*f)));h!=c.width()&&c.width(h);c.height()!=u&&c.height(u+n*t.height());
36
- d.width(h);d.height(u);c=t.filter(".pdfemb-toolbar-top");0<n&&d.css("top",c.height());b=(h-(this.vscrollbar?g:0))/b;0!=this.fromZoom&&0!=this.toZoom&&(d[0].scrollLeft=this.toZoom/this.fromZoom*(e+this.pccentreLeft)-this.pccentreLeft,d[0].scrollTop=this.toZoom/this.fromZoom*(l+this.pccentreTop)-this.pccentreTop);this.toZoom=this.fromZoom=0;this.wantCanvasWidth=v;this.wantCanvasHeight=w;this.reducefactor=B;this.wantWidth=h;this.wantHeight=a;this.canvasscale=b;this.zoom=p};e.prototype.getTopVisiblePageNum=
37
- function(){var b=this.divContainer.find(".pdfemb-pagescontainer").find(".pdfemb-inner-div:visible");return 0<b.length?b.first().data("pageNum"):1};e.prototype.gotoPage=function(b){0>=b||b>this.pageCount||(this.renderPage(b,!0),this.currentPageNum=b,this.updatePageNumDisplay(b),this.prerenderNearbyPages(b),this.deallocateFarAwayPages(b))};e.prototype.updatePageNumDisplay=function(b){var a=this.divContainer;a.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(a,e){a=d(e);a.is("span")?a.text(b):
38
- a.val(b)});b<this.pageCount?a.find(".pdfemb-next").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-next").attr("disabled","disabled").addClass("pdfemb-btndisabled");1<b?a.find(".pdfemb-prev").removeAttr("disabled").removeClass("pdfemb-btndisabled"):a.find(".pdfemb-prev").attr("disabled","disabled").addClass("pdfemb-btndisabled")};e.prototype.scrollPageIntoView=function(b){var a=this.divContainer.find(".pdfemb-pagescontainer"),c=a.find(".pdfemb-page"+b);a.find(".pdfemb-inner-div").not(".pdfemb-page"+
39
- b).hide();c.show();a[0].scrollTop=0};e.prototype.renderPage=function(b,a){var c=this,e=c.invalidationRound,k=this.divContainer,g=k.data("pdfDoc"),p=k.find(".pdfemb-pagescontainer"),h=p.find(".pdfemb-page"+b);if(h.length&&h.data("invalidation-round")>=e)a&&c.scrollPageIntoView(b);else{var r=h.data("pending-drawing-round");r>=e||(0<r&&r<e?h.data("pending-drawing-round",e):(h.data("pending-drawing-round",e),g.getPage(b).then(function(g){c.initialResize||(c.initialResize=!0,c.setSizesBasedOnPage(g),c.resizeViewer(),
40
- c.createPageInnerDivs(),c.addGrabToPan(),c.pdfembMakeMobile());0==h.length&&(h=p.find(".pdfemb-page"+b));var n=h.data("widthfactor"),l=h.data("heightfactor");if(!n||!l){var m=g.getViewport(1);n=m.width/c.pageWidth;l=m.height/c.pageHeight;h.data("widthfactor",n);h.data("heightfactor",l);1==n&&1==l||c.resizeInnerDivs(b)}var q=h.find(".pdfemb-the-canvas");0==q.length&&(q=d("<canvas></canvas>",{"class":"pdfemb-the-canvas"}),h.append(q));a&&c.scrollPageIntoView(b);var t=c.wantCanvasWidth,y=c.wantCanvasHeight;
41
- m=c.canvasscale;var C=c.zoom;q.css("width",t*n);q.css("height",y*l);c.wantMobile?k.data("grabtopan").deactivate():k.data("grabtopan").activate();var z=g.getViewport(m*C/100),x=document.createElement("canvas");x.width=t*f*c.reducefactor*n;x.height=y*f*c.reducefactor*l;var A=x.getContext("2d"),D=function(){q[0].width=t*f*c.reducefactor*n;q[0].height=y*f*c.reducefactor*l;c.preRenderCanvas(A,b,C);var a=A.getImageData(0,0,x.width,x.height);q[0].getContext("2d").putImageData(a,0,0);"undefined"==typeof c.annotationLayerFactories[b]?
42
- (a=c.annotationsLayerFactory.createAnnotationsLayerBuilder(h[0],g),c.annotationLayerFactories[b]=a):a=c.annotationLayerFactories[b];null!=a&&a.setupAnnotations(z,c.divContainer.data("newwindow"));"undefined"==typeof c.textLayerFactories[b]?(a=c.textLayerFactory.createTextLayerBuilder(h[0],g),c.textLayerFactories[b]=a):a=c.textLayerFactories[b];null!=a&&a.setupText(z);h.data("invalidation-round",e);r=h.data("pending-drawing-round");h.data("pending-drawing-round","");r>e&&c.renderPage(b,!1)};g.render({canvasContext:A,
43
- viewport:z,transform:[f*c.reducefactor,0,0,f*c.reducefactor,0,0]}).promise.then(function(){"requestAnimationFrame"in window?window.requestAnimationFrame(D):setTimeout(D,1)})})))}};e.prototype.changeZoom=function(b){var a=this.divContainer,c=this.zoom;this.zoom=b=c+b;a.find("span.pdfemb-zoom").text(b+"%");this.fromZoom=c;this.toZoom=b;a=a.find(".pdfemb-pagescontainer");this.pccentreLeft=a.width()/2;this.pccentreTop=a.height()/2;this.resizeViewer();this.resizeInnerDivs();this.invalidateAllPages();this.renderPage(this.currentPageNum);
44
- this.prerenderNearbyPages(this.currentPageNum)};e.prototype.queueRenderPage=function(b,a){this.renderPage(b,a)};e.prototype.addToolbar=function(b,a,c){var e=this.divContainer,f=this,g=d("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(a?"-fixed":"-hover")+" "+(b?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),k=d('<button class="pdfemb-prev" title="'+pdfemb_trans.objectL10n.prev+'" type="button"></button>');g.append(k);var h=d('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+
45
- '" type="button"></button>');g.append(h);g.append(d('<div class="pdfemb-page-area">'+pdfemb_trans.objectL10n.page+' <span class="pdfemb-page-num">0</span> / <span class="pdfemb-page-count"></span></div>'));var r=d('<button class="pdfemb-zoomout" title="'+pdfemb_trans.objectL10n.zoomout+'" type="button"></button>');g.append(r);var t=d('<button class="pdfemb-zoomin" title="'+pdfemb_trans.objectL10n.zoomin+'" type="button"></button>');g.append(t);g.append(d("<div>"+pdfemb_trans.objectL10n.zoom+' <span class="pdfemb-zoom">100%</span></div>'));
46
- c&&g.append(d("<div>"+pdfemb_trans.objectL10n.secure+"</div>"));b?e.prepend(g):e.append(g);k.on("click",function(a){1>=f.currentPageNum||(f.gotoPage(f.currentPageNum-1),f.jumpToTop())});h.on("click",function(a){f.currentPageNum>=f.pageCount||0==f.currentPageNum||(f.gotoPage(f.currentPageNum+1),f.jumpToTop())});t.on("click",function(a){500<=f.zoom||f.changeZoom(10)});r.on("click",function(a){20>=f.zoom||f.changeZoom(-10)});f.addMoreToolbar(g);a||(e.on("mouseenter",function(a){a=e.find("div.pdfemb-toolbar-hover");
47
- !0!==a.data("no-hover")&&a.show()}),e.on("mouseleave",function(a){e.find("div.pdfemb-toolbar-hover").hide()}),e.on("pdfembTouchTapped",function(a){a.stopPropagation();a.preventDefault();if(!f.locktaps){f.locktaps=!0;a=e.find("div.pdfemb-toolbar-hover");var b=a.is(":visible");1==a.data("no-hover")&&(b=!0);b?a.hide():a.show();setTimeout(function(){f.locktaps=!1},250)}}));pdfemb_trans.poweredby&&g.append(d("<div></div>",{"class":"pdfemb-poweredby"}).append(d('<a href="https://wp-pdf.com/?utm_source=Poweredby&utm_medium=freemium&utm_campaign=Freemium" target="_blank">wp-pdf.com</a>')))};
48
- e.prototype.magnifyEvent=function(b){var a=b.originalEvent.magnification;if(-1==a)this.resizeViewer(),this.resizeInnerDivs(),this.invalidateAllPages(),this.renderPage(this.getTopVisiblePageNum());else{var c=this.divContainer.find(".pdfemb-pagescontainer").offset();this.magnifyZoom(a,b.originalEvent.centreLeft-c.left,b.originalEvent.centreTop-c.top)}};e.prototype.magnifyZoom=function(b,a,c){var d=this.zoom;b=Math.floor(d*b);20>b&&(b=20);500<b&&(b=500);this.zoom=b;this.divContainer.find("span.pdfemb-zoom").text(b+
49
- "%");this.fromZoom=d;this.toZoom=b;this.pccentreLeft=a;this.pccentreTop=c;this.resizeViewer();this.resizeInnerDivs();this.invalidateAllPages()};e.prototype.pdfembWantMobile=function(b,a){return!1};e.prototype.pdfembMakeMobile=function(){};e.prototype.addMoreToolbar=function(b){};e.prototype.jumpToTop=function(){};e.prototype.preRenderCanvas=function(b,a,c){};PDFEMB_NS.pdfembPagesViewer=e});
50
- jQuery(document).ready(function(d){var f=PDFEMB_NS.pdfembPagesViewer;d=function(){f.apply(this,arguments)};d.prototype=new f;PDFEMB_NS.pdfembPagesViewerUsable=d});PDFEMB_NS.pdfembGetPDF=function(d,f){f(d,!1)};
51
- jQuery(document).ready(function(d){d.fn.pdfEmbedder=function(){this.each(function(f,g){f=d(g);if(f.is("a")){g=f.data();var k=d("<div></div>",{"class":f.attr("class"),style:f.attr("style")});k.data(d.extend({"pdf-url":f.attr("href")},g));f.replaceWith(k)}else k=f;k.append(d("<div></div>",{"class":"pdfemb-loadingmsg"}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));"on"==k.data("disablerightclick")&&k.bind("contextmenu",function(b){b.preventDefault()});var e=function(b,a){(new PDFEMB_NS.pdfembPagesViewerUsable(b,
52
- k,a)).setup()};f=function(b,a){null===b?k.empty().append(d("<div></div>",{"class":"pdfemb-errormsg"}).append(msgnode=d("<span></span>").append(document.createTextNode("Failed to load and decrypt PDF")))):PDFJS.getDocument(b).then(function(b){e(b,a)},function(a){var b=document.createTextNode(a.message);"UnknownErrorException"==a.name&&"Failed to fetch"==a.message&&(b=d("<span></span>").append(document.createTextNode(a.message+" "+pdfemb_trans.objectL10n.domainerror+" ")).append(d('<a href="https://wp-pdf.com/kb/error-url-to-the-pdf-file-must-be-on-exactly-the-same-domain-as-the-current-web-page/" target="_blank">'+
53
- pdfemb_trans.objectL10n.clickhereinfo+"</a>")));k.empty().append(d("<div></div>",{"class":"pdfemb-errormsg"}).append(b))})};k.data("pdfDoc")?e(k.data("pdfDoc"),k.data("showIsSecure")):(g=k.data("pdf-url"),PDFEMB_NS.pdfembGetPDF(g,f))});return this};PDFJS.workerSrc=pdfemb_trans.worker_src;PDFJS.cMapUrl=pdfemb_trans.cmap_url;PDFJS.cMapPacked=!0;d(".pdfemb-viewer").pdfEmbedder()});
1
+ var pdfembGrabToPan=function(){function g(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.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);
2
+ (this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}g.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!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)},
3
+ deactivate:function(){if(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(a){return a[k]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(0===a.button&&!this.ignoreTarget(a.target)){this.scrollLeftStart=
4
+ this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var b=document.activeElement;b&&!b.contains(a.target)&&b.blur()}},_onmousemove:function(c){this.element.removeEventListener("scroll",
5
+ this._endPan,!0);var b;b="buttons"in c&&p?!(c.buttons|1):d||a?0===c.which:void 0;b?this._endPan():(b=c.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(c.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-b,this.overlay.parentNode||document.body.appendChild(this.overlay))},_onmousewheel:function(a){this.element.removeEventListener("scroll",this._endPan,!0);var b=.5;a.deltaMode&&(1==a.deltaMode&&(b=10),2==a.deltaMode&&(b=1E3));var f=a.deltaY?-a.deltaY:a.wheelDelta?
6
+ a.wheelDelta:-a.detail;this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;b*=f;this.element.scrollTop=this.scrollTopStart-b;this.overlay.parentNode||document.body.appendChild(this.overlay);if(this.element.scrollTop!=this.scrollTopStart||0==b)return a.preventDefault(),!1},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,
7
+ !0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var k;["webkitM","mozM","msM","oM","m"].some(function(a){a+="atches";a in document.documentElement&&(k=a);a+="Selector";a in document.documentElement&&(k=a);return k});var p=!document.documentMode||9<document.documentMode,l=window.chrome,d=l&&(l.webstore||l.app),a=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return g}(),PDFEMB_NS={};
8
+ jQuery(document).ready(function(g){var k=function(){var a=document.createElement("canvas").getContext("2d");return(window.devicePixelRatio||1)/(a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||a.backingStorePixelRatio||1)}();PDFEMB_NS.PIXEL_RATIO=k;createHiDPICanvas=function(a,c,b){b||(b=k);var f=document.createElement("canvas");f.width=a*b;f.height=c*b;f.style.width=a+"px";f.style.height=c+"px";f.getContext("2d").setTransform(b,0,
9
+ 0,b,0,0);return f};var p=0,l=0;(function(){var a=document.createElement("div");a.style.width="100px";a.style.height="100px";a.style.overflow="scroll";a.style.position="absolute";a.style.top="-9999px";document.body.appendChild(a);p=a.offsetWidth-a.clientWidth;l=a.offsetHeight-a.clientHeight;document.body.removeChild(a)})();PDFEMB_NS.vscrollbarwidth=p;PDFEMB_NS.hscrollbarheight=l;var d=function(a,c,b){this.pdfDoc=a;this.divContainer=c;this.showIsSecure=b;this.initialResize=!1;this.firstPageHeight=this.firstPageWidth=
10
+ 0;this.invalidationRound=1;this.currentPageNum=0;this.zoom=100;this.toZoom=this.fromZoom=0};d.prototype.setup=function(){var a=this,c=this.divContainer,b=this.pdfDoc,f=this.showIsSecure;this.numPages=b.numPages;var e=c.data("scrollbar");this.vscrollbar="both"==e||"vertical"==e;this.hscrollbar="both"==e||"horizontal"==e;e="overflow-y: "+(this.vscrollbar?"scroll":"hidden")+"; ";e+="overflow-x: "+(this.hscrollbar?"scroll":"hidden")+"; ";c.empty().append(g("<div></div>",{"class":"pdfemb-pagescontainer",
11
+ style:e}));c.data("pdfDoc",b);e=c.data("toolbar");"top"!=e&&"both"!=e||this.addToolbar(!0,"on"==c.data("toolbar-fixed"),f);"bottom"!=e&&"both"!=e||this.addToolbar(!1,"on"==c.data("toolbar-fixed"),f);a.annotationsLayerFactory="undefined"!=typeof PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory?new PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(a,b){return null}};a.annotationLayerFactories=[];c.on("pdfembGotopage",function(b,c){c>this.numPages||0>=c||(a.gotoPage(c),
12
+ a.jumpToTop())});c.on("pdfembGotoHash",function(b,c){if(c.dest){dest=c.dest;var f;"string"===typeof dest?(destString=dest,f=a.pdfDoc.getDestination(dest)):f=Promise.resolve(dest);f.then(function(b){b instanceof Array&&!(1>b.length)&&a.pdfDoc.getPageIndex(b[0]).then(function(b){b+=1;b>a.numPages||0>=b||a.currentPageNum==b||(a.gotoPage(b),a.jumpToTop())})})}});c.on("pdfembGotoAction",function(b,c){var f=a.currentPageNum,e=f;switch(c){case "GoBack":--e;break;case "GoForward":++e;break;case "NextPage":++e;
13
+ break;case "PrevPage":--e;break;case "LastPage":e=a.pageCount;break;case "FirstPage":e=1}e==f||e>a.pageCount||0>=e||a.gotoPage(e)});c.on("pdfembMagnify",function(b){a.magnifyEvent(b)});c.on("pdfembChangeZoom",function(b,c){a.changeZoom(c)});this.pageCount=b.numPages;(!c.data("pagenum")||1>c.data("pagenum")||c.data("pagenum")>this.pageCount)&&c.data("pagenum",1);c.data("showIsSecure",this.showIsSecure);c.data("pageNumPending",null);b="on"==c.data("fullScreen")?parseInt(c.data("startfpzoom")):parseInt(c.data("startzoom"));
14
+ if(isNaN(b)||20>b||500<b)b=100;this.zoom=b;100!=b&&c.find("span.pdfemb-zoom").text(b+"%");c.find("span.pdfemb-page-count").text(this.pageCount);this.gotoPage(c.data("pagenum"))};d.prototype.checkForResize=function(){var a=this,c=a.divContainer,b=g(window).height(),f=g(window).width(),e=c.data("checked-window-height"),t=c.data("checked-window-width");e&&t||(c.data("checked-window-height",b),c.data("checked-window-width",f));if(e!=b||t!=f)a.resizeViewer(),a.resizeInnerDivs(),a.invalidateAllPages(),
15
+ a.renderPage(this.currentPageNum),a.prerenderNearbyPages(this.currentPageNum),a.pdfembMakeMobile(),c.data("checked-window-height",b),c.data("checked-window-width",f);"true"!=c.data("fullScreenClosed")&&setTimeout(function(){a.checkForResize()},100)};d.prototype.setSizesBasedOnPage=function(a){a=a.getViewport(1);this.pageWidth=a.width;this.pageHeight=a.height;(0>=this.pageWidth||0>=this.pageHeight)&&this.divContainer.empty().append(document.createTextNode(pdfemb_trans.objectL10n.widthheightinvalid))};
16
+ d.prototype.createPageInnerDivs=function(){for(var a=this.divContainer.find(".pdfemb-pagescontainer"),c=1;c<=this.pageCount;++c){var b=a.find(".pdfemb-inner-div.pdfemb-page"+c);0==b.length&&(b=g("<div></div>",{"class":"pdfemb-inner-div pdfemb-page"+c}),b.data("pageNum",c),a.append(b))}this.resizeInnerDivs()};d.prototype.addGrabToPan=function(){var a=this,c=a.divContainer,b=c.find("div.pdfemb-pagescontainer"),f=new pdfembGrabToPan({element:b[0]});c.data("grabtopan",f);b.on("scroll",function(b){var c=
17
+ a.getTopVisiblePageNum();c!=a.currentPageNum&&(a.currentPageNum=c,a.updatePageNumDisplay(c),a.renderPage(c,!1),a.prerenderNearbyPages(c),a.deallocateFarAwayPages(c));b.stopPropagation()});g(window).resize(function(){setTimeout(function(){a.checkForResize()},100)})};d.prototype.resizeInnerDivs=function(a){var c=this,b=c.wantCanvasWidth,f=c.wantCanvasHeight,e=c.wantHeight,d=this.divContainer.find(".pdfemb-pagescontainer").find(".pdfemb-inner-div");a&&(d=d.filter(".pdfemb-page"+a));var w=0;d.each(function(e,
18
+ h){var n=g(h),m=n.data("widthfactor"),k=n.data("heightfactor");m||(m=1);k||(k=1);n.data("invalidation-round",this.invalidationRound-1);n.css("width",b*m);var l=f*k+(a==c.numPages||!a&&e==d.length-1?0:2);n.css("height",l);w+=l;n=n.find(".pdfemb-the-canvas");n.css("width",b*m);n.css("height",f*k)});var h=0;!a&&w<e&&(h=(e-w)/2);d.first().css("top",h)};d.prototype.invalidateAllPages=function(){++this.invalidationRound};d.prototype.prerenderNearbyPages=function(a){var c=3,b=2;100>this.zoom&&(c*=Math.min(Math.ceil(100/
19
+ this.zoom),10),b*=Math.min(Math.ceil(100/this.zoom),10));for(b=Math.max(1,a-b);b<=Math.min(a+c,this.numPages);++b)b!=a&&this.renderPage(b,!1)};d.prototype.deallocateFarAwayPages=function(a){var c=50,b=50;if(100>this.zoom)var f=Math.min(Math.ceil(100/this.zoom),50),c=c+f,b=b+f;var f=function(a){a=e.find(".pdfemb-page"+a);var b=a.find(".pdfemb-the-canvas");b.length&&(b.remove(),a.data("invalidation-round",0))},e=this.divContainer.find("div.pdfemb-pagescontainer"),d;for(d=3;d<a-b;++d)f(d);for(d=a+c;d<
20
+ this.numPages;++d)f(d)};d.prototype.resizeViewer=function(){var a=this.pageWidth,c=this.pageHeight,b=this.divContainer,f=b.find("div.pdfemb-pagescontainer"),e=f[0].scrollLeft,d=f[0].scrollTop,g=b.parent().width(),h=a;if("max"==b.data("width"))h=g;else if("auto"==b.data("width"))h=a;else if(h=parseInt(b.data("width"),10),isNaN(h)||0>=h)h=g;0>=h&&(h=a);h>g&&0<g&&(h=g);var c=c*h/a,r=this.pdfembWantMobile(h,m);this.wantMobile=r;var x=b.find("div.pdfemb-toolbar-fixed"),n=r?0:x.length,m=parseInt(b.data("height"),
21
+ 10);if(isNaN(m)||0>=m||m>c)m="auto"==b.data("height")?b.parent().height()-n*x.height():c;this.userHeight=m;var h=Math.floor(h),c=Math.floor(c),g=100,u=h-(this.vscrollbar?p:0),q=c-(this.hscrollbar?l:0),A=1;r||(g=this.zoom,u=u*g/100,q=q*g/100,16777E3<u*q*k*k&&(A=16777E3/(u*q*k*k)));h!=b.width()&&b.width(h);b.height()!=m&&b.height(m+n*x.height());f.width(h);f.height(m);b=x.filter(".pdfemb-toolbar-top");0<n&&f.css("top",b.height());a=(h-(this.vscrollbar?p:0))/a;0!=this.fromZoom&&0!=this.toZoom&&(f[0].scrollLeft=
22
+ this.toZoom/this.fromZoom*(e+this.pccentreLeft)-this.pccentreLeft,f[0].scrollTop=this.toZoom/this.fromZoom*(d+this.pccentreTop)-this.pccentreTop);this.toZoom=this.fromZoom=0;this.wantCanvasWidth=u;this.wantCanvasHeight=q;this.reducefactor=A;this.wantWidth=h;this.wantHeight=c;this.canvasscale=a;this.zoom=g};d.prototype.getTopVisiblePageNum=function(){var a=this.divContainer.find(".pdfemb-pagescontainer").find(".pdfemb-inner-div:visible");return 0<a.length?a.first().data("pageNum"):1};d.prototype.gotoPage=
23
+ function(a){0>=a||a>this.pageCount||(this.renderPage(a,!0),this.currentPageNum=a,this.updatePageNumDisplay(a),this.prerenderNearbyPages(a),this.deallocateFarAwayPages(a))};d.prototype.updatePageNumDisplay=function(a){var c=this.divContainer;c.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(b,c){var e=g(c);e.is("span")?e.text(a):e.val(a)});a<this.pageCount?c.find(".pdfemb-next").removeAttr("disabled").removeClass("pdfemb-btndisabled"):c.find(".pdfemb-next").attr("disabled","disabled").addClass("pdfemb-btndisabled");
24
+ 1<a?c.find(".pdfemb-prev").removeAttr("disabled").removeClass("pdfemb-btndisabled"):c.find(".pdfemb-prev").attr("disabled","disabled").addClass("pdfemb-btndisabled")};d.prototype.scrollPageIntoView=function(a){var c=this.divContainer.find(".pdfemb-pagescontainer"),b=c.find(".pdfemb-page"+a);c.find(".pdfemb-inner-div").not(".pdfemb-page"+a).hide();b.show();c[0].scrollTop=0};d.prototype.renderPage=function(a,c){var b=this,f=b.invalidationRound,e=this.divContainer,d=e.data("pdfDoc"),l=e.find(".pdfemb-pagescontainer"),
25
+ h=l.find(".pdfemb-page"+a);if(h.length&&h.data("invalidation-round")>=f)c&&b.scrollPageIntoView(a);else{var r=h.data("pending-drawing-round");r>=f||(0<r&&r<f?h.data("pending-drawing-round",f):(h.data("pending-drawing-round",f),d.getPage(a).then(function(d){b.initialResize||(b.initialResize=!0,b.setSizesBasedOnPage(d),b.resizeViewer(),b.createPageInnerDivs(),b.addGrabToPan(),b.pdfembMakeMobile());0==h.length&&(h=l.find(".pdfemb-page"+a));var n=h.data("widthfactor"),m=h.data("heightfactor");if(!n||
26
+ !m){var t=d.getViewport(1),n=t.width/b.pageWidth,m=t.height/b.pageHeight;h.data("widthfactor",n);h.data("heightfactor",m);1==n&&1==m||b.resizeInnerDivs(a)}var q=h.find(".pdfemb-the-canvas");0==q.length&&(q=g("<canvas></canvas>",{"class":"pdfemb-the-canvas"}),h.append(q));c&&b.scrollPageIntoView(a);var p=b.wantCanvasWidth,y=b.wantCanvasHeight,t=b.canvasscale,B=b.zoom;q.css("width",p*n);q.css("height",y*m);b.wantMobile?e.data("grabtopan").deactivate():e.data("grabtopan").activate();var C=d.getViewport(t*
27
+ B/100),v=document.createElement("canvas");v.width=p*k*b.reducefactor*n;v.height=y*k*b.reducefactor*m;var z=v.getContext("2d"),D=function(){q[0].width=p*k*b.reducefactor*n;q[0].height=y*k*b.reducefactor*m;b.preRenderCanvas(z,a,B);var c=z.getImageData(0,0,v.width,v.height);q[0].getContext("2d").putImageData(c,0,0);c=null;"undefined"==typeof b.annotationLayerFactories[a]?(c=b.annotationsLayerFactory.createAnnotationsLayerBuilder(h[0],d),b.annotationLayerFactories[a]=c):c=b.annotationLayerFactories[a];
28
+ null!=c&&c.setupAnnotations(C,b.divContainer.data("newwindow"));h.data("invalidation-round",f);r=h.data("pending-drawing-round");h.data("pending-drawing-round","");r>f&&b.renderPage(a,!1)};d.render({canvasContext:z,viewport:C,transform:[k*b.reducefactor,0,0,k*b.reducefactor,0,0]}).promise.then(function(){"requestAnimationFrame"in window?window.requestAnimationFrame(D):setTimeout(D,1)})})))}};d.prototype.changeZoom=function(a){var c=this.divContainer,b=this.zoom;this.zoom=a=b+a;c.find("span.pdfemb-zoom").text(a+
29
+ "%");this.fromZoom=b;this.toZoom=a;c=c.find(".pdfemb-pagescontainer");this.pccentreLeft=c.width()/2;this.pccentreTop=c.height()/2;this.resizeViewer();this.resizeInnerDivs();this.invalidateAllPages();this.renderPage(this.currentPageNum);this.prerenderNearbyPages(this.currentPageNum)};d.prototype.queueRenderPage=function(a,c){this.renderPage(a,c)};d.prototype.addToolbar=function(a,c,b){var f=this.divContainer,e=this,d=g("<div></div>",{"class":"pdfemb-toolbar pdfemb-toolbar"+(c?"-fixed":"-hover")+" "+
30
+ (a?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),k=g('<button class="pdfemb-prev" title="'+pdfemb_trans.objectL10n.prev+'" type="button"></button>');d.append(k);var h=g('<button class="pdfemb-next" title="'+pdfemb_trans.objectL10n.next+'" type="button"></button>');d.append(h);d.append(g('<div class="pdfemb-page-area">'+pdfemb_trans.objectL10n.page+' <span class="pdfemb-page-num">0</span> / <span class="pdfemb-page-count"></span></div>'));var l=g('<button class="pdfemb-zoomout" title="'+pdfemb_trans.objectL10n.zoomout+
31
+ '" type="button"></button>');d.append(l);var p=g('<button class="pdfemb-zoomin" title="'+pdfemb_trans.objectL10n.zoomin+'" type="button"></button>');d.append(p);d.append(g("<div>"+pdfemb_trans.objectL10n.zoom+' <span class="pdfemb-zoom">100%</span></div>'));b&&d.append(g("<div>"+pdfemb_trans.objectL10n.secure+"</div>"));a?f.prepend(d):f.append(d);k.on("click",function(a){1>=e.currentPageNum||(e.gotoPage(e.currentPageNum-1),e.jumpToTop())});h.on("click",function(a){e.currentPageNum>=e.pageCount||0==
32
+ e.currentPageNum||(e.gotoPage(e.currentPageNum+1),e.jumpToTop())});p.on("click",function(a){500<=e.zoom||e.changeZoom(10)});l.on("click",function(a){20>=e.zoom||e.changeZoom(-10)});e.addMoreToolbar(d);c||(f.on("mouseenter",function(a){a=f.find("div.pdfemb-toolbar-hover");!0!==a.data("no-hover")&&a.show()}),f.on("mouseleave",function(a){f.find("div.pdfemb-toolbar-hover").hide()}),f.on("pdfembTouchTapped",function(a){a.stopPropagation();a.preventDefault();if(!e.locktaps){e.locktaps=!0;a=f.find("div.pdfemb-toolbar-hover");
33
+ var b=a.is(":visible");1==a.data("no-hover")&&(b=!0);b?a.hide():a.show();setTimeout(function(){e.locktaps=!1},250)}}));pdfemb_trans.poweredby&&d.append(g("<div></div>",{"class":"pdfemb-poweredby"}).append(g('<a href="https://wp-pdf.com/?utm_source=Poweredby&utm_medium=freemium&utm_campaign=Freemium" target="_blank">wp-pdf.com</a>')))};d.prototype.magnifyEvent=function(a){var c=a.originalEvent.magnification;if(-1==c)this.resizeViewer(),this.resizeInnerDivs(),this.invalidateAllPages(),this.renderPage(this.getTopVisiblePageNum());
34
+ else{var b=this.divContainer.find(".pdfemb-pagescontainer").offset();this.magnifyZoom(c,a.originalEvent.centreLeft-b.left,a.originalEvent.centreTop-b.top)}};d.prototype.magnifyZoom=function(a,c,b){var d=this.zoom;a=Math.floor(d*a);20>a&&(a=20);500<a&&(a=500);this.zoom=a;this.divContainer.find("span.pdfemb-zoom").text(a+"%");this.fromZoom=d;this.toZoom=a;this.pccentreLeft=c;this.pccentreTop=b;this.resizeViewer();this.resizeInnerDivs();this.invalidateAllPages()};d.prototype.pdfembWantMobile=function(a,
35
+ c){return!1};d.prototype.pdfembMakeMobile=function(){};d.prototype.addMoreToolbar=function(a){};d.prototype.jumpToTop=function(){};d.prototype.preRenderCanvas=function(a,c,b){};PDFEMB_NS.pdfembPagesViewer=d});jQuery(document).ready(function(g){var k=PDFEMB_NS.pdfembPagesViewer;g=function(){k.apply(this,arguments)};g.prototype=new k;PDFEMB_NS.pdfembPagesViewerUsable=g});PDFEMB_NS.pdfembGetPDF=function(g,k){k(g,!1)};
36
+ jQuery(document).ready(function(g){g.fn.pdfEmbedder=function(){this.each(function(k,p){var l,d=g(p);if(d.is("a")){var a=d.data();l=g("<div></div>",{"class":d.attr("class"),style:d.attr("style")});l.data(g.extend({"pdf-url":d.attr("href")},a));d.replaceWith(l)}else l=d;l.append(g("<div></div>",{"class":"pdfemb-loadingmsg"}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));"on"==l.data("disablerightclick")&&l.bind("contextmenu",function(a){a.preventDefault()});var c=function(a,c){(new PDFEMB_NS.pdfembPagesViewerUsable(a,
37
+ l,c)).setup()},d=function(a,d){null===a?l.empty().append(g("<div></div>",{"class":"pdfemb-errormsg"}).append(msgnode=g("<span></span>").append(document.createTextNode("Failed to load and decrypt PDF")))):PDFJS.getDocument(a).then(function(a){c(a,d)},function(a){var b=document.createTextNode(a.message);"UnknownErrorException"==a.name&&"undefined"===typeof a.status&&(b=g("<span></span>").append(document.createTextNode(a.message+" "+pdfemb_trans.objectL10n.domainerror+" ")).append(g('<a href="https://wp-pdf.com/kb/error-url-to-the-pdf-file-must-be-on-exactly-the-same-domain-as-the-current-web-page/" target="_blank">'+
38
+ pdfemb_trans.objectL10n.clickhereinfo+"</a>")));l.empty().append(g("<div></div>",{"class":"pdfemb-errormsg"}).append(b))})};l.data("pdfDoc")?c(l.data("pdfDoc"),l.data("showIsSecure")):(a=l.data("pdf-url"),PDFEMB_NS.pdfembGetPDF(a,d))});return this};PDFJS.workerSrc=pdfemb_trans.worker_src;PDFJS.cMapUrl=pdfemb_trans.cmap_url;PDFJS.cMapPacked=!0;g(".pdfemb-viewer").pdfEmbedder()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/pdfemb-blocks.js CHANGED
@@ -4,15 +4,7 @@
4
  var __ = wp.i18n.__; // The __() function for internationalization.
5
  var createElement = wp.element.createElement; // The wp.element.createElement() function to create elements.
6
  var registerBlockType = wp.blocks.registerBlockType; // The registerBlockType() function to register blocks.
7
- var InspectorControls = wp.editor.InspectorControls;
8
- var Button = wp.components.Button;
9
- var RichText = wp.editor.RichText;
10
- var Editable = wp.blocks.Editable; // Editable component of React.
11
- var MediaUpload = wp.editor.MediaUpload;
12
- var btn = wp.components.Button;
13
- var TextControl = wp.components.TextControl;
14
- var SelectControl = wp.components.SelectControl;
15
- var RadioControl = wp.components.RadioControl;
16
 
17
  var make_title_from_url = function(url) {
18
  var re = RegExp('/([^/]+?)(\\.pdf(\\?[^/]*)?)?$', 'i');
@@ -63,7 +55,17 @@
63
  edit: function( props ) {
64
 
65
  var {attributes , setAttributes, focus, className} = props;
66
-
 
 
 
 
 
 
 
 
 
 
67
  var onSelectPDF = function(media) {
68
  return props.setAttributes({
69
  url: media.url,
4
  var __ = wp.i18n.__; // The __() function for internationalization.
5
  var createElement = wp.element.createElement; // The wp.element.createElement() function to create elements.
6
  var registerBlockType = wp.blocks.registerBlockType; // The registerBlockType() function to register blocks.
7
+
 
 
 
 
 
 
 
 
8
 
9
  var make_title_from_url = function(url) {
10
  var re = RegExp('/([^/]+?)(\\.pdf(\\?[^/]*)?)?$', 'i');
55
  edit: function( props ) {
56
 
57
  var {attributes , setAttributes, focus, className} = props;
58
+
59
+ var InspectorControls = wp.editor.InspectorControls;
60
+ var Button = wp.components.Button;
61
+ var RichText = wp.editor.RichText;
62
+ var Editable = wp.blocks.Editable; // Editable component of React.
63
+ var MediaUpload = wp.editor.MediaUpload;
64
+ var btn = wp.components.Button;
65
+ var TextControl = wp.components.TextControl;
66
+ var SelectControl = wp.components.SelectControl;
67
+ var RadioControl = wp.components.RadioControl;
68
+
69
  var onSelectPDF = function(media) {
70
  return props.setAttributes({
71
  url: media.url,
pdf_embedder.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: PDF Embedder
5
  * Plugin URI: http://wp-pdf.com/
6
  * Description: Embed PDFs straight into your posts and pages, with flexible width and height. No third-party services required. Compatible with Gutenberg Editor WordPress
7
- * Version: 3.2
8
  * Author: Dan Lester
9
  * Author URI: http://wp-pdf.com/
10
  * License: GPL3
@@ -15,7 +15,7 @@ require_once( plugin_dir_path(__FILE__).'/core/core_pdf_embedder.php' );
15
 
16
  class pdfemb_basic_pdf_embedder extends core_pdf_embedder {
17
 
18
- protected $PLUGIN_VERSION = '3.2';
19
 
20
  // Singleton
21
  private static $instance = null;
4
  * Plugin Name: PDF Embedder
5
  * Plugin URI: http://wp-pdf.com/
6
  * Description: Embed PDFs straight into your posts and pages, with flexible width and height. No third-party services required. Compatible with Gutenberg Editor WordPress
7
+ * Version: 4.0
8
  * Author: Dan Lester
9
  * Author URI: http://wp-pdf.com/
10
  * License: GPL3
15
 
16
  class pdfemb_basic_pdf_embedder extends core_pdf_embedder {
17
 
18
+ protected $PLUGIN_VERSION = '4.0';
19
 
20
  // Singleton
21
  private static $instance = null;
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === PDF Embedder ===
2
  Contributors: levertechadmin, danlester
3
  Tags: doc, pdf, pdf viewer, office, google, document, embed, intranet
4
- Requires at least: 3.5
5
- Tested up to: 4.9
6
- Stable tag: 3.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -203,9 +203,9 @@ the Plugins section of your Wordpress admin
203
 
204
  == Changelog ==
205
 
206
- = 3.2 =
207
 
208
- Added compatibility with Gutenberg Editor
209
 
210
  = 3.1.8 =
211
 
1
  === PDF Embedder ===
2
  Contributors: levertechadmin, danlester
3
  Tags: doc, pdf, pdf viewer, office, google, document, embed, intranet
4
+ Requires at least: 4.0
5
+ Tested up to: 5.0
6
+ Stable tag: 4.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
203
 
204
  == Changelog ==
205
 
206
+ = 5.0 =
207
 
208
+ Added compatibility for WordPress 5.0
209
 
210
  = 3.1.8 =
211