User:Manishearth/orphantabs.js: Difference between revisions

Content deleted Content added
No edit summary
added support for config template (not yet implemented in script)
Line 7:
 
*/
 
//Support for config template (not yet implemented in script)
if(OrphanTabsConfig === undefined){
OrphanTabsConfig = {
auto : false,
autoChoice : 3,
showCompleteTab : true,
completeTabText : "de-orphan-complete",
showWikifyTab : true,
wikifyTabText : "de-orphan-wikify",
showWLHTab : false,
wLHTabText : "WhatLinksHere",
showSearchItTab : false,
searchItTabText : "Search It!",
showGoogleItTab : false,
googleItTabText : "Google It!"
}
}else{
if(OrphanTabsConfig.auto === undefined){
OrphanTabsConfig.auto = new Boolean(true)
}
if(OrphanTabsConfig.autoChoice === undefined){
OrphanTabsConfig.autoChoice = new Number(3)
}
if(OrphanTabsConfig.showCompleteTab === undefined){
OrphanTabsConfig.showCompleteTab = new Boolean(true)
}
if(OrphanTabsConfig.completeTabText === undefined){
OrphanTabsConfig.completeTabText = new String("de-orphan-complete")
}
if(OrphanTabsConfig.showWikifyTab === undefined){
OrphanTabsConfig.showCompleteTab = new Boolean(true)
}
if(OrphanTabsConfig.wikifyTabText === undefined){
OrphanTabsConfig.completeTabText = new String("de-orphan-wikify")
}
if(OrphanTabsConfig.showWLHTab === undefined){
OrphanTabsConfig.showCompleteTab = new Boolean(false)
}
if(OrphanTabsConfig.wLHTabText === undefined){
OrphanTabsConfig.completeTabText = new String("WhatLinksHere")
}
if(OrphanTabsConfig.showSearchItTab === undefined){
OrphanTabsConfig.showCompleteTab = new Boolean(false)
}
if(OrphanTabsConfig.searchItTabText === undefined){
OrphanTabsConfig.completeTabText = new String("Search It!")
}
if(OrphanTabsConfig.showGoogleItTab === undefined){
OrphanTabsConfig.showCompleteTab = new Boolean(false)
}
if(OrphanTabsConfig.googleItTabText === undefined){
OrphanTabsConfig.completeTabText = new String("Google It!")
}
 
}
var currentLinkWin
var otherOrphanTabs = false
Line 24 ⟶ 80:
 
if(otherOrphanTabs){
addPortletLink("p-cactions", wgServer + "/wiki/Special:WhatLinksHere/" + pgname, "WhatLinksHere", "ca-parentswhatlinks" , "What links here");
addPortletLink("p-cactions", wgServer + "/wiki/Special:WhatLinksHere/" + pgname, "Search it!", "ca-searchit" , "What links here");
 
Line 39 ⟶ 95:
var allLinks = new Array()
function deOrphanWikify(pgName){
if (!document.editform){
//alert("dowing")
alert("Only available on the edit page \(currently\)")
}else{
 
document.editform.wpTextbox1.value = orphanRawWikify(pgName,document.editform.wpTextbox1.value)
document.editform.wpSummary.value = "Adding link to orphaned [[" + pgName+ "|article]], Wikiproject Orphanage: [[WP:ORPHAN|You can help!]]"
}
}
function orphanRawWikify(pgName,text){
Line 138 ⟶ 198:
 
function endOfLinkWins(){
var choice = confirm(linkAlreadyThere + " pages linked to " + deOrphanPgName + " before de-orphaning.\n" + howManyActuallyDeOrphaned + " pages were linked to " + deOrphanPgName + "\n" + (linkAlreadyThere + howManyActuallyDeOrphaned) + " pages link to " + deOrphanPgName + " now\n De-orphan? (Press cancel to tag the page with \'do-attempt\'.")
currentLinkWin = window.open("about:blank","","")
currentLinkWin.___location.replace(wgServer+"/w/index.php?title=" + deOrphanPgName + "&action=edit")