-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.js
1 lines (1 loc) · 1 KB
/
code.js
1
javascript:(function(){let asteroidSensor=document.getElementsByClassName("semitrans asteroidsSemiTrans");const asteroidPositions=Array.from(Array(21),()=>new Array(21));for(let i=1;i<21;i++){asteroidPositions[i][0]=i-1;asteroidPositions[0][i]=i-1;}for(let i=0;i<asteroidSensor.length;i++){let as=asteroidSensor.item(i);let top=parseInt(as.style.top.replace("px",""));let left=parseInt(as.style.left.replace("px",""));let size=parseInt(as.style.width.replace("px",""));let gridPos={x:left/size,y:top/size};asteroidPositions[gridPos.y+1][gridPos.x+1]=`"${gridPos.x},${gridPos.y}"`;}let infopane=document.getElementsByClassName("tableheader");for(let i=0; i < infopane.length; i++){let info = infopane.item(i);if(info.innerText.includes("Asteroid Field")) { asteroidPositions[0][0]=`"${info.innerText.toString().split(/\r\n|\r|\n/)[1]}"`; }}let csv=asteroidPositions.map((item)=>{let row=item;return row.join(",");}).join("\n");let file=new Blob([csv],{type:'text/csv'});let url=URL.createObjectURL(file);window.open(url);})();