MCPcopy Create free account
hub / github.com/hoothin/UserScripts / launchRocket

Function launchRocket

HacgGodTurn/HacgGodTurn.user.js:1475–1508  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1473 }
1474
1475 function launchRocket(){
1476 if(!rocketBtn)return;
1477 if(curSite.preRocket){
1478 curSite.preRocket();
1479 }
1480 rocketContent.style.display="block";
1481 var links=document.querySelectorAll("a");
1482 var rocketLinks=document.querySelector("div#rocketLinks");
1483 rocketLinks.innerHTML="";
1484 var i=0;
1485 for(let j=0;j<links.length;j++){
1486 let link=links[j];
1487 if(config.rocketReg.test(link.href)&&link.className.indexOf("whx-a")==-1){
1488 if(rocketLinks.innerHTML.indexOf(link.outerHTML)!=-1 || window.getComputedStyle(link).display=="none" || (link.firstElementChild&&window.getComputedStyle(link.firstElementChild).display=="none"))continue;
1489 rocketLinks.innerHTML+="<a id='rocketBack' style='font-weight:bold;color:red;' href='javascript:void(0)'>"+(++i)+"<img src='"+preImgData+"'></a>: ";
1490 rocketLinks.appendChild(link.cloneNode(true));
1491 rocketLinks.innerHTML+="<br/>";
1492 }
1493 }
1494 var backs=document.querySelectorAll("div#rocketLinks>#rocketBack");
1495 for(i=0;i<backs.length;i++){
1496 let back=backs[i];
1497 back.onclick=function(){
1498 let target=document.querySelector("[href='"+back.nextSibling.nextSibling.getAttribute("href")+"']");
1499 let pos=elementPosition(target).y;
1500 if(curSite && curSite.offset)pos-=curSite.offset;
1501 scrollToControl(pos);
1502 rocketContent.style.display="none";
1503 };
1504 }
1505 if(rocketLinks.innerHTML===""){
1506 rocketLinks.innerHTML="No links found!";
1507 }
1508 }
1509
1510 function process(){
1511 var downloadBtn;

Callers 1

Calls 2

elementPositionFunction · 0.85
scrollToControlFunction · 0.85

Tested by

no test coverage detected