Created
September 14, 2017 14:16
-
-
Save dimaslanjaka/865dd6b579156d22427efa312267c651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){function n(){l(),t()}function t(){window.addEventListener("message",a,!0)}function e(n){var t;try{t={}.toString.call(n)}catch(n){t="[object Object]"}return t}function o(n,t){for(var e=n.length;e--;)if(n[e]===t)return!0;return!1}function r(n){return!!(n&&"object"==typeof n&&"nodeType"in n&&1===n.nodeType&&n.outerHTML)}function c(n,t){return n.toLowerCase()<t.toLowerCase()?-1:1}function i(n){if(null===n||"undefined"==typeof n)return 1;var t,o=e(n);if("[object Number]"===o||"[object Boolean]"===o||"[object String]"===o)return 1;if("[object Function]"===o||"[object global]"===o)return 2;if("[object Object]"===o){var r=Object.keys(n);for(t=0;t<r.length;t++){var c=n[r[t]];if(i={}.toString.call(c),"[object Function]"===i||"[object Object]"===i||"[object Array]"===i)return 2}return 1}if("[object Array]"===o){for(t=0;t<n.length;t++){var c=n[t],i={}.toString.call(c);if("[object Function]"===i||"[object Object]"===i||"[object Array]"===i)return 2}return 1}return 2}function u(n,t,o){var r,i,l="",a=[];if(o=o||"",t=t||[],null===n)return"null";if("undefined"==typeof n)return"undefined";if(l=e(n),"[object Object]"==l&&(l="Object"),"[object Number]"==l)return""+n;if("[object Boolean]"==l)return n?"true":"false";if("[object Function]"==l)return n.toString().split("\n ").join("\n"+o);if("[object String]"==l)return'"'+n.replace(/"/g,"'")+'"';for(i=0;i<t.length;i++)if(n===t[i])return"[circular "+l.slice(1)+("outerHTML"in n?" :\n"+n.outerHTML.split("\n").join("\n"+o):"");if(t.push(n),"[object Array]"==l){for(r=0;r<n.length;r++)a.push(u(n[r],t));return"["+a.join(", ")+"]"}if(l.match(/Array/))return l;var f=l+" ",s=o+" ";if(o.length/2<2){var b=[];try{for(r in n)b.push(r)}catch(n){}for(b.sort(c),r=0;r<b.length;r++)try{a.push(s+b[r]+": "+u(n[b[r]],t,s))}catch(n){}}return a.length?f+"{\n"+a.join(",\n")+"\n"+o+"}":f+"{}"}function l(){if(window.console)for(var n=0;n<f.length;n++)!function(){var t=f[n];window.console[t]&&(window.console[t]=function(){for(var n=[].slice.call(arguments),e=[],o=[],c=0;c<n.length;c++)r(n[c])?(o.push(u(n[c].outerHTML)),e.push(1)):(o.push(u(n[c])),e.push(i(n[c])));b.postMessage(["console",{"function":t,arguments:o,complexity:Math.max.apply(null,e)}],"*"),this.apply(console,n)}.bind(console[t]))}()}function a(n){var t=n.data;if("object"==typeof t&&"command"===t.type){try{var e=window.eval(t.command)}catch(n){return void console.error(n.message)}if(.30000000000000004===e)return void console.log("I love JavaScript too.");if(o(s,t.command))return void console.log("Plz no WATS.");console.log(e)}}var f=["log","error","warn","info","debug","table","time","timeEnd","count","clear"],s=["({} + [])","({} + []);","({} + [])","({} + []);","{} + {}","{} + {};","({} + {})","({} + {});","[] == []","[] == [];","[] == ![]","[] == ![];","[] + []","[] + [];"],b=window.parent;n()}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CSSReload={head:null,init:function(){this._storeHead(),this._listenToPostMessages()},_storeHead:function(){this.head=document.head||document.getElementsByTagName("head")[0]},_listenToPostMessages:function(){var e=this;window[this._eventMethod()](this._messageEvent(),function(t){try{var s=JSON.parse(t.data);"string"==typeof s.css&&e._refreshCSS(s)}catch(e){}},!1)},_messageEvent:function(){return"attachEvent"===this._eventMethod()?"onmessage":"message"},_eventMethod:function(){return window.addEventListener?"addEventListener":"attachEvent"},_refreshCSS:function(e){var t=this._findPrevCPStyle(),s=document.createElement("style");s.type="text/css",s.className="cp-pen-styles",s.styleSheet?s.styleSheet.cssText=e.css:s.appendChild(document.createTextNode(e.css)),this.head.appendChild(s),t&&t.parentNode.removeChild(t),"prefixfree"===e.css_prefix&&StyleFix.process()},_findPrevCPStyle:function(){for(var e=document.getElementsByTagName("style"),t=e.length-1;t>=0;t--)if("cp-pen-styles"===e[t].className)return e[t];return!1}};CSSReload.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){function e(){if(void 0!=window.pageYOffset)return{x:pageXOffset,y:t(pageYOffset)};var e,n,o=document,r=o.documentElement,i=o.body;return e=r.scrollLeft||i.scrollLeft||0,n=r.scrollTop||i.scrollTop||0,{x:e,y:t(n)}}function t(e){return Number((e/(n()-window.innerHeight)).toFixed(2))}function n(){var e=document.body,t=document.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight);return n}function o(e,t,n,o){return e/=o/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)}function r(e){if(e){for(var t=[],n=!1;null!=e.parentNode;){for(var o=0,r=0,i=0;i<e.parentNode.childNodes.length;i++){var a=e.parentNode.childNodes[i];a.nodeName==e.nodeName&&(a===e&&(r=o),o++)}var c=e.nodeName.toLowerCase();n&&(c+="::shadow",n=!1),o>1?t.unshift(c+":nth-of-type("+(r+1)+")"):t.unshift(c),e=e.parentNode,11===e.nodeType&&(n=!0,e=e.host)}return t.splice(0,1),t.join(" > ")}}function i(e){N||(N=e);var t=e-N,n=o(t,E,b-E,X);if(window.scrollTo(0,n),t<X){requestAnimationFrame(i)}else N=null,E=null,L=!1}function a(){c()}function c(){window.addEventListener("message",f,!0);for(var e=0;e<k.length;e++)window.addEventListener(k[e],u,!0);window.addEventListener("scroll",s,!0)}function s(){clearTimeout(w),w=setTimeout(function(){l()},T)}function l(){C.postMessage(["event",{type:"scroll",positions:e()}],"*")}function u(e){for(var t=r(e.target),n=e.constructor.name,o=e.type,i={type:o,targetPath:t,eventClass:n},a={},c=0;c<x.length;c++){var s=x[c];"undefined"!=typeof e[s]&&(a[s]=e[s])}i.options=a,Y.push(i),clearTimeout(g),g=setTimeout(function(){d()},H)}function d(){C.postMessage(["event",Y],"*"),Y=[]}function f(e){var t=e.data;t.length&&"event"===t[0]&&t[1]&&("scroll"===t[1].type?p(t[1].positions):v(t[1]))}function p(e){L!==!0&&(L=!0,E=document.documentElement.scrollTop||document.body.scrollTop,b=e.y*(n()-window.innerHeight),requestAnimationFrame(i))}function v(e){for(var t=0;t<e.length;t++)h(e[t])}function h(e){"MouseEvent"===e.eventClass?m(e):"KeyboardEvent"===e.eventClass&&y(e)}function m(e){var t=document.querySelector(e.targetPath),n=new MouseEvent(e.type,{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(n)}function y(e){var t=document.querySelector(e.targetPath),n=new KeyboardEvent(e.type,e.options);t.dispatchEvent(n)}var w,g,E,b,N,T=300,H=500,Y=[],L=!1,X=300,k=["click","keydown","keypress","keyup"],x=["altKey","code","ctrlKey","keyCode","which","clientX","clientY","layerX","layerY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],C=window.parent;a()}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";"object"!=typeof window.CP&&(window.CP={}),window.CP.PenTimer={programNoLongerBeingMonitored:!1,timeOfFirstCallToShouldStopLoop:0,_loopExits:{},_loopTimers:{},START_MONITORING_AFTER:2e3,STOP_ALL_MONITORING_TIMEOUT:5e3,MAX_TIME_IN_LOOP_WO_EXIT:2200,exitedLoop:function(o){this._loopExits[o]=!0},shouldStopLoop:function(o){if(this.programKilledSoStopMonitoring)return!0;if(this.programNoLongerBeingMonitored)return!1;if(this._loopExits[o])return!1;var t=this._getTime();if(0===this.timeOfFirstCallToShouldStopLoop)return this.timeOfFirstCallToShouldStopLoop=t,!1;var i=t-this.timeOfFirstCallToShouldStopLoop;if(i<this.START_MONITORING_AFTER)return!1;if(i>this.STOP_ALL_MONITORING_TIMEOUT)return this.programNoLongerBeingMonitored=!0,!1;try{this._checkOnInfiniteLoop(o,t)}catch(o){return this._sendErrorMessageToEditor(),this.programKilledSoStopMonitoring=!0,!0}return!1},_sendErrorMessageToEditor:function(){try{if(this._shouldPostMessage()){var o={action:"infinite-loop",line:this._findAroundLineNumber()};parent.postMessage(JSON.stringify(o),"*")}else this._throwAnErrorToStopPen()}catch(o){this._throwAnErrorToStopPen()}},_shouldPostMessage:function(){return document.location.href.match(/boomerang/)},_throwAnErrorToStopPen:function(){throw"We found an infinite loop in your Pen. We've stopped the Pen from running. Please correct it or contact support@codepen.io."},_findAroundLineNumber:function(){var o=new Error,t=0;if(o.stack){var i=o.stack.match(/boomerang\S+:(\d+):\d+/);i&&(t=i[1])}return t},_checkOnInfiniteLoop:function(o,t){if(!this._loopTimers[o])return this._loopTimers[o]=t,!1;var i=t-this._loopTimers[o];if(i>this.MAX_TIME_IN_LOOP_WO_EXIT)throw"Infinite Loop found on loop: "+o},_getTime:function(){return+new Date}},window.CP.shouldStopExecution=function(o){var t=window.CP.PenTimer.shouldStopLoop(o);return t===!0&&console.warn("[CodePen]: An infinite loop (or a loop taking too long) was detected, so we stopped its execution. Sorry!"),t},window.CP.exitedLoop=function(o){window.CP.PenTimer.exitedLoop(o)}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment