web/static-dist/libs/iframe-resizer-contentWindow.js

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

!function(e){function t(o,i){if(n[o])return n[o].exports;var r={i:o,l:!1,exports:{}};return 0!=i&&(n[o]=r),e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/static-dist/",t(t.s=14)}({14:function(e,t,n){e.exports=n("ef8ff13f7a123fc8d965")},a50cfb5e0ca3918fbabe:function(e,t){!function(e,t){"use strict";function n(t,n,o){"addEventListener"in e?t.addEventListener(n,o,!1):"attachEvent"in e&&t.attachEvent("on"+n,o)}function o(t,n,o){"removeEventListener"in e?t.removeEventListener(n,o,!1):"detachEvent"in e&&t.detachEvent("on"+n,o)}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(t){se&&e.console}function a(t){e.console}function u(){c(),r("Initialising iFrame ("+location.href+")"),s(),d(),f("background",K),f("padding",$),I(),v(),y(),m(),w(),b(),ae=N(),W("init","Init message from host page"),we()}function c(){function e(e){return"true"===e}var n=re.substr(fe).split(":");de=n[0],X=t!==n[1]?Number(n[1]):X,G=t!==n[2]?e(n[2]):G,se=t!==n[3]?e(n[3]):se,ue=t!==n[4]?Number(n[4]):ue,U=t!==n[6]?e(n[6]):U,Y=n[7],oe=t!==n[8]?n[8]:oe,K=n[9],$=n[10],ye=t!==n[11]?Number(n[11]):ye,ae.enable=t!==n[12]&&e(n[12]),ge=t!==n[13]?n[13]:ge,Me=t!==n[14]?n[14]:Me}function s(){function t(e,t){return"function"==typeof e&&(r("Setup custom "+t+"CalcMethod"),Ce[t]=e,e="custom"),e}"iFrameResizer"in e&&Object===e.iFrameResizer.constructor&&(!function(){var t=e.iFrameResizer;r("Reading data from page: "+JSON.stringify(t)),Ne="messageCallback"in t?t.messageCallback:Ne,we="readyCallback"in t?t.readyCallback:we,ve="targetOrigin"in t?t.targetOrigin:ve,oe="heightCalculationMethod"in t?t.heightCalculationMethod:oe,Me="widthCalculationMethod"in t?t.widthCalculationMethod:Me}(),oe=t(oe,"height"),Me=t(Me,"width")),r("TargetOrigin for parent set to: "+ve)}function l(e,t){return-1!==t.indexOf("-")&&(a("Negative CSS value ignored for "+e),t=""),t}function f(e,n){t!==n&&""!==n&&"null"!==n&&(document.body.style[e]=n,r("Body "+e+' set to "'+n+'"'))}function d(){t===Y&&(Y=X+"px"),f("margin",l("margin",Y))}function m(){document.documentElement.style.height="",document.body.style.height="",r('HTML & body height set to "auto"')}function g(t){function a(){W(t.eventName,t.eventType)}var u={add:function(t){n(e,t,a)},remove:function(t){o(e,t,a)}};t.eventNames&&Array.prototype.map?(t.eventName=t.eventNames[0],t.eventNames.map(u[t.method])):u[t.method](t.eventName),r(i(t.method)+" event listener: "+t.eventType)}function h(e){g({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),g({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),g({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),g({method:e,eventType:"Input",eventName:"input"}),g({method:e,eventType:"Mouse Up",eventName:"mouseup"}),g({method:e,eventType:"Mouse Down",eventName:"mousedown"}),g({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),g({method:e,eventType:"Print",eventName:["afterprint","beforeprint"]}),g({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),g({method:e,eventType:"Touch Start",eventName:"touchstart"}),g({method:e,eventType:"Touch End",eventName:"touchend"}),g({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),g({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),g({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),g({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===ge&&g({method:e,eventType:"IFrame Resized",eventName:"resize"})}function p(e,t,n,o){return t!==e&&(e in n||(a(e+" is not a valid option for "+o+"CalculationMethod."),e=t),r(o+' calculation method set to "'+e+'"')),e}function v(){oe=p(oe,ne,Ae,"height")}function y(){Me=p(Me,Oe,ze,"width")}function b(){!0===U?(h("add"),x()):r("Auto Resize disabled")}function T(){r("Disable outgoing messages"),he=!1}function E(){r("Remove event listener: Message"),o(e,"message",J)}function S(){null!==_&&_.disconnect()}function O(){h("remove"),S(),clearInterval(ce)}function M(){T(),E(),!0===U&&O()}function I(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",document.body.appendChild(e)}function N(){function o(){return{x:e.pageXOffset!==t?e.pageXOffset:document.documentElement.scrollLeft,y:e.pageYOffset!==t?e.pageYOffset:document.documentElement.scrollTop}}function i(e){var t=e.getBoundingClientRect(),n=o();return{x:parseInt(t.left,10)+parseInt(n.x,10),y:parseInt(t.top,10)+parseInt(n.y,10)}}function u(e){var n=e.split("#")[1]||e,o=decodeURIComponent(n),a=document.getElementById(o)||document.getElementsByName(o)[0];t!==a?function(e){var t=i(e);r("Moving to in page link (#"+n+") at x: "+t.x+" y: "+t.y),V(t.y,t.x,"scrollToOffset")}(a):(r("In page link (#"+n+") not found in iFrame, so sending to parent"),V(0,0,"inPageLink","#"+n))}function c(){""!==location.hash&&"#"!==location.hash&&u(location.href)}function s(){function e(e){function t(e){e.preventDefault(),u(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&n(e,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function l(){n(e,"hashchange",c)}function f(){setTimeout(c,Z)}return ae.enable?function(){Array.prototype.forEach&&document.querySelectorAll?(r("Setting up location.hash handlers"),s(),l(),f()):a("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}():r("In page linking not enabled"),{findTarget:u}}function w(){r("Enable public methods"),Ie.parentIFrame={autoResize:function(e){return!0===e&&!1===U?(U=!0,b()):!1===e&&!0===U&&(U=!1,O()),U},close:function(){V(0,0,"close"),M()},getId:function(){return de},getPageInfo:function(e){"function"==typeof e?(ke=e,V(0,0,"pageInfo")):(ke=function(){},V(0,0,"pageInfoStop"))},moveToAnchor:function(e){ae.findTarget(e)},reset:function(){B("parentIFrame.reset")},scrollTo:function(e,t){V(t,e,"scrollTo")},scrollToOffset:function(e,t){V(t,e,"scrollToOffset")},sendMessage:function(e,t){V(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){oe=e,v()},setWidthCalculationMethod:function(e){Me=e,y()},setTargetOrigin:function(e){r("Set targetOrigin: "+e),ve=e},size:function(e,t){W("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}}}function k(){0!==ue&&(r("setInterval: "+ue+"ms"),ce=setInterval(function(){W("interval","setInterval: "+ue)},Math.abs(ue)))}function C(){function n(e){function t(e){!1===e.complete&&(r("Attach listeners to "+e.src),e.addEventListener("load",u,!1),e.addEventListener("error",c,!1),l.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function o(e){l.splice(l.indexOf(e),1)}function i(e){r("Remove listeners from "+e.src),e.removeEventListener("load",u,!1),e.removeEventListener("error",c,!1),o(e)}function a(e,n,o){i(e.target),W(n,o+": "+e.target.src,t,t)}function u(e){a(e,"imageLoad","Image loaded")}function c(e){a(e,"imageLoadFailed","Image load failed")}function s(e){W("mutationObserver","mutationObserver: "+e[0].target+" "+e[0].type),e.forEach(n)}var l=[],f=e.MutationObserver||e.WebKitMutationObserver,d=function(){var e=document.querySelector("body"),t={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return d=new f(s),r("Create body MutationObserver"),d.observe(e,t),d}();return{disconnect:function(){"disconnect"in d&&(r("Disconnect body MutationObserver"),d.disconnect(),l.forEach(i))}}}function x(){var t=0>ue;e.MutationObserver||e.WebKitMutationObserver?t?k():_=C():(r("MutationObserver not supported in this browser!"),k())}function A(e,t){var n=0;return t=t||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(n=document.defaultView.getComputedStyle(t,null),n=null!==n?n[e]:0):n=function(e){if(/^\d+(px)?$/i.test(e))return parseInt(e,j);var n=t.style.left,o=t.runtimeStyle.left;return t.runtimeStyle.left=t.currentStyle.left,t.style.left=e||0,e=t.style.pixelLeft,t.style.left=n,t.runtimeStyle.left=o,e}(t.currentStyle[e]),parseInt(n,j)}function z(e){e>Ee/2&&(Ee=2*e,r("Event throttle increased to "+Ee+"ms"))}function R(e,t){for(var n=t.length,o=0,a=0,u=i(e),c=xe(),s=0;s<n;s++)(o=t[s].getBoundingClientRect()[e]+A("margin"+u,t[s]))>a&&(a=o);return c=xe()-c,r("Parsed "+n+" HTML elements"),r("Element position calculated in "+c+"ms"),z(c),a}function L(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function P(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length?function(){return a("No tagged elements ("+t+") found on page"),te}():R(e,n)}function F(){return document.querySelectorAll("body *")}function D(e,n,o,i){function a(){return!(e in{init:1,interval:1,size:1})}function u(){return oe in me||G&&Me in me}function c(){r("No change in size detected")}var s,l;!function(){function e(e,t){return!(Math.abs(e-t)<=ye)}return s=t!==o?o:Ae[oe](),l=t!==i?i:ze[Me](),e(te,s)||G&&e(Se,l)}()&&"init"!==e?function(){a()&&u()?B(n):e in{interval:1}||c()}():(H(),function(){te=s,Se=l,V(te,Se,e)}())}function W(e,t,n,o){!function(){return be&&e in Q}()?(!function(){e in{reset:1,resetPage:1,init:1}||r("Trigger event: "+t)}(),Re(e,t,n,o)):r("Trigger event cancelled: "+e)}function H(){be||(be=!0,r("Trigger event lock on")),clearTimeout(Te),Te=setTimeout(function(){be=!1,r("Trigger event lock off"),r("--")},Z)}function q(e){te=Ae[oe](),Se=ze[Me](),V(te,Se,e)}function B(e){var t=oe;oe=ne,r("Reset trigger event: "+e),H(),q("reset"),oe=t}function V(e,n,o,i,a){!0===he&&(function(){t===a?a=ve:r("Message targetOrigin: "+a)}(),function(){var u=e+":"+n,c=de+":"+u+":"+o+(t!==i?":"+i:"");r("Sending message to host page ("+c+")"),pe.postMessage(le+c,a)}())}function J(t){function o(){document.body?function(){re=t.data,pe=t.source,u(),ee=!1,setTimeout(function(){ie=!1},Z)}():(r("Waiting for page ready"),n(e,"readystatechange",o))}function i(){ie?r("Page reset ignored by init"):(r("Page size reset by host page"),q("resetPage"))}function c(){W("resizeParent","Parent window requested size check")}function s(){var e=f();ae.findTarget(e)}function l(){return t.data.split("]")[1].split(":")[0]}function f(){return t.data.substr(t.data.indexOf(":")+1)}function d(){return"iFrameResize"in e}function m(){var e=f();r("MessageCallback called from parent: "+e),Ne(JSON.parse(e)),r(" --")}function g(){var e=f();r("PageInfoFromParent called from parent: "+e),ke(JSON.parse(e)),r(" --")}function h(){return t.data.split(":")[2]in{true:1,false:1}}function p(){switch(l()){case"reset":i();break;case"resize":c();break;case"inPageLink":case"moveToAnchor":s();break;case"message":m();break;case"pageInfo":g();break;default:d()||h()||a("Unexpected message ("+t.data+")")}}(function(){return le===(""+t.data).substr(0,fe)})()&&function(){!1===ee?p():h()?o():r('Ignored message of type "'+l()+'". Received before initialization.')}()}var U=!0,j=10,K="",X=0,Y="",_=null,$="",G=!1,Q={resize:1,click:1},Z=128,ee=!0,te=1,ne="bodyOffset",oe=ne,ie=!0,re="",ae={},ue=32,ce=null,se=!1,le="[iFrameSizer]",fe=le.length,de="",me={max:1,min:1,bodyScroll:1,documentElementScroll:1},ge="child",he=!0,pe=e.parent,ve="*",ye=0,be=!1,Te=null,Ee=16,Se=1,Oe="scroll",Me=Oe,Ie=e,Ne=function(){a("MessageCallback function not defined")},we=function(){},ke=function(){},Ce={height:function(){return a("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return a("Custom width calculation function not defined"),document.body.scrollWidth}},xe=Date.now||function(){return(new Date).getTime()},Ae={bodyOffset:function(){return document.body.offsetHeight+A("marginTop")+A("marginBottom")},offset:function(){return Ae.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return Ce.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,L(Ae))},min:function(){return Math.min.apply(null,L(Ae))},grow:function(){return Ae.max()},lowestElement:function(){return Math.max(Ae.bodyOffset(),R("bottom",F()))},taggedElement:function(){return P("bottom","data-iframe-height")}},ze={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return Ce.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(ze.bodyScroll(),ze.documentElementScroll())},max:function(){return Math.max.apply(null,L(ze))},min:function(){return Math.min.apply(null,L(ze))},rightMostElement:function(){return R("right",F())},taggedElement:function(){return P("right","data-iframe-width")}},Re=function(e){var t,n,o,i=null,r=0,a=function(){r=xe(),i=null,o=e.apply(t,n),i||(t=n=null)};return function(){var u=xe();r||(r=u);var c=Ee-(u-r);return t=this,n=arguments,c<=0||c>Ee?(i&&(clearTimeout(i),i=null),r=u,o=e.apply(t,n),i||(t=n=null)):i||(i=setTimeout(a,c)),o}}(D);n(e,"message",J),function(){"loading"!==document.readyState&&e.parent.postMessage("[iFrameResizerChild]Ready","*")}()}(window||{})},ef8ff13f7a123fc8d965:function(e,t,n){"use strict";n("a50cfb5e0ca3918fbabe")}});

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。