User:Yair rand/checktransremove.js

function addchecktransremovebuttons { var q=document.getElementsByClassName?document.getElementsByClassName('checktrans'):document.getElementsByTagName('div') for(var i = 0, c = 0; i < q.length; i++){ if(q[i].className == "checktrans"){ c++ var qq = q[i].nextSibling; if(qq.nodeName.toLowerCase!='div'){qq=qq.nextSibling} var qqq=qq.getElementsByTagName('li') for(var ii = 0; ii < qqq.length; ii++){ addchecktransremovebutton(qqq[ii], c, ii) }   }  }  function addchecktransremovebutton(q, c, i)  { q.appendChild(newNode('a','(−)',{'style':'padding-left:4px; cursor:pointer;', 'title':'Remove', 'click': function{ editor=new Editor; editor.addEdit({     edit:function(wikitext){return ccc=wikitext.replace(RegExp("^(([\\s\\S]*?\\{\\{checktrans-top\\}\\}){"+c+"}[\\s\\S]*?\n([\\s\\S]+?(?=\n\\*(?!:))){"+i+"})[\\s\\S]+?\n(?=\{|\\*(?!:))"),'$1\{\{subst:blank|\n*\}\}\n')},      redo:function{q.style.border="2px dashed #FF0000";q.style.opacity="0.6";q.style.backgroundColor="#FFEEEE";q.lastChild.style.display='none'},      undo:function{q.style.border="";q.style.opacity="1";q.style.backgroundColor="";q.lastChild.style.display='inline'},      summary:'rm checktrans',      after_save:function{q.style.backgroundColor="#F00"; setTimeout(function{q.parentNode.removeChild(q)}, 400)}      }) }})) } }

$(addchecktransremovebuttons)