User:Yair rand/checktbotentries2.js

function addchecktbotentrybuttons { var q=(window.bodyContent||document.getElementById('bodyContent')).getElementsByTagName('div') for(var i=0; i<q.length; i++){ if(q[i].className == "tbot-entry"){ var qq = q[i].getElementsByTagName('p')[0].appendChild(newNode('i',' [',newNode('a','check',{'style':'cursor:pointer;','click':function{     var qqqqq = this.parentNode, qqqq=this.parentNode.parentNode.parentNode;      for(var qqq=qqqq; qqq&&!/h\d/i.test(qqq.nodeName); qqq=qqq.previousSibling);      qqq = qqq.firstChild.getElementsByTagName('a')[0].href.split("&section=")[1]      JsMwApi.page(wgPageName).edit(function(text, saveFunction, editRes){ text = text.replace(RegExp("(((^|\n)=[\\s\\S]*?){" + qqq + "}[\\s\\S]*?)\\{\\{tbot entry[^\\}]+\\}\\}"),'$1').replace(/\n\n\n/g,'\n\n') saveFunction(text, {summary:'check tbot entry'},          function(saveRes){if(saveRes){location.reload(true)}else{alert('ERROR')}}) })     }}),']'))    }  } }

$(addchecktbotentrybuttons)