User:Manishearth/orphantabs.js: Difference between revisions

Content deleted Content added
No edit summary
removing my obnoxious debug alerts :P
Line 7:
 
*/
if(!OrphanTabsConfig){
OrphanTabsConfig = {
 
 
}
}
var currentLinkWin
var otherOrphanTabs = false
Line 158 ⟶ 164:
 
function addOrphanTag(choice){
//alert("adding")
currentLinkWin.document.editform.wpTextbox1.value = addOrphanTagRaw(choice, currentLinkWin.document.editform.wpTextbox1.value)
var editSum = ""
Line 200 ⟶ 206:
if(val.replace(new RegExp("{{orphan}}", "i"), "") != val){
rVal = val.replace(new RegExp("{{orphan}}", "i"), "")
// alert(111)
}else if(/{{orphan\|\wdate=[^\}]*}}/i.test(val)){
rVal = val.replace(/{{orphan\|\wdate=[^\}]*}}/i, "")
// alert(212)
}else if(val.indexOf("{{articleissues") !=-1){
rVal=val.replace(/\|\w?orphan=[^\|\}]*/i,"")
rVal=rVal.replace(/\|\w?do-attempt=[^\|\}]*/i,"")
// alert(414)
}else{
rVal=val
// alert(515)
}
}else{
if(val.replace(new RegExp("{{orphan}}", "i"), "") != val){
rVal = val.replace("{{orphan}}", "{{do-attempt|att=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}}}")
// alert(21)
}else if(new RegExp("{{orphan|date=[^\}]}}","i").test(val)){
rVal = val.replace(/{{orphan\|date=([^\}]*)}}/i, "{{do-attempt|date=$1|att=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}}}")
// alert(22)
}else if(new RegExp("{{do-attempt|date=[^\|\}]*\|att=[^\|\}]*}}","i").test(val)){
rVal = val.replace(/({{do-attempt|date=[^\|\}]*\|att=)[^\|\}]*}}/i, "$1\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}}}")
Line 224 ⟶ 230:
}else if(val.indexOf("{{articleissues") !=-1){
rVal=rVal.replace(/\|\w?do-attempt=[^\|\}]*/i,"\|do-attempt=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}")
// alert(23)
}else{
rVal= "{{do-attempt|att=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}}}" + val