User:Manishearth/orphantabs.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 40:
//alert("dowing")
document.editform.wpTextbox1.value = orphanRawWikify(pgName,document.editform.wpTextbox1.value)
document.editform.wpSummary.value = "De-orphaningAdding link to orphaned [[" +pgName pgname+ "|article]], usingWikiproject script. This is a test for the script. If there are any problems, pleaseOrphanage: [[UserWP:Manishearth ORPHAN|You notifycan mehelp!]]."
}
function orphanRawWikify(pgName,text){
Line 162:
 
function addOrphanTag(choice){
var valcurrentLinkWin.editform.wpTextbox1.value = addOrphanTagRaw(choice, currentLinkWin.editform.wpTextbox1.value)
var returnValeditSum = val""
if(choice){
//Testing on my local computer
editSum = "Successfully de-orphaned! Wikiproject Orphanage: [[WP:ORPHAN|You can help!]]"
}else{
editSum = "Unsuccesful de-orphan attempt, Wikiproject Orphanage: [[WP:ORPHAN|You can help!]]"
}
currentLinkWin.editform.wpSummary.value=editSum
currentLinkWin.close()
alert("De-orphaning over!!!")
}
 
Line 191 ⟶ 198:
}
 
}
function addOrphanTagRaw(choice, val){
var rVal
if(choice){
if(val.replace("{{orphan}}", "") != val){
rVal = val.replace("{{orphan}}", "")
alert(1)
}else if(/{{orphan\|\wdate=[^\}]*}}/i.test(val)){
rVal = val.replace(/{{orphan\|\wdate=[^\}]*}}/i, "")
alert(2)
}else if(val.indexOf("{{articleissues") !=-1){
rVal=val.replace(/\|\w?orphan=[^\|\}]*/,"")
rVal=rVal.replace(/\|\w?do-attempt=[^\|\}]*/,"")
alert(4)
}else{
rVal=val
alert(5)
}
}else{
if(val.replace("{{orphan}}", "") != val){
rVal = val.replace("{{orphan}}", "{{do-attempt|att=November}}")
alert(21)
}else if(new RegExp("{{orphan|date=[^\}]}}","i").test(val)){
rVal = val.replace(/{{orphan\|date=([^\}]*)}}/i, "{{do-attempt|date=$1|att=November}}")
alert(22)
}else if(new RegExp("{{do-attempt|date=[^\|\}]*\|att=[^\|\}]*}}","i").test(val)){
rVal = val.replace(/({{do-attempt|date=[^\|\}]*\|att=)[^\|\}]*}}/, "$1November}}")
 
}else if(val.indexOf("{{articleissues") !=-1){
rVal=rVal.replace(/\|\w?do-attempt=[^\|\}]*/,"\|do-attempt=November")
alert(23)
}else{
rVal= val
}
}
return rVal
}