=20&&0===t&&i>=11||e>=20&&i>=100?10:100}}class c extends r{constructor(){super(c.EVENT_NAMES),this.viewRect=null,this.enabled=!1,this._scrollCallback=()=>{this._eventHandler("scroll")},this._resizeCallback=()=>{this._eventHandler("resize")}}_makeViewRect(){const e=this.container,t=document.documentElement,i=e.scrollTop||e.scrollY||e.pageYOffset||t.scrollTop,s=e.scrollLeft||e.scrollX||e.pageXOffset||t.scrollLeft,n=e.clientWidth||e.innerWidth||t.clientWidth,a=e.clientHeight||e.innerHeight||t.clientHeight,r={top:i,left:s,right:s+n,bottom:i+a,width:n,height:a};if(this.container!==window){const e=this.container.getBoundingClientRect&&this.container.getBoundingClientRect();e&&(r.offsetX=e.left,r.offsetY=e.top)}return r}_updateViewRect(){const e=this.viewRect;this.viewRect=this._makeViewRect();return{xChanged:!e||e.left!==this.viewRect.left||e.width!==this.viewRect.width,yChanged:!e||e.top!==this.viewRect.top||e.height!==this.viewRect.height}}_eventHandler(e){const t=this._updateViewRect();["resize","both"].includes(e)&&(t.xChanged||t.yChanged)&&this.fireEvent("resize",this.viewRect),(t.xChanged||t.yChanged)&&this.fireEvent("either",this.viewRect),t.xChanged&&this.fireEvent("horizontal",this.viewRect),t.yChanged&&this.fireEvent("vertical",this.viewRect)}enable(){if(this.enabled)throw Error("ViewportManager has already been enabled");this.enabled=!0,this.container=window.DocumentManager.scrollParent||window,this._eventHandler("both"),this.container.addEventListener("resize",this._resizeCallback,!1);(window.DocumentManager.scrollParent?this.container:window.document).addEventListener("scroll",this._scrollCallback,!1)}disable(){if(!this.enabled)throw Error("ViewportManager has already been disabled");this.enabled=!1,window.removeEventListener("resize",this._resizeCallback,!1),this.container.removeEventListener("scroll",this._scrollCallback,!1)}}i(c,"EVENT_NAMES",["vertical","horizontal","either","resize"]);class m{constructor(e,t){this.pages=[],this.loaded=!1,this.fonts={},this.numFonts=0,this.fontLoader=t,this.groupNum=e||0}addPage(e){for(let t=0;tthis.fontLoader.maxFontsLoading(i,t,e)}load(e){if(this.hasLoaded)return;this.hasLoaded=!0;const t=()=>{for(const e in this.fonts)Object.prototype.hasOwnProperty.call(this.fonts,e)&&this.fontLoader.addFontToQueue(e);this.fontLoader.flushFontQueue()};e?window.setTimeout(t.bind(this),e):t.call(this)}newNextGroup(){return new m(this.groupNum+1,this.fontLoader)}}class p{constructor(e){for(const i in p._defaultParams)Object.prototype.hasOwnProperty.call(p._defaultParams,i)&&(this[i]=e[i]||p._defaultParams[i]);const t=this._getMissingRequiredParams();if(t.length)throw Error("Missing required Page param(s): "+t.join(", "));if(!this.contentUrl&&!this.innerPageElem)throw Error("Must initialize a page with either a contentUrl or innerPageElem element");if(!0===this.containerElem.boundToPageObj)throw Error("Container Elem is already bound to a page. We shouldn't get here");this.containerElem.boundToPageObj=!0,this._targetHeight=null,this._targetWidth=null,this._innerPageVisible=!!this.innerPageElem,this._imagesTurnedOn=!1,this.boundingRect=null,this.isVisible=!1,this.displayDirty=!0,this.displayOn=null,this.loadHasStarted=!!this.innerPageElem}_getMissingRequiredParams(){const e=[];let t;for(let i=0;i<\/noscript *>/g,""),i=document.createElement("div");i.innerHTML=t.trim();const s=i.firstChild;this.containerElem.appendChild(s),this.innerPageElem=s,this.turnOnLinks(),this.fixSVGFonts(),this._fitContentsToWidth(),this.displayDirty=!0,this.displayOn?this.display():this.hide()}fixSVGFonts(){if(!this._svgFontsFixed&&this.innerPageElem){if(a){const e=function(t){if(t.nodeType===document.TEXT_NODE){const i=t.textContent.search(/[ \n][^ \n ]/);i>=0&&e(t.splitText(i+1))}else{const i=t.childNodes;for(let t=0;t`}load(){if(this.currentlyLoading=!0,this.loadHasStarted=!0,this.innerPageElem)throw Error("We already have loaded this page, but it looks like you called loadPage again");this.loadFonts();const e=`page${this.pageNum}_callback`;if(window[e])try{delete window[e]}catch{window[e]=void 0}if(this.docManager.displayType===t)return delete this.currentlyLoading,void this._setContainerContents(this.imagePageContent(this.contentUrl));const i=document.createElement("script");window[e]=t=>{i&&i.parentNode===document.body&&document.body.removeChild(i);const s=t[0];delete this.currentlyLoading,this._setContainerContents(s);const n=document.getElementById(this.containerElem.id);if(this.docManager.fireEvent("pageLoaded",this.containerElem),n&&this.docManager.lazyImageObserver){const e=n.querySelectorAll(".absimg");for(let t=0;te/t?t=Math.ceil(e/this.origWidth*this.origHeight):e=Math.ceil(t/this.origHeight*this.origWidth),this._targetWidth!==e&&(this.containerElem.style.width=e+"px",this._targetWidth=e),this._targetHeight!==t&&(this.containerElem.style.height=t+"px",this._targetHeight=t),this._fitContentsToWidth()}turnOnImages(){if(!this.innerPageElem)throw Error("Can't turn on images for a page that's not loaded");if(this._imagesTurnedOn)throw Error("Images have already been turned on for this document");this._imagesTurnedOn=!0;const e=this.innerPageElem.getElementsByTagName("img");for(let t=0;t-1&&!e.href){const i=e.getAttribute("orig");if(i){let a=s.decode(i).replace(/^j[\W]*a[\W]*v[\W]*a[\W]*s[\W]*c[\W]*r[\W]*i[\W]*p[\W]*t[\W]*:|^f[\W]*i[\W]*l[\W]*e[\W]*:/gi,"");a.search(/^page/)>-1?e.onclick=t(a):(a.search(/^(http|ftp)/)<0&&(a="http://"+a),e.,n(e,a),e.rel="nofollow Scribd")}}}}}i(p,"_defaultParams",{containerElem:null,innerPageElem:null,contentUrl:null,origWidth:null,origHeight:null,fonts:null,docManager:null,pageNum:null}),i(p,"_requiredParams",["origorigHeight","fonts","docManager","containerElem","pageNum"]);const f=["dragstart, selectstart, contextmenu"],_=function(e){e.preventDefault()};class P extends r{constructor(e,t,i){super(P.EVENT_NAMES),this.options=i||{},this.options.extrasWidth="this.options.extrasWidth||window.extrasWidth,this.defaultViewMode=e||"scroll",this.mobile=t||!1,this.callbacks_ready=!1,this.callbacks=[],this.pages={},this._pageWidths=null,this.options.hasWoffFonts?(this._fontLoader=new" d(this),this.adjacentFontLoadPages=1):(this._fontLoader=new u(this),this.adjacentFontLoadPages=8),this.viewManagers={scroll:new h,slideshow:new l},this.viewportManager=new c,this._currentFontAggregatorHostIdx=0,this.visiblePages=[],this.firstVisiblePage=null,this.lastVisiblePage=null,this.firstHiddenPageNum=null,this.truncateDocument=window.__truncate_document||!1,this.currentFontGroup=new m(0,this._fontLoader),this.isScrolling=!1,this._scrollingCount=0,"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype&&"isIntersecting"in window.IntersectionObserverEntry.prototype&&this.setupLazyImageObserver()}setupLazyImageObserver(){this.lazyImageObserver=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&this.lazyLoad(e.target)})})}lazyLoad(e){e.className.toLowerCase().search("absimg")>-1&&!e.src&&(e.src=this.subImageSrc(e.getAttribute("orig")),e.removeAttribute("orig"),e.style.display="block",this.lazyImageObserver&&this.lazyImageObserver.unobserve(e))}observeImages(e){if(!this.lazyImageObserver||!this.lazyImageObserver.observe)return;const t=e.getElementsByTagName("img");for(let i=0;i-1&&this.lazyImageObserver.observe(t[i])}loadImages(e){const t=e.getElementsByTagName("img");for(let i=0;i{e.call(this)})}disableRestorePosition(){this.viewManagers.scroll._disableRestorePosition=!0}_fireZoomed(e){this.fireEvent("zoomed",e)}nextFontAggregatorHost(){return this._currentFontAggregatorHostIdx=(this._currentFontAggregatorHostIdx+1)%this.fontAggregatorHosts.length,this.fontAggregatorHosts[this._currentFontAggregatorHostIdx]}_fireHideExtras(){this.fireEvent("hideExtras")}_fireShowExtras(){this.fireEvent("showExtras")}currentPageNum(){return this._expectedFirstPageNum}setupTestElements(){this._fontLoader.setupTestElements()}pageCount(){if(Object.prototype.hasOwnProperty.call(this,"_pageCount"))return this._pageCount;let e=0;for(const t in this.pages)Object.prototype.hasOwnProperty.call(this.pages,t)&&e++;return this._pageCount=e,this._pageCount}truncatedPagesString(){return`${this.firstHiddenPageNum}-${this.originalPageCount}`}setupPaidDocument(e,t){this.allowedPages=e,this.originalPageCount=t,this._allowedPagesHash=[],this._maximumAllowedPage=Math.max.apply(null,this.allowedPages),this._minimumAllowedPage=Math.min.apply(null,this.allowedPages),this._isPaidDocument=!0,this._pageMissingElements=[];for(let i=0;i0&&e[i]>e[i-1]+1||0===i&&1!==e[i])&&this._pageMissingElements.push("page_missing_explanation_"+e[i].toString());this._maximumAllowedPage!==this.originalPageCount&&this._pageMissingElements.push("page_missing_explanation_"+(this.originalPageCount+1).toString())}minimumPageNumber(){return"book"===this.viewMode()?0:1}maximumPageNumber(){return this.allowedPages?this.originalPageCount:this.pageCount()}getClosestPageNumber(e,t){if(!this.allowedPages)return e;if(this._allowedPagesHash[e])return e;if(e>=this._maximumAllowedPage)return this._maximumAllowedPage;if(e<=this._minimumallowedpage)return this._minimumAllowedPage;for(let i=1;i<=this.originalpagecount;i++){if(t<=0&&!0===this._allowedpageshash[e-i])return e-i;if(t>=0&&e+ie.visibleHeight)&&(e=t);return e?.pageNum}updateMostVisiblePage(){const e=this.getMostVisiblePageNum();e!==this._mostVisiblePageNum&&(this._mostVisiblePageNum=e,this.fireEvent("mostVisiblePageChanged",this._mostVisiblePageNum))}visiblePagesChanged(){const e=[];for(const i in this.pages)if(Object.prototype.hasOwnProperty.call(this.pages,i)){const t=this.pages[i];t.isVisible&&e.push(t)}if(!e.length)return;e.sort(function(e,t){return e.pageNum0?e[0]:null,this.lastVisiblePage=e.length>0?e[e.length-1]:null,this.isScrolling||(this._loadAdjacentFonts(),this._loadAdjacentPages()),(this.firstVisiblePage===t||this.firstVisiblePage&&t)&&this.firstVisiblePage.pageNum===t.pageNum||!this.isScrolling&&this.firstVisiblePage&&this._updateExpectedFirstPage(this.firstVisiblePage.pageNum),this.scheduleLogPageView()}constrain(e,t,i){return Math.min(i,Math.max(t,e))}boundingRatioForPage(e){const t=this.viewportManager.viewRect,i=e.boundingRect,s=i.bottom-i.top,n=i.right-i.left;return{left:(t.left-i.left)/n,right:(t.right-i.right)/n+1,top:this.constrain((t.top-i.top)/s+e.pageNum,e.pageNum,e.pageNum+1),bottom:this.constrain((t.bottom-i.bottom)/s+e.pageNum+1,e.pageNum,e.pageNum+1)}}scheduleLogPageView(){this.logPageViewTimout&&window.clearTimeout(this.logPageViewTimout),this.logPageViewTimout=window.setTimeout(()=>{this.logPageView(),this.logPageViewTimout=null},1e3)}_floor2(e){return Math.floor(100*e)/100}getVisibleBBox(){const e={};if(this.firstVisiblePage){const t=this.boundingRatioForPage(this.firstVisiblePage);e.left=t.left,e.right=t.right,e.top=t.top}if(this.lastVisiblePage){const t=this.boundingRatioForPage(this.lastVisiblePage);e.bottom=t.bottom}return e}logPageView(){const e=this.getVisibleBBox();for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=this._floor2(e[i]));const t=[[e.left,e.top],[e.right,e.bottom]];return this.fireEvent("pageView",t),e}_updateExpectedFirstPage(e){this._expectedFirstPageNum=e,this.fireEvent("expectedFirstPageChanged",this._expectedFirstPageNum)}_loadAdjacentFonts(){if(this.firstVisiblePage&&this.lastVisiblePage){const e=this.firstVisiblePage.pageNum-this.adjacentFontLoadPages,t=this.lastVisiblePage.pageNum+this.adjacentFontLoadPages;for(let i=e;i<=t;i++){const e=this.pages[i];e&&e.loadFonts()}}}_loadAdjacentPages(){if(this.firstVisiblePage&&this.lastVisiblePage){const e=this.firstVisiblePage.pageNum-3,t=this.lastVisiblePage.pageNum+3;for(let i=e;i<=t;i++){const e=this.pages[i];e&&!e.loadHasStarted&&(e.load(),this.mobile&&e.setWidth(this._pageWidths))}this.mobile&&this._removeUnusedPages()}}_removeUnusedPages(){const e=this.firstVisiblePage.pageNum-3,t=this.lastVisiblePage.pageNum+3,i=this.pages;let s=4;for(;i[s];)(st)&&i[s].remove(),s++}_updatePageBoundingRects(){for(const e in this.pages)Object.prototype.hasOwnProperty.call(this.pages,e)&&this.pages[e]._updateBoundingRect()}removeInsteadOfBlurring(e){return!!(this.truncateDocument&&this.firstHiddenPageNum&&e.pageNum>=this.firstHiddenPageNum)||(!!P.disablePageBlur||"undefined"===typeof Scribd)}addPage(e){if(!this.firstHiddenPageNum&&e.blur&&(this.firstHiddenPageNum=e.pageNum),!this.removeInsteadOfBlurring(e)){if(void 0===e.pageNum)throw Error("must have pageNum param");if(e.docManager=this,e.innerPageElem){const t=e.innerPageElem.querySelectorAll(".absimg");for(let i=0;i{this.setViewManager(e,t)})}_setViewManager(e,t){t||this._currentViewManager.unregister();const i=this._currentViewManager;this._currentViewManager=this.viewManagers[e],this._currentViewManager.register(this,this.viewportManager),this.fireEvent("viewmodeChanged",this.viewMode(),i?i.name():null)}setInitialViewManager(e){if(this._currentViewManager)throw Error("This should be called before any view manager exists");this._setViewManager(e,!0),this.fireEvent("viewmodeInitialized",this.viewMode(),null)}setDefaultWidth(e){this._currentViewManager._currentPageWidth=e,this._currentViewManager._currentZoomMultiplier=1,this._currentViewManager._updatePageWidths()}subImageSrc(e){if(!this._imageDomainSubstitutionList||0===this._imageDomainSubstitutionList.length)return;const t=this._imageDomainSubstitutionList[0];return e.replace(this._imageDomainSubstitutionFrom,t)}allPagesAdded(){if(this._allPagesAddedCalled)throw Error("can only call allPagesAdded once");this.viewportManager.enable(),this._updatePageBoundingRects(),this.setInitialViewManager(this.defaultViewMode),this.fireEvent("allPagesAdded")}setEmbeddedDoc(e){this._isEmbed="True"===e}setPageWidths(e){this._pageWidths=e;for(const t in this.pages)Object.prototype.hasOwnProperty.call(this.pages,t)&&this.pages[t].setWidth(this._pageWidths);this._updatePageBoundingRects()}addFont(e,t,i,s,n,a){this._fontLoader.addFont(e,t,i,s,n,a)}initStyles(){this._fontLoader.initStyles()}gotoPage(e,t){const i=!(e%1===0);let s=null;if(i&&(s=+(e%1).toFixed(2),e=Math.floor(e)),ethis.maximumPageNumber())return;t||(t={}),i&&void 0===t.frac&&(t.frac=s);const n=t.direction||0;let a=this.pages[e];void 0===a&&this._isPaidDocument&&(e=this.getClosestPageNumber(e,n),a=this.pages[e]),this.mobile&&this.pages[e]&&this.pages[e].setWidth(this._pageWidths),this._updateExpectedFirstPage(e),this._currentViewManager.gotoPage(this._expectedFirstPageNum,t)}gotoPreviousPage(){const e=this._currentViewManager._pagingStep();this._currentViewManager.isTopPageInView()?this.gotoPage(this._expectedFirstPageNum-e,{direction:-1}):this.gotoPage(this._expectedFirstPageNum,{direction:-1})}gotoNextPage(){const e=this._currentViewManager._pagingStep();this.gotoPage(this._expectedFirstPageNum+e,{direction:1})}enterFullscreen(){this._currentViewManager.enterFullscreen()}exitFullscreen(){this._currentViewManager.exitFullscreen()}isFullscreen(){return this._currentViewManager.isFullscreen}_fireEnteredFullscreen(){this.fireEvent("enteredFullscreen")}_fireExitedFullscreen(){this.fireEvent("exitedFullscreen")}viewMode(){return this._currentViewManager?this._currentViewManager.name():null}zoom(e){this._currentViewManager.zoom(e)}resetZoom(){this._currentViewManager.resetZoom()}setImageDomainSubstitution(e,t){this._imageDomainSubstitutionFrom=e,this._imageDomainSubstitutionList=t}disableViewManagerResizeWidth(){o.prototype._setBodyWidth=function(){}}disable(){this.disabled||(this.disabled=!0,this.viewportManager.disable())}disableCopyPasteOnPage(e){f.forEach(function(t){e.addEventListener(t,_)}),e.setAttribute("unselectable","on"),e.querySelectorAll("*").forEach(function(e){e.setAttribute("unselectable","on")})}enableCopyPasteOnPage(e){f.forEach(function(t){e.removeEventListener(t,_)}),e.removeAttribute("unselectable"),e.querySelectorAll("*").forEach(function(e){e.removeAttribute("unselectable")})}setJQuery(){console.info("DocumentManager.setJQuery is deprecated. jQuery is no longer a dependency.")}}return i(P,"EVENT_NAMES",["expectedFirstPageChanged","mostVisiblePageChanged","viewmodeChanged","enteredFullscreen","exitedFullscreen","hideExtras","showExtras","zoomed","pageHide","pageLoaded","allPagesAdded","pageView","visiblePagesChanged","viewmodeInitialized"]),P}();
0% found this document useful (0 votes)
2K views4 pages

Monster Workshop's Tonk - Paper Toy

Monster Workshop's Paper toy competition We're teaming up with Plastic and Plush and offering followers the chance of owning a bespoke piece of Plush Art. Simply construct your very own pa...

Uploaded by

stitchesandglue
0% found this document useful (0 votes)
2K views4 pages

Monster Workshop's Tonk - Paper Toy

Monster Workshop's Paper toy competition We're teaming up with Plastic and Plush and offering followers the chance of owning a bespoke piece of Plush Art. Simply construct your very own paper monster, by downloading the patterns provided below (designed by Alexander Gweynne) and take a photo of your creation and send it back to us. The more interesting the better and we would encourage participants to be creative and inventive of their surroundings. The winning submission will win themselves their very own, one-off custom 'Monster Workshop' monster, selecting from a wide number of options available, with its own unique story. There will also be two runner up prizes of lucky monster claws. Email your submissions to: mail@stitchesandglue.com Each submission will be posted up on Plastic and Plush's website, our facebook fan page and Flikr pages. The competition will run until Sunday the 13th of June. We look forward to seeing what you come up with!

0% found this document useful (0 votes)
2K views4 pages

Monster Workshop's Tonk - Paper Toy

Monster Workshop's Paper toy competition We're teaming up with Plastic and Plush and offering followers the chance of owning a bespoke piece of Plush Art. Simply construct your very own pa...

Uploaded by

stitchesandglue
You are on page 1/ 4
576648e32a3d8b82ca71961b7a986505

AltStyle によって変換されたページ (->オリジナル) /