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

Function processObj

HacgGodTurn/HacgGodTurn.user.js:1595–1646  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1593 }
1594
1595 function processObj(obj){
1596 if(obj){
1597 if(obj.nodeType==1 && obj.tagName != "A"){
1598 for(var i=0;i<obj.childNodes.length;i++){
1599 processObj(obj.childNodes[i]);
1600 }
1601 }else if(obj.nodeType==3){
1602 var curData=obj.data;
1603 if(obj.nextSibling && obj.nextSibling.outerHTML=="<b>hacg</b>"){
1604 curData+="hacg";
1605 if(obj.nextSibling.nextSibling && obj.nextSibling.nextSibling.nodeType==3){
1606 curData+=obj.nextSibling.nextSibling.data;
1607 obj.nextSibling.nextSibling.data="";
1608 }
1609 obj.parentNode.removeChild(obj.nextSibling);
1610 }
1611 let data=processTxt(curData);
1612 if(curData != data){
1613 let curObj=obj;
1614 setTimeout(function(){
1615 var newData = document.createElement("p");
1616 curObj.parentNode.replaceChild(newData, curObj);
1617 newData.outerHTML=data;
1618 },1);
1619 }else if(/B|STRONG/.test(obj.parentNode.tagName)){
1620 let allStrongs=[];
1621 var next=obj.parentNode.nextSibling;
1622 while(next){
1623 if(/B|STRONG/.test(next.tagName)){
1624 allStrongs.push(next);
1625 curData+=next.innerHTML;
1626 next=next.nextSibling;
1627 }else{
1628 break;
1629 }
1630 }
1631 data=processTxt(curData);
1632 if(curData != data){
1633 let curObj=obj;
1634 setTimeout(function(){
1635 allStrongs.forEach(function(item){
1636 item.style.display="none";
1637 });
1638 var newData = document.createElement("p");
1639 curObj.parentNode.replaceChild(newData, curObj);
1640 newData.outerHTML=data;
1641 },1);
1642 }
1643 }
1644 }
1645 }
1646 }
1647
1648 function getPage(){
1649 let pre=document.querySelector("a.prev");

Callers 2

processFunction · 0.85

Calls 1

processTxtFunction · 0.85

Tested by

no test coverage detected