Facebook
From Idiotic Cassowary, 4 Years ago, written in Diff-output.
This paste is a reply to Untitled from Botched Capybara - view diff
Embed
Download Paste or View Raw
Hits: 342
  1. var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){function n(t,n){if(e.Blob&&t.blob instanceof e.Blob){if(!m&&URL&&URL.createObjectURL)n(URL.createObjectURL(t.blob));else if(e.FileReader){var r=new FileReader;r.onload=function(e){n(r.result)},r.readAsDataURL(t.blob)}}else n("data:"+t.type+";base64,"+btoa(t.bytes))}function r(e,r){var o=t.createElement("iframe");if(S){o.setAttribute("sandbox","allow-scripts"+(w?"":" allow-same-origin"));var i=function(t){n({blob:new Blob(["<html><head><meta http-equiv=\"Content-Security-Policy\" content=\"frame-src blob: data: 'self' 'unsafe-inline'; child-src blob: data: 'self' 'unsafe-inline'\"></head><body><script>"+_+'<\/script><iframe id="frame" src="'+t+'" sandbox="allow-scripts" width="100%" height="100%" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" frameborder="0"></iframe></body></html>'],{type:"text/html"})},function(t){o.src=t,o.onload=function(){o.contentWindow.postMessage(e,"*")},r(o)})};w?i("about:blank"):n(e,i)}else{o.src="about:blank",o.setAttribute("sandbox","allow-scripts allow-same-origin"),r(o);var i=function(e){var t=o.contentWindow.document,n=t.createElement("iframe");n.setAttribute("id","frame"),n.src="about:blank",R(n);var r=t.createElement("meta");r.setAttribute("http-equiv","Content-Security-Policy"),r.setAttribute("content","frame-src blob:; child-src blob:"),o.contentWindow.eval(_),setTimeout(function(){t.head.appendChild(r),t.body.appendChild(n),n.contentWindow.contents=e,n.src='javascript:window["contents"]',n.setAttribute("sandbox","allow-scripts")},1)};if(C&&e instanceof Blob){var a=new FileReader;a.onload=function(e){i(a.result)},a.readAsBinaryString?a.readAsBinaryString(e):a.readAsText(e)}else i(e.bytes)}}function o(e,t){var r=new Image;n(e,function(n){e.originalUrl&&n.length>32e3?(r.onerror=function(){r=new Image,r.src=e.originalUrl,t(r)},r.onload=function(){t(r)},r.src=n):(r.src=n,t(r))})}function a(e){if("string"==typeof e){var n=t.createElement("a");n.href=e,e=n}return e.protocol+"//"+("80"!==e.port&&"443"!==e.port?e.host:e.hostname)}function s(t,n){var r,n=n||{},o=new XMLHttpRequest;if(!supportBinaryFetch&&a(t)!=a(e.location)){o=new XDomainRequest,r=!0;var i=t,l=t.indexOf("?");t+=-1==l?"?xdr":l==t.length-1?"xdr":"&xdr",o.__parseHeaders=function(e){this.__responseHeaders={};for(var e=e.split("\n"),t=0;t<e.length;t++){var n=e[t].indexOf(":");this.__responseHeaders[e[t].substring(0,n)]=e[t].substr(n+1)}},o.getResponseHeader=function(e){return this.__responseHeaders[e]}}if(!r)try{o.withCredentials=!0}catch(e){}if(n.binary&&C){try{o.responseType="blob"}catch(e){C=!1}"blob"!=o.responseType&&(C=!1)}n.binary&&!C&&o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.open(n.method||"GET",t),s.timeout&&(o.timeout=s.timeout);var c,d;return o.ontimeout=function(e){d&&d()},o.then=function(e,t){c=e,d=t},r?(o.onerror=o.ontimeout,o.onload=function(){var e={bytes:o.responseText,type:o.contentType};if(-1!=e.type.indexOf("text/base64")){e.type=e.type.split(",")[1];var t=e.bytes.indexOf("\n\n");-1!=t?(o.__parseHeaders(e.bytes.substring(0,t)),e.bytes=atob(e.bytes.substr(t+2))):e.bytes=atob(e.bytes),e.originalUrl=i}n.json&&(e=JSON.parse(e.bytes)),c&&c(e,o)}):o.onreadystatechange=function(){if(4==o.readyState){var e=o.status>=200&&o.status<400?c:d;if(e){var t;if(n.binary)try{if(C){var r=new FileReader;return r.onload=function(n){t={bytes:r.result,type:o.response.type,blob:o.response},e&&e(t,o)},void(r.readAsBinaryString?r.readAsBinaryString(o.response):r.readAsText(o.response))}var i;try{i=o.responseBody.toArray()}catch(e){}if(i){for(var a=0,s=i.length,l=[];a<s;)l.push(String.fromCharCode.apply(String,i.slice(a,a+1e4))),a+=1e4;t={bytes:t=l.join(""),type:o.getResponseHeader("Content-Type")}}else t={bytes:n.binary?o.responseText.replace(/.{1}/g,function(e){return String.fromCharCode(255&e.charCodeAt(0))}):o.responseText,type:o.getResponseHeader("Content-Type")}}catch(e){t=null}else t={bytes:o.responseText,type:o.getResponseHeader("Content-Type")};n.json&&(t=JSON.parse(t.bytes)),e&&e(t,o)}}},setTimeout(function(){n.post?(o.setRequestHeader&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.send(n.post)):o.send()},0),o}function l(n){if(1!=n.nodeType)return!0;for(;n!=t.body;){if(!e.getComputedStyle)return!n.currentStyle||"none"!=n.currentStyle.display&&"hidden"!=n.currentStyle.visibility;var r=t.defaultView.getComputedStyle(n,null);if("none"==r.getPropertyValue("display")||"hidden"==r.getPropertyValue("visibility"))return!1;n=n.parentNode}return!0}function c(e){return!isNaN(1*e)}function d(n,r){var o=0,i=0,a=n.offsetWidth,s=n.offsetHeight;if(r){var l=e.getComputedStyle(n);"visible"==l.overflowX&&(a=2e5,o=-1e5),"visible"==l.overflowY&&(s=2e5,i=-1e5)}do{o+=n.offsetLeft-n.scrollLeft,i+=n.offsetTop-n.scrollTop}while(n=n==t.body?t.documentElement:n.offsetParent);return{top:i,bottom:i+s,left:o,right:o+a,width:a,height:s}}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=function(e){this.message=e};f.prototype=new Error,f.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var t,n,r=String(e),o=0,i=u,a="";r.charAt(0|o)||(i="=",o%1);a+=i.charAt(63&t>>8-o%1*8)){if((n=r.charCodeAt(o+=.75))>255)throw new f("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");t=t<<8|n}return a}),e.atob||(e.atob=function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new f("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,i=0,a="";r=t.charAt(i++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r=u.indexOf(r);return a}),"function"!=typeof Array.prototype.forEach&&(Array.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e.apply(this,[this[t],t,this])}),Function.prototype.bind||(Function.prototype.bind=function(e){var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},o=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return r.prototype=this.prototype,o.prototype=new r,o});var h=function(e,t,n,r){return e.addEventListener?e.addEventListener(t,n,r):e.attachEvent("on"+t,n)},p=function(){function n(e){var t;for(t=0;t<e.length;t+=1)e[t](u)}function r(){var e=f;d&&e.length&&(f=[],n(e))}function o(){d||(d=!0,l&&clearInterval(l),r())}function i(e){return d?e(u):f.push(e),i}var a,s,l,c=void 0!==e&&e.document,d=!c,u=c?t:null,f=[];if(c){if(t.addEventListener)t.addEventListener("DOMContentLoaded",o,!1),e.addEventListener("load",o,!1);else if(e.attachEvent){e.attachEvent("onload",o),s=t.createElement("div");try{a=null===e.frameElement}catch(e){}s.doScroll&&a&&e.external&&(l=setInterval(function(){try{s.doScroll(),o()}catch(e){}},30))}"complete"===t.readyState&&o()}return i}(),v=function(e){return btoa(e).replace(/=|\+|\//g,function(e){return"+"==e?"-":"/"==e?"_":""})},b=function(e,t,n){if("object"!=(void 0===t?"undefined":_typeof(t))){var r=t;t={},t[r]=n}for(var o in t){n=t[o];var i=o+"="+encodeURIComponent(n),a=e.indexOf("?");e+=a>-1?(a<e.length?"&":"")+i:"?"+i}return e},y=!!t.documentMode,g=!y&&!!e.StyleMedia,m=!navigator.userAgent||!navigator.userAgent.match||navigator.userAgent.match("CriOS"),w=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,A=new XMLHttpRequest;supportBinaryFetch=!y||A.upload;var S=!y&&!g,C=e.Blob&&e.FileReader&&FileReader.prototype.hasOwnProperty("readAsBinaryString")&&(FileReader.prototype.hasOwnProperty("readAsDataURL")||e.URL&&URL.createObjectURL),R=function(e){e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("marginwidth","0"),e.setAttribute("marginheight","0"),e.setAttribute("vspace","0"),e.setAttribute("hspace","0"),e.setAttribute("allowtransparency","true"),e.setAttribute("scrolling","no"),e.setAttribute("frameborder","0")},_='var isCriOS = !navigator.userAgent || !navigator.userAgent.match || navigator.userAgent.match(\'CriOS\');function getDataURI(data, callback) {\n    if (window.Blob && data.blob instanceof window.Blob) {\n        if (!isCriOS && URL && URL.createObjectURL) {\n            callback(URL.createObjectURL(data.blob));\n        } else if (window.FileReader) {\n            var reader = new FileReader();\n            reader.onload = function (e) {\n                callback(reader.result);\n            }\n            reader.readAsDataURL(data.blob);\n        }\n        return;\n    }\n    callback(\'data:\' + data.type + \';base64,\' + btoa(data.bytes));\n}var addListener = function (element, event, handler, phase) {    if (element.addEventListener) {        return element.addEventListener(event, handler, phase);    } else {        return element.attachEvent("on" + event, handler);    }};addListener(window, "message", function (event) {    var iframe = document.getElementById("frame");    if(iframe.src == "about:blank")  {       getDataURI(event.data, function(dataUri) {           iframe.src = dataUri;       });       return;    }    var targets = [iframe.contentWindow, parent];    var target;    if (event.source == targets[0]) {        target = targets[1];    }    else if(event.source == targets[1]) {        target = targets[0];    }     if(target) {        target.postMessage(event.data, "*");     }});',x=function(){},E={reset:function(){this._hash=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)},digest:function(e,t){this.reset();var n=new Array(16),r=e.length,o=r>>>6<<6,i=8*r,a=this,s=0,l=function(){for(var s=0;s<16;s++)n[s]=0;for(var s=o;s<r;s++)n[(s>>>2)%16]|=e.charCodeAt(s)<<24-s%4*8;n[(r>>>2)%16]|=128<<24-r%4*8;var l=Math.floor(i/4294967296);if((r>>>2)%16<14)n[14]=l,n[15]=i,a.doBlock(n,0);else{a.doBlock(n,0);for(var s=0;s<14;s++)n[s]=0;n[14]=l,n[15]=i,a.doBlock(n,0)}t(a.toHex(a._hash))};!function t(){for(var r,i=new Date,c=s;c<o;c+=64){for(r=0;r<16;r++)n[r]=e.charCodeAt(s++)<<24|e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++);if(a.doBlock(n,0),s%16e3==0&&new Date-i>50)return void setTimeout(t,0)}l()}()},toHex:function(e){for(var t=4*e.length,n=[],r=0;r<t;r++){var o=e[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},doBlock:function(e){for(var t,n,r=this._hash,o=this.W,i=r[0],a=r[1],s=r[2],l=r[3],c=r[4],d=0;d<16;)o[d]=0|e[d],t=(i<<5|i>>>27)+c+o[d]+(a&s|~a&l)+1518500249,c=l,l=s,s=a<<30|a>>>2,a=i,i=t,d++;for(;d<20;)n=o[d-3]^o[d-8]^o[d-14]^o[d-16],o[d]=n<<1|n>>>31,t=(i<<5|i>>>27)+c+o[d]+(a&s|~a&l)+1518500249,c=l,l=s,s=a<<30|a>>>2,a=i,i=t,d++;for(;d<40;)n=o[d-3]^o[d-8]^o[d-14]^o[d-16],o[d]=n<<1|n>>>31,t=(i<<5|i>>>27)+c+o[d]+(a^s^l)+1859775393,c=l,l=s,s=a<<30|a>>>2,a=i,i=t,d++;for(;d<60;)n=o[d-3]^o[d-8]^o[d-14]^o[d-16],o[d]=n<<1|n>>>31,t=(i<<5|i>>>27)+c+o[d]+(a&s|a&l|s&l)-1894007588,c=l,l=s,s=a<<30|a>>>2,a=i,i=t,d++;for(;d<80;)n=o[d-3]^o[d-8]^o[d-14]^o[d-16],o[d]=n<<1|n>>>31,t=(i<<5|i>>>27)+c+o[d]+(a^s^l)-899497514,c=l,l=s,s=a<<30|a>>>2,a=i,i=t,d++;r[0]=r[0]+i|0,r[1]=r[1]+a|0,r[2]=r[2]+s|0,r[3]=r[3]+l|0,r[4]=r[4]+c|0}};for(var O in E)x.prototype[O]=E[O];var L,T=[],B=function e(t,n){if(!n.$delayed&&(T.push([t,n]),T.length>1))return void(n.$delayed=!0);(new x).digest(t,function(t){n(t),T.shift(),T.length>=1&&setTimeout(e.bind(this,T[0][0],T[0][1]),0)})},k=function(t,n){if(e.Blob&&t instanceof Blob){var r=new FileReader;r.onload=function(e){B(r.result,function(e){n(e)})},r.readAsBinaryString?r.readAsBinaryString(t):r.readAsText(t)}else{new Date;B(t.bytes,function(e){n(e)})}},T=[],B=function e(t,n){if(!n.$delayed&&(T.push([t,n]),T.length>1))return void(n.$delayed=!0);try{crypto.subtle.digest("SHA-1",t).then(function(e){n(U(e))}).catch(function(e){n("NO_SUPPORT")})}catch(e){n("NO_SUPPORT")}T.shift(),T.length>=1&&setTimeout(e.bind(this,T[0][0],T[0][1]),0)},U=function(e){for(var t=[],n=new DataView(e),r=0;r<n.byteLength;r+=4){var o=n.getUint32(r),i=o.toString(16),a=("00000000"+i).slice(-"00000000".length);t.push(a)}return t.join("")},k=function(t,n){if(e.Blob&&t instanceof Blob){var r=new FileReader;r.onload=function(e){B(r.result,n)},r.readAsArrayBuffer(t)}else{var o=new Uint8Array(t.bytes.length);for(i=0,len=t.bytes.length;i<len;i++)o[i]=t.bytes.charCodeAt(i);B(o,function(e){n(e)})}},H=function(e){for(var t={},n=0,r=[null],o=0;o<e.length;o++){var i=e[o],a=[];for(var s in i)i.hasOwnProperty(s)&&(t[s]||(t[s]=n++),a.push(t[s]+"\t"+i[s]));r.push(a.join("\r"))}var a=[];for(var s in t)t.hasOwnProperty(s)&&a.push(s),r[0]=a.join("\t");return v(r.join("\n"))},I=[],N=[],j=function(e,t){for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n].name;0!=r.indexOf("data-")&&t.setAttribute(r,e.getAttribute(r))}t.style.overflow="hidden",t.style.position="relative",e.parentNode.replaceChild(t,e)},W=function(n,r,o,i){var a=t.createElement("div"),s=M(n,r,i);if(a.appendChild(s),"IFRAME"==o.tagName)R(o),h(e,"message",function(r){if(r.source==o.contentWindow&&r.data){var i,a="string"==typeof r.data;if(i=a?JSON.parse(r.data):r.data,i.dwmthLoad){var s={dwmthLoad:1,data:n};r.source.postMessage(a?JSON.stringify(s):s,"*")}else if(i.dwmthClick){if(t.activeElement!=o)return void console.log("click without mouse interaction");if(!F(o))return void console.log("invisible click");var l=n.click_url;e.open(l,"_blank")||(e.location.href=l),t.activeElement.blur()}}}),a.appendChild(o);else{o.border="0";var l=t.createElement("a");l.target="_blank",l.href=n.click_url,l.appendChild(o),a.appendChild(l)}return a},M=function(e,n,r){var o=b("https://sgr1.com/supply/why",{bid:n.id,cid:e.cid,ctx:r,iid:z(),url:n.serve_url}),i=t.createElement("div");i.setAttribute("style","position: absolute !important; top: 0px !important; right: 0px !important;background-color: #fff !important");var a=t.createElement("a");return a.target="_blank",a.href=o,a.setAttribute("style","text-decoration: none !important;background-color: #fff !important"),a.innerHTML='<svg style="width: 16px; height: 16px; display: block;" version="1.1" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg"><path d="m11.405 1.9861v6.798c0 0.0309-0.0019 0.0617-0.0037 0.0902a1.1895 1.1895 0 0 1 -0.3426 0.77162 1.1192 1.1192 0 0 1 -0.8315 0.35834h-0.0037q-0.48088 0-0.82718-0.35865a1.1988 1.1988 0 0 1 -0.3463 -0.86205v-2e-3c0-0.0253 0-0.0503 0.00187-0.0753-0.0028-0.67655-0.15649-1.2988-0.45989-1.8602a4.3519 4.3519 0 0 0 -0.77725 -1.0493q-0.15247-0.15432-0.31235-0.28796-1.1016-0.92595-2.5596-0.9528c-0.030893 0-0.059919-2e-3 -0.090438-2e-3q-1.8417 0-3.097 1.2186-1.2553 1.2185-1.255 3.0031v8e-3q0.0028 1.747 1.2546 2.9868 1.2519 1.2398 3.0248 1.2429 1.3062 0 2.3303-0.67687-0.14908-0.12593-0.29167-0.26667c-0.6852-0.67903-1.1074-1.4744-1.2608-2.3741a1.1111 1.1111 0 0 1 -0.78613 0.31018q-0.48119 0-0.82717-0.35864a1.1982 1.1982 0 0 1 -0.3463 -0.86369q0-0.51297 0.34229-0.8676a1.1111 1.1111 0 0 1 0.61112 -0.3352 1.2185 1.2185 0 0 1 0.22007 -0.0198 1.117 1.117 0 0 1 0.72038 0.24692c0.024733 0.0225 0.049092 0.0456 0.072798 0.0701a1.4213 1.4213 0 0 1 0.36853 0.66792 1.3917 1.3917 0 0 1 0.020066 0.23827 4.4245 4.4245 0 0 0 0.087078 0.87626c0.14044 0.78365 0.50895 1.4652 1.1173 2.0679 0.098147 0.0972 0.33334 0.30063 0.34846 0.31328q1.0781 0.90033 2.5 0.96638c0.07252 4e-3 0.14599 5e-3 0.21976 6e-3h0.0047c0.96607 0 2.0105-0.21236 3.0195-1.2389 1.009-1.0266 1.2503-2.1661 1.2503-2.9886v-6.7992zm-1.9874 5.9023a1.1093 1.1093 0 0 1 0.80588 -0.32964h0.0037a1.1161 1.1161 0 0 1 0.7386 0.26389v-3.2195a4.2837 4.2837 0 0 0 -0.66113 -0.0515c-0.02623 0-0.05124 3e-3 -0.07746 4e-3q-1.3581 0.0194-2.3923 0.70773 0.18519 0.15185 0.35772 0.32654c0.65742 0.66175 1.0676 1.4324 1.2247 2.2991z" fill="#5fb2f9" stroke-width=".030865"/></svg>',i.appendChild(a),i},q=function(e){var n;return((n=t.documentElement)||(n=t.body.parentNode))&&c(n[e])?n:t.body},P=function(){var e,n,r=q("clientWidth"),o=t.body;return c(t.clientWidth)?{w:t.clientWidth,h:t.clientHeight}:r===o||(e=Math.max(r.clientWidth,o.clientWidth))>self.innerWidth||(n=Math.max(r.clientHeight,o.clientHeight))>self.innerHeight?{w:o.clientWidth,h:o.clientHeight}:{w:e,h:n}},F=function(e){if(!l(e))return!1;for(var n=d(e),r=n.top,o=n.height,i=n.left,a=n.width,e=e.parentNode;e!=t.body;){if(n=d(e,!0),r<=n.bottom==!1)return!1;if(i<=n.right==!1)return!1;if(r+o<n.top)return!1;if(i+a<n.left)return!1;e=e.parentNode}var s=P();return r<=s.h&&r>-o&&i<=s.w&&i>-a},z=function(){if(!L){for(var e=(new Date).getTime(),t=[],n=0;n<16;n++){var r=(e+256*Math.random())%256|0;e=Math.floor(e/256),t.push(String.fromCharCode(r))}L=v(t.join(""))}return L},D=function(e){var n="https://sgr1.com/supply/register?iid="+e;if(!N[n]){var r=J(n);t.body.appendChild(r),I.push(r.contentWindow),N[n]=1}},J=function(e){var n=t.createElement("iframe");return n.setAttribute("style","display:none"),n.setAttribute("width",1),n.setAttribute("height",1),n.setAttribute("sandbox","allow-scripts allow-same-origin"),n.src=e,n},X=function(){var e=t.querySelector("meta[name=keywords]");if(null===e)return"";if(e.content){var n=e.content.split(","),r=Math.min(10,n.length);e=[];for(var o=0;o<r;o++)e.push(n[o].trim());e=e.join(",")}return e},G=function(){return{iid:z(),frame:e==top?0:1,width:e.screen.width,height:e.screen.height,url:e.location.href,keywords:X()}};p(function(){var n=t.querySelectorAll(".xc449bad4854773ff[data-zone]"),r=n.length;if(0!=r){var o,i=[];i.push(G());for(var a=0,l=0;l<r;l++){var c=n[l];if(!c.__dwmth){c.__dwmth=1,o={},o.width=parseInt(c.offsetWidth)||parseInt(c.style.width),o.height=parseInt(c.offsetHeight)||parseInt(c.style.height);for(var d=0,u=c.attributes.length;d<u;d++){var f=c.attributes[d].name.split("-");"data"==f.shift()&&(o[f.join("-")]=c.attributes[d].value)}o.zone&&(i.push(o),a++)}}if(0!=a){D(z());var p=H(i),v="https://sgr1.com/supply/find",b={json:!0};p.length<=800?v+="?"+p:(b.method="post",b.post=p),s(v,b).then(function(e){var t=[];e.forEach(function(e,r){if(e){var o=V(e.zone_id,n,t);if(null===o&&(o=V(e.zone_id,n,[])),e.destElement=n[o],t.push(o),!e.destElement)return void console.log("no element to replace",e);if(F(e.destElement))K(e,{page:i[0],zone:i[r+1]});else var a=setInterval(function(){F(e.destElement)&&(clearInterval(a),K(e,{page:i[0],zone:i[r+1]}))},200)}})}),h(e,"message",function(e){if(I.some(function(t){return t&&t===e.source})&&e.data){var t;t="string"==typeof e.data?JSON.parse(e.data):e.data,t.insertElem&&t.insertElem.forEach(function(e){if(!(I.length>=5*a))if("iframe"==e.type){if(N[e.url])return;var t=$(e.url);I.push(t.contentWindow),N[e.url]=1}else if("img"==e.type){if(N[e.url])return;Y(e.url),I.push(null),N[e.url]=1}})}})}}});var V=function(e,t,n){if(e)for(var r=0;r<t.length;r++){var o=t[r].getAttribute("data-zone");if(!o)return;if(o.toLowerCase()===e.toLowerCase()&&(0===n.length||-1===n.indexOf(r)))return r}},$=function(e,n){if(e){n||(n=t.body.lastChild);var r=J(e);return n.parentNode.insertBefore(r,n),setTimeout(function(){r.parentElement.removeChild(r)},1e4),r}},Y=function(e,n){if(e){n||(n=t.body.lastChild);var r=new Image;return r.setAttribute("style","display:none"),r.setAttribute("width",1),r.setAttribute("height",1),r.src=e,n.parentNode.insertBefore(r,n),r}},K=function(e,t){s(e.serve_url,{binary:!0}).then(function(n,i){t.cid=i.getResponseHeader("X-"+"h:s:d:A".split(":").reverse().join("")+"ares"+"-_C_i_d".split("_").join("")),t.page.zone=t.zone.zone;var a=H([t.page]);t.click_url=b(e.click_url,{cid:t.cid,pto:e.pay_to,pfr:e.pay_from,ctx:a,iid:z()}),t.view_url=b(e.view_url,{cid:t.cid,pto:e.pay_to,pfr:e.pay_from,ctx:a,iid:z()});var s=function(){var i;(i=-1!=n.type.indexOf("image/")?o:r)(n,function(n){n=W(t,e,n),j(e.destElement,n),I.push($(t.view_url,n).contentWindow)})};e.creative_sha1?k(n,function(t){"NO_SUPPORT"===t||t==e.creative_sha1?("NO_SUPPORT"===t&&console.log("warning: hash not checked"),s()):console.log("hash error",e,t)}):s()},function(){console.log("could not fetch url",e)})}}(window,document);