-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.05afe481.js
1 lines (1 loc) · 1.53 KB
/
index.05afe481.js
1
var e,n;e=document.getElementById("logger"),console.old=console.log,console.log=function(){let n="";for(let e=0;e<arguments.length;e++){const o=arguments[e];n+='<span class="log-'+typeof o+'">',"object"==typeof o&&"object"==typeof JSON&&"function"==typeof JSON.stringify?n+=JSON.stringify(o):n+=o,n+="</span>"}e.innerHTML+=n+"<br>",console.old.apply(void 0,arguments)},n=function(){const e=document.getElementById("codeInput"),n=function(e){const n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),o=window.location.search.substr(1).match(n);return null!=o?decodeURIComponent(o[2]):null}("code");e.value=n||'// input your code here\n\nOUTPUT "Hello, world!"\n',setTimeout((()=>{document.querySelector(".console").innerHTML=""}),300),document.querySelector(".run-code").addEventListener("click",(()=>{const e=document.querySelector(".code-input").value;document.getElementById("igpc-error-wrap").classList.add("hidden"),function(e){let n;try{n=igpc.compile(e,"js")}catch(e){return console.error(e),document.getElementById("igpc-error").innerText=e.message,void document.getElementById("igpc-error-wrap").classList.remove("hidden")}new Function(`\n ${n}\n `)()}(e)})),document.querySelector(".clear-console").addEventListener("click",(()=>{document.querySelector(".console").innerHTML=""})),document.getElementById("igpc-error-close-icon").addEventListener("click",(()=>{document.getElementById("igpc-error").innerText="",document.getElementById("igpc-error-wrap").classList.add("hidden")}))},"loading"!=document.readyState?n():document.addEventListener("DOMContentLoaded",n);