Revision as of 18:49, 19 January 2007 view sourceBetacommand (talk | contribs)86,927 edits + Link removal tools← Previous edit |
Revision as of 15:51, 19 March 2007 view source Betacommand (talk | contribs)86,927 editsNo edit summaryNext edit → |
Line 1: |
Line 1: |
|
|
//Written by ], thanks to ] and ] for help with this! |
|
|
//Modified by ] |
|
|
// BEGIN prodspec LINK REMOVAL CODE |
|
|
//check if we are editing and we want to prodspec |
|
|
if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('prodspec=1') != -1) { |
|
|
function prodspec() { |
|
|
document.getElementById('wpSummary').value = "Removing prodspec link as unverifiable and against policy ]"; |
|
|
var reason = prompt("Which warning do you wish to issue?"); |
|
|
document.editform.wpTextbox1.value = ''{{subst:' + 'prod|'+ reason + '}}\n' + document.editform.wpTextbox1.value; |
|
|
document.editform.wpSummary.value = 'This page has been proposed for deletion and will be deleted in 5 days if no one objects.'; |
|
|
document.getElementById('wpSave').click(); |
|
|
document.getElementById('wpWatchthis').checked = "true"; |
|
|
} |
|
|
addOnloadHook(function(){ prodspec(); }); |
|
|
} |
|
|
//Check if it's article to add the tab |
|
|
if(wgCanonicalNamespace == "") { |
|
|
addOnloadHook(function(){ |
|
|
var taburl = "http://en.wikipedia.org/search/?title="+wgPageName+"&action=edit&prodspec=1"; |
|
|
addTab(taburl, "Prod!", "ca-prodspec", "This PRODs articles"); |
|
|
}); |
|
|
} |
|
//Written by ], thanks to ] and ] for help with this! |
|
//Written by ], thanks to ] and ] for help with this! |
|
//Modified by ] |
|
//Modified by ] |
Line 49: |
Line 71: |
|
//<pre><nowiki> |
|
//<pre><nowiki> |
|
if(wgNamespaceNumber == -1) { |
|
if(wgNamespaceNumber == -1) { |
|
addOnloadHook(function() { |
|
addOnloadHook(function() { |
|
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul'); |
|
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul'); |
|
addlilink(tbs, "javascript:rem_spam()", "remove external links", 'ca-remspam', 'Alter all the links on this page to autorem the external link on the page when clicked'); |
|
addlilink(tbs, "javascript:rem_spam()", "remove external links", 'ca-remspam', 'Alter all the links on this page to autorem the external link on the page when clicked'); |
|
}); |
|
}); |
|
} |
|
} |
|
|
|
|
|
if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('remspam=') != -1) { |
|
if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('remspam=') != -1) { |
|
addOnloadHook(function() { |
|
addOnloadHook(function() { |
|
var tag = query_get('remspam'); |
|
var tag = query_get('remspam'); |
|
var box = document.getElementById('wpTextbox1'); |
|
var box = document.getElementById('wpTextbox1'); |
|
var txt = box.value; |
|
var txt = box.value; |
|
var reg = tag.replace('http://', '').replace(/\./g, '\\.').replace(/\*\\?\./g, '(?:.*?\\.)?'); |
|
var reg = tag.replace('http://', '').replace(/\./g, '\\.').replace(/\*\\?\./g, '(?:.*?\\.)?'); |
|
var newtext = ''+txt; |
|
var newtext = ''+txt; |
|
newtext = newtext.replace(new RegExp('^\\s*\\*.*?\\?.*?$', 'igm'), ''); |
|
newtext = newtext.replace(new RegExp('^\\s*\\*.*?\\?.*?$', 'igm'), ''); |
|
newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=.*?)?>\\s*)?\\{\\{\\s*citeweb\\s*\\|(?:.*?\\|)*\\s*url\\s*=\\s*https?\\://'+reg+'/?.*?\\s*(?:\\|.*?)?\\}\\}(?:\\s*<\/ref>)?', 'ig'), ''); |
|
newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=.*?)?>\\s*)?\\{\\{\\s*citeweb\\s*\\|(?:.*?\\|)*\\s*url\\s*=\\s*https?\\://'+reg+'/?.*?\\s*(?:\\|.*?)?\\}\\}(?:\\s*<\/ref>)?', 'ig'), ''); |
|
newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=.*?)?>\\s*)?\\?(?:\\s*<\/ref>)?', 'ig'), '$1'); |
|
newtext = newtext.replace(new RegExp('(?:<ref(?:\\s*name=.*?)?>\\s*)?\\?(?:\\s*<\/ref>)?', 'ig'), '$1'); |
|
box.value = newtext; |
|
box.value = newtext; |
|
document.getElementById('wpSummary').value = 'Removing external link: '+tag+' -- per ]'; |
|
document.getElementById('wpSummary').value = 'Removing external link: '+tag+' -- per ]'; |
|
document.getElementById('wpMinoredit').checked = true; |
|
document.getElementById('wpMinoredit').checked = true; |
|
document.getElementById('wpWatchthis').checked = false; |
|
document.getElementById('wpWatchthis').checked = false; |
|
document.getElementById('wpDiff').click(); |
|
document.getElementById('wpDiff').click(); |
|
}); |
|
}); |
|
} |
|
} |
|
|
|
|
|
function rem_spam() { |
|
function rem_spam() { |
|
var targ = query_get('target') || unescape(location.href).split('/').reverse().split('?').split('#'); |
|
var targ = query_get('target') || unescape(location.href).split('/').reverse().split('?').split('#'); |
|
var tag = prompt('Please insert a link (without http://) to remove from\nall pages listed here. Example (and default if textbox is blank):\n'+targ); |
|
var tag = prompt('Please insert a link (without http://) to remove from\nall pages listed here. Example (and default if textbox is blank):\n'+targ); |
|
if(tag == null) { alert('Action canceled.'); return; } |
|
if(tag == null) { alert('Action canceled.'); return; } |
|
if(tag == "") tag = targ; |
|
if(tag == "") tag = targ; |
|
var links = document.getElementById('bodyContent').getElementsByTagName('a'); |
|
var links = document.getElementById('bodyContent').getElementsByTagName('a'); |
|
for(var i=0; i<links.length; i++) { |
|
for(var i=0; i<links.length; i++) { |
|
var link = links; |
|
var link = links; |
|
var cha = (link.href.indexOf('?') != -1) ? '&' : '?'; |
|
var cha = (link.href.indexOf('?') != -1) ? '&' : '?'; |
|
link.href += cha + 'linkmodified=yes&action=edit&remspam='+escape(tag); |
|
link.href += cha + 'linkmodified=yes&action=edit&remspam='+escape(tag); |
|
link.style.color = "green"; |
|
link.style.color = "green"; |
|
link.onmouseup = function() { this.style.color = 'orange'; }; |
|
link.onmouseup = function() { this.style.color = 'orange'; }; |
|
link.innerHTML = link.innerHTML.replace(/(<(+)>)/g, ''); |
|
link.innerHTML = link.innerHTML.replace(/(<(+)>)/g, ''); |
|
} |
|
} |
|
var btn = document.getElementById('ca-remspam').firstChild; |
|
var btn = document.getElementById('ca-remspam').firstChild; |
|
btn.href = 'javascript:unrem_spam();'; |
|
btn.href = 'javascript:unrem_spam();'; |
|
btn.innerHTML = 'un-highlight links'; |
|
btn.innerHTML = 'un-highlight links'; |
|
btn.title = ''; |
|
btn.title = ''; |
|
} |
|
} |
|
|
|
|
|
function unrem_spam() { |
|
function unrem_spam() { |
|
var links = document.getElementById('bodyContent').getElementsByTagName('a'); |
|
var links = document.getElementById('bodyContent').getElementsByTagName('a'); |
|
for(var i=0; i<links.length; i++) { |
|
for(var i=0; i<links.length; i++) { |
|
var link = links; |
|
var link = links; |
|
link.href = link.href.split('linkmodified=yes'); |
|
link.href = link.href.split('linkmodified=yes'); |
|
link.style.color = ""; |
|
link.style.color = ""; |
|
} |
|
} |
|
alert('All links will now be safe to click...'); |
|
alert('All links will now be safe to click...'); |
|
var btn = document.getElementById('ca-remspam').firstChild; |
|
var btn = document.getElementById('ca-remspam').firstChild; |
|
btn.href = 'javascript:rem_spam();'; |
|
btn.href = 'javascript:rem_spam();'; |
|
btn.innerHTML = 'remove external links'; |
|
btn.innerHTML = 'remove external links'; |
|
btn.title = ''; |
|
btn.title = ''; |
|
} |
|
} |
|
|
|
|
Line 123: |
Line 145: |
|
//<pre><nowiki> |
|
//<pre><nowiki> |
|
function filter_main() { |
|
function filter_main() { |
|
var lis = document.getElementById('bodyContent').getElementsByTagName('li'); |
|
var lis = document.getElementById('bodyContent').getElementsByTagName('li'); |
|
var len = lis.length; |
|
var len = lis.length; |
|
for(var i=0; i<len; i++) { |
|
for(var i=0; i<len; i++) { |
|
var li = lis; |
|
var li = lis; |
|
if(li.getElementsByTagName('a').innerHTML.indexOf(':') != -1) { |
|
if(li.getElementsByTagName('a').innerHTML.indexOf(':') != -1) { |
|
//li.parentNode.removeChild(li); |
|
//li.parentNode.removeChild(li); |
|
li.style.display = 'none'; |
|
li.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
if(wgPageName == 'Special:Linksearch') { |
|
if(wgPageName == 'Special:Linksearch') { |
|
addOnloadHook(function() { |
|
addOnloadHook(function() { |
|
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul'); |
|
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul'); |
|
addlilink(tbs, "javascript:void(filter_main())", "filter", 'ca-filter', 'Filter all pages on here to only be for mainspace'); |
|
addlilink(tbs, "javascript:void(filter_main())", "filter", 'ca-filter', 'Filter all pages on here to only be for mainspace'); |
|
}); |
|
}); |
|
} |
|
} |
|
//</nowiki></pre> |
|
//</nowiki></pre> |