Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*===================================================================================================Work on this script has resumed, but it is still volatile.The first three tabs (parents, de-orphan, and de-orphan-wikify have no issues. You may use them. Ask me for their functions.THis script is by:[[User:Manishearth]]I am testing it on [[Cryptonemiales]]===================================================================================================*/varcurrentLinkWinvardeOrphanDocumentLinkArray=newArray()varlinkACounter=0vardeOrphaning=falsevardeOrphanPgName=""vardeOrphanProcessFirstCall=falseaddOnloadHook(function(){vargServerPre;vargServerPost;gServerPre="http://www.google.com/search?hl=en&rlz=1G1GGLQ_ENUS255&as_q="gServerPost="&as_epq=&as_oq=&as_eq=&num=100&lr=&as_filetype=&ft=i&as_sitesearch="+wgServer+"&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images"varpgname=encodeURIComponent(wgTitle);addPortletLink("p-cactions",wgServer+"/wiki/Special:WhatLinksHere/"+pgname,"Parents","ca-parents","What links here");addPortletLink("p-cactions",gServerPre+pgname+gServerPost,"De-orphan","ca-de-orphan","Find all Wikipedia pages with this page name in them");addPortletLink("p-cactions","javascript:deOrphanWikify(prompt(\"What page are you de-orphaning?\",\"\"))","De-orphan-wikify","ca-de-orphan-wikify","Wikify to deorphan another page");addPortletLink("p-cactions","javascript:initDeOrphan(prompt(\"What page\?\"\,\"\"));","De-orphan-complete","ca-de-orphan","Find all Wikipedia pages with this page name in them");});varintID;varsWin;varallLinks=newArray()functiondeOrphanWikify(pgName){//alert("dowing")document.editform.wpTextbox1.value=orphanRawWikify(pgName,document.editform.wpTextbox1.value)document.editform.wpSummary.value="De-orphaning [["+pgName+"]] using script. This is a test for the script. If there are any problems, please [[User:Manishearth | notify me]]."}functionorphanRawWikify(pgName,text){rXP=newRegExp("([ '\"()<>,.])("+pgName+")([ '\"()<>,.])","gi")vart=text.replace(rXP,"$1[["+pgName+" |$2]]$3")returnt;}functioninitDeOrphan(pgName){sWin=window.open("http://en.wikipedia.org/w/index.php?title=Special:Search&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1&redirs=1&search=%22"+pgName+"%22&limit=100&offset=0","","")deOrphanPgName=pgNamedeOrphanProcessFirstCall=trueintID=setInterval('checkWin()',3000)}functioncheckWin(){if(sWin.document.readyState=="complete"){clearInterval(intID)//alert("passes clear")CreateArray()}}functionCreateArray(){//alert("creating")varsLinkArray=newArray()varallLinksArray=newArray()varallLists=sWin.document.getElementsByTagName("ul")//alert(allLists.length)for(i=0;i<allLists.length;i++){if(allLists[i].className=="mw-search-results"){//alert(allLists[i].innerHTML)allLinksArray=returnArray(allLists[i].innerHTML)}}deOrphanDocumentLinkArray=allLinksArray//alert("final a:\n" + deOrphanDocumentLinkArray)openALinkWin()};functionreturnArray(text){varorphanCompleteRegxp=newRegExp("<a[^<]*<\/a>","gi")//alert(orphanCompleteRegxp)anchTags=newArray()//alert(text.match(orphanCompleteRegxp).toString())//alert(text.match(orphanCompleteRegxp).length)anchTags=text.match(orphanCompleteRegxp)allImpLinks=newArray()varorphanAnchRegxp=newRegExp("href=\"([^<>=\"]*)\"","i")for(i=0;i<anchTags.length;i++){allImpLinks[i]=anchTags[i].match(orphanAnchRegxp)[0].split("=")[1].replace(/\"/g,"")}varcolorRectifier="\""//Just to return syntax highlighting to normalreturnallImpLinks;}functionopenLinkWins(linkArray){varlinkWin=window.open("about:blank","","")linkWin.___location.replace(wgServer+"/w/index.php?title="+linkArray[0].replace(/\/wiki\//,"")+"&action=edit")}functionopenALinkWin(){currentLinkWin=window.open("about:blank","","")currentLinkWin.___location.replace(wgServer+"/w/index.php?title="+deOrphanDocumentLinkArray[linkACounter].replace(/\/wiki\//,"")+"&action=edit")currentLinkWin.onload=function(){currentLinkWin.addOnloadHook(function(){if(currentLinkWin.wgCanonicalNamespace==""){currentLinkWin.deOrphanWikify(deOrphanPgName)currentLinkWin.document.editform.submit()//alert("submitting")setTimeout("closeTheWindow()",1000)}else{closeTheWindow()}});}}functioncloseTheWindow(){//alert("closing")currentLinkWin.onload=function(){currentLinkWin.addOnloadHook(function(){currentLinkWin.close()linkACounter++if(linkACounter!=deOrphanDocumentLinkArray.length){openALinkWin()}else{endOfLinkWins()}})}}functionendOfLinkWins(){alert("IT IS THE END!!!!!!!!!!")}functionwikifyLinkWin(){linkWin.document.editform.wpTextbox1.value=orphanRawWikify(pgName,linkWin.document.editform.wpTextbox1.value)//linkWin.document.editform.submit()}