User:Moreschi/monobook.js
Appearance
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. |
![]() | The accompanying .css page for this skin is at User:Moreschi/monobook.css. |
////////////////////////////////////////////////////////////////
// =-=-=- HELPER FUNCTIONS -=-=-=-
function addlilink(tabs, url, name, id, title, key)
{
//check for duplicates
if (document.getElementById(id)){return;}
//cologne blue bypass
if (document.getElementById('quickbar'))
{
if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
{
addquickbarlink(url, name, id, title, 'Edit');
}
if (document.getElementById('footer') && !document.getElementById('bodyContent'))
{
addfooterlink(url, name, id, title);
}
return;
}
//monobook
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
function prependChild(parent, node) {
parent.insertBefore(node, parent.firstChild);
}
function addToolboxLink(url, name, id, key)
{
if (document.getElementById('p-tb'))
{var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];}
addlilink(tb, url, name, id, key);
}
function addTab(url, name, id, title, key)
{
//monobook
if (document.getElementById('p-cactions'))
{var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];}
//cologneblue
else {
if (document.getElementById('quickbar'))
{var tabs = document.getElementById('quickbar').getElementsByTagName('h6')[2];}
if (document.getElementById('footer'))
{var tabs = document.getElementById('footer').getElementsByTagName('td')[0];}
return addquickbarlink(url, name, id, 'Edit');
}
return addlilink(tabs, url, name, id, title, key);
}
///////////////
//cologneblue tab/link adder
function addquickbarlink(url, name, id, title, header)
{
var header = '<h6>' + header + '</h6>';
var tabs = document.getElementById('quickbar');
if (tabs.innerHTML.indexOf(header) ==-1)
{return;}
var add_html = '<strong><a id="' + id + '" title="' + title + '" href="' + url + '">' + name + '</a></strong><br />';
var section_html = tabs.innerHTML.split(header)[1].split('<h6>')[0];
var next_section = '<h6>' + tabs.innerHTML.split(header)[1].split('<h6>')[1].split('</h6>')[0] + '</h6>';
tabs.innerHTML = tabs.innerHTML.split(header)[0] + header + section_html + add_html + next_section + tabs.innerHTML.split(next_section)[1];
}
function addfooterlink(url, name, id, title)
{
var tabs = document.getElementById('footer').getElementsByTagName('td')[1];
var add_html = '<strong><a href="' + url + '" title="' + title + '" id="' + id + '">' + name + '</a></strong>';
tabs.innerHTML = add_html + ' | ' + tabs.innerHTML;
}
///////////////
function addLink(where, url, name, id, title, key, after){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
/////////////////////////////////////////////
/**** Add generic tab ****/
function addlilink_simple(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addlimenu(tabs, name, id)
{
var na = document.createElement('a');
na.href = '#';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
/////////
//These are simplier versions of the above, except they add the links on top, not on botton
function addnavbox_link(URL,Name,ID)
{
//cologne blue bypass
if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
{
var tabs = document.getElementById('quickbar');
addquickbarlink(URL, Name, ID, Name, 'Browse');
return;
}
//monobook
var portlet = document.getElementById('p-navigation');
var links = portlet.getElementsByTagName('ul')[0];
links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>';
}
//////////
function URLEncoding(input)
{
var encodedInputString=escape(input);
encodedInputString=encodedInputString.replace(/\+/g, "%2B");
encodedInputString=encodedInputString.replace(/\//g,"%2F");
encodedInputString=encodedInputString.replace(/&/g,"%26");
var outputurl=encodedInputString;
return outputurl;
}
if (document.implementation.createDocument)
{var gml_xmlparser = new DOMParser();}
function standard_XMLParse(string)
{
if (document.implementation.createDocument)
{
return gml_xmlparser.parseFromString(string, "text/xml");
}
else if (window.ActiveXObject)
{
string = string.replace(/<body .*\"ns-(.*)\">/, '<body class="ns-$1">');
rer = string.match(/<h1 .*<\/h1>/)[0].replace(/&/g, '&');
if (rer) {string = string.replace(/<h1 .*<\/h1>/, rer);}
var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
gml_xmldoc.async = false;
ret = gml_xmldoc.loadXML(string);
myErr = gml_xmldoc.parseError;
if (myErr.errorCode || !ret)
{
showError("Error: " + ERROR_XML + myErr.reason);
return null;
}
return gml_xmldoc.documentElement
}
return null;
}
function HTTPClient()
{
var xml_http = false;
if(window.XMLHttpRequest)
xml_http = new XMLHttpRequest();
else if (IE){
try{
xml_http = new ActiveXObject("Msxml2.XMLHTTP")
} catch (e){
try{
xml_http = new ActiveXObject("Microsoft.XMLHTTP")
} catch (e){}
}
}
if (!xml_http) showError(ERROR_XML);
return xml_http
};
//<pre><nowiki>
//Auto AFD Lister--------------
// This needs to change depending on skin used.
function strip_namespace(target)
{
var colon = target.indexOf(':');
if (colon != -1)
{
var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
var ns = target.substring(0, colon);
if (ns == '' || ns == 'Talk')
return target.substring(colon + 1);
else
for (var i = 0; i < spaces.length; ++i)
{
if (ns == spaces[i]
|| ns == spaces[i] + '_talk')
return target.substring(colon + 1);
}
}
return target;
}
function prod()
{
var reason = prompt('Reason:');
document.editform.wpTextbox1.value = '{{subst:Prod|' + reason + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'This page has been [[WP:PROD|proposed for deletion]] and will be deleted in 5 days if no one objects.';
}
function vfd()
{
document.editform.wpTextbox1.value = '{{' + 'subst:afd}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = '[[WP:AFD]]';
var target = document.title.split('Editing ')[1].split(' - ')[0];
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
date = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();
var pagename = strip_namespace(target);
window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + URLEncoding(pagename) + '&action=edit&fakeaction=vfdsub&faketarget=' + URLEncoding(target),
'Afd ' + target,
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=vfdlist&faketarget=' + URLEncoding(pagename),
'AfdLog ' + target,
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
function autovfd()
{
if (document.title.indexOf('Editing ') == 0)
{
var action = '';
var target = '';
if (location.search)
{
var l = location.search.substring(1).split('&');
for (var i = 0; i < l.length; ++i)
{
var eq = l[i].indexOf('=');
var name = l[i].substring(0, eq);
if (name == 'fakeaction')
action = l[i].substring(eq + 1);
else if (name == 'faketarget')
target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
}
}
if (action == 'vfdlist')
{
document.editform.wpTextbox1.value += '{{' + 'Wikipedia:Articles for deletion/' + target + '}}\n';
document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
}
else if (action == 'vfdsub')
{
if (document.editform.wpTextbox1.value.length > 0)
{
window.alert("There's an old afd at the default location already.\n\n" +
'Please either move it out of the way (and update existing links to it), or file the afd by hand in another location (such as [[' + target + ' (2)]]).');
}
else
document.editform.wpTextbox1.value += '===[[' + target + ']]===\n' +
'Reason for nomination. ~~' + '~~\n{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|?}}\n*\n*\n*\n';
}
else
;
}
}
//END
//AFD Closer----------------
//this helps automate AfD closing by adding a 'close' tab to AfD debates
//written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]
function result()
{
var close = prompt("Result of debate?")
var f = document.editform, t = f.wpTextbox1;
t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "ab" + "}}";
f.wpSummary.value = "Closing debate; result was " + close;
}
function relist()
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
f.wpSummary.value = "Relisting debate";
}
function keep()
{
var date = prompt("Nomination was made when?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d")
{
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|page=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article survived AfD";
}
function tagnote(string)
{
if (!string){return;}
var f = document.editform, t = f.wpTextbox1;
t.value = "{{" + string + "}}" + "\n" + t.value;
f.wpSummary.value = "Tagged: " + string;
document.getElementById('wpMinoredit').checked=true;
}
function no_consensus()
{
var date = prompt("Nomination was made when?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d")
{
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|page=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article survived AfD with no consensus";
}
function redirect()
{
var date = prompt("Nomination was made when?")
var redirect = prompt("Redirect to?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d")
{
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|page=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";
}
function merge()
{
var date = prompt("Nomination was made when?")
var redirect = prompt("Merge and redirect to?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d")
{
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|page=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD";
}
function other()
{
var date = prompt("Nomination was made when?")
var result = prompt("Result was?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d")
{
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|page=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "AfDed; result was " + result;
}
$(add_afd_tabs)
function add_afd_tabs()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// Only add for pages with the right string somewhere in the title
if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
{
addTab("javascript:result()","close", "ca-afdcl", "Close AfD", "");
addTab("javascript:relist()","relist", "ca-afdrl", "Re-list AfD", "");
}
if (document.title.indexOf("Editing Talk:") != -1)
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, '(AfD)', 'afdtfunc');
var afdtfun = document.getElementById('afdtfunc').getElementsByTagName('ul')[0];
addlilink(afdtfun, 'javascript:keep()',"K", '');
addlilink(afdtfun, 'javascript:no_consensus()','NC', '');
addlilink(afdtfun, 'javascript:redirect()',"R", '');
addlilink(afdtfun, 'javascript:merge()',"M", '');
if(document.getElementById('ca-delete'))
{
document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[d]</span>';
}
if(document.getElementById('ca-move'))
{
document.getElementById('ca-move').firstChild.innerHTML = '[m]';
}
if(document.getElementById('ca-watch'))
{
document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
}
if(document.getElementById('ca-unwatch'))
{
document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
}
}
}
//END
function autocopyvio()
{
if (document.title.indexOf('Editing ') == 0)
{
var action = '';
var target = '';
if (location.search)
{
var l = location.search.substring(1).split('&');
for (var i = 0; i < l.length; ++i)
{
var eq = l[i].indexOf('=');
var name = l[i].substring(0, eq);
if (name == 'fakeaction')
action = l[i].substring(eq + 1);
else if (name == 'faketarget')
target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
}
}
if (action == 'copyviolist')
{
// var index = document.editform.wpTextbox1.value.lastIndexOf("\n==Footer==");
/* if (index == -1)
{
window.alert("Couldn't find footer\n\n");
}
else
{ */
// var firsthalf = document.editform.wpTextbox1.value.substr(0,index);
// var secondhalf = document.editform.wpTextbox1.value.substr(index);
document.editform.wpTextbox1.value += '*[[' + target + ']] <span class="plainlinks">([http://en.wikipedia.org/{{localurl:' + target + '|action=history}} history] · [http://en.wikipedia.org/{{localurl:' + target + '|diff=0}} last edit])</span>' + ' from [' + '] ~' + '~~' + '~';
document.editform.wpSummary.value = 'Copyvio ' + '[[' + target + ']]';
}
// }
}
}
function copyvio()
{
document.editform.wpTextbox1.value = '{' + '{' + 'copyvio|url=}}';
document.editform.wpSummary.value = 'copyvio';
var target = document.editform.action;
target = target.substring(target.indexOf('title=') + 6,
target.lastIndexOf('&action=submit'));
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
// date = months[date.getUTCMonth()] + '_' + date.getUTCDate();
var datestring = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();
var pagename = strip_namespace(target);
window.open('/w/index.php?title=Wikipedia:Copyright_problems/' + datestring + '/Articles' + '&action=edit&fakeaction=copyviolist&faketarget=' + pagename,
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
//END
$(createtabs)
function createtabs()
{
if (document.title.search(/Editing Wikipedia:Articles for creation\/.+ \(section\)/) ==0)
{
addTab("javascript:AfCresult(0)","acc", "ca-afc1", "Close AfC", "");
addTab("javascript:AfCresult(1)","rej", "ca-afc2", "Close AfC", "");
}
}
function AfCresult(type)
{
if (type==0) {var add = '{{subst:afc top|accept}}'; var done = '\n:{{done}} ~~~~'; var sum = 'RE: done.';}
else {var add = '{{subst:afc top}}'; var done = '\n:{{not done}} ~~~~'; var sum = 'RE: not done.';}
document.editform.wpSummary.value += sum;
var txt = document.editform.wpTextbox1.value;
if (txt.search('==\n') !=-1)
{
document.editform.wpTextbox1.value = txt.substring(0,txt.indexOf('==\n')) + '==\n' + add + '\n' + txt.substring(txt.indexOf('==\n') + 4);
}
else
{document.editform.wpTextbox1.value = add + '\n' + document.editform.wpTextbox1.value;}
txt = document.editform.wpTextbox1.value;
if (txt.indexOf('<!--Place the {{afc b}} tags above this line-->') !=-1)
{
document.editform.wpTextbox1.value = txt.split('<!--Place the {{afc b}} tags above this line-->')[0] + done + '\n{{subst:afc b}}' + '\n<!--Place the {{afc b}} tags above this line-->';
}
else
{document.editform.wpTextbox1.value += done + '\n{{subst:afc b}}';}
}
$(deltabs)
function deltabs()
{
if (document.title.indexOf('Editing ') ==0 && wgNamespaceNumber ==0) {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, '{{note}}', 'delfunc');
var delfunc = document.getElementById('delfunc').getElementsByTagName('ul')[0];
addlilink(delfunc, 'javascript:tagnote("Current")', 'Flux', '');
addlilink(delfunc, 'javascript:tagnote("cleanup")', 'Clean', '');
addlilink(delfunc, 'javascript:tagnote("tone")', 'Tone', '');
addlilink(delfunc, 'javascript:tagnote("verify")', 'Verify', '');
addlilink(delfunc, 'javascript:tagnote("unreferenced")', 'Cite', '');
addlilink(delfunc, 'javascript:tagnote("POV-check")', 'POV', '');
addlilink(delfunc, 'javascript:tagnote("accuracy")', 'Acc.', '');
addlilink(delfunc, 'javascript:tagnote("advert")', 'Adv.', '');
addlilink(delfunc, 'javascript:prod()', 'PfD', '');
addlilink(delfunc, 'javascript:vfd()', 'AfD', '');
addlilink(delfunc, 'javascript:copyvio()', 'c-vio', '');
} else if (document.title.indexOf('Editing ') ==0 && wgNamespaceNumber ==2) {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, '{{note}}', 'tagfunc');
var delfunc = document.getElementById('tagfunc').getElementsByTagName('ul')[0];
addlilink(delfunc, 'javascript:tagnote("indefblock")', 'Indef', '');
addlilink(delfunc, 'javascript:tagnote("vandalblock")', 'Vand', '');
}
}
if (window.addEventListener)
window.addEventListener('load', autovfd, false);
else if (window.attachEvent)
window.attachEvent('onload', autovfd);
$(morelinks);
/*** Make old AfD's appear or disappear - from AmiDaniel's monobook ***/
function hideafd()
{
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("vfd") != -1)
divs[x].style.display = "none";
document.getElementById('footer').style.display = 'none';
}
function showafd()
{
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("vfd") != -1)
divs[x].style.display = "";
document.getElementById('footer').style.display = '';
}
function morelinks() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Wikipedia:Articles for deletion") == 0 && location.href.indexOf('&action=') == -1)
{
addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
ta['ca-hide'] = ['', 'Hide closed AFDs'];
addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
ta['ca-show'] = ['', 'Show closed AFDs'];
}
}
//</nowiki></pre>
// CSD AutoReason
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:^demon/csd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// Admin warning tools
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Voice of All/Adminwarnings/monobook.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
// UTC clock
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
//COOKIE FUNCTIONS
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
//END
// --- ADD VARIOUS LINKS ----
if(!addToolBoxLink) {
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, url, name, id);
}}
//
if(!addTopLink) {
function addTopLink(url, name, id){
var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0];
addlilink(personal, url, name, id);
}}
//
if(!addNavLink) {
function addNavLink(url, name, id){
var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
addlilink(navigation, url, name, id);
}}
//
if(!addTab) {
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key);
}}
if(!addLink) {
function addLink(where, url, name, id, title, key, after){
//* where is the id of the toolbar where the button should be added;
// i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
//
//* url is the URL which will be called when the button is clicked.
// javascript: urls can be used to do more complex things.
//
//* name is what will appear as the name of the button.
//
//* id is the id of the button; it's best to define one.
// Use a prefix to make sure its unique. Optional.
//
//* title is the tooltip title that gives a longer description
// of the button; if you define a accesskey, mention it here. Optional.
//
//* key is the char you want for the accesskey. Optional.
//
//* after is the id of the button you want to follow this one. Optional.
//
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}}
if(!addlilink) {
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}}
//<pre><nowiki>
//When you install this script, you will also need to install cookie functions:
//[[User:GeorgeMoney/UserScripts/helpers/all#Cookies]]
//You will also need the addlilink module
//_-_-_-_-_-_-_-_-_-_CSD-_-_-_-_
if(window.location.href.indexOf('speedydel') != -1 && window.location.href.indexOf('action=delete') != -1)
{ addOnloadHook(function() { doeasycsd(); }); }
//The accesskey to use on the tab
var tab_shortcut = "a";
//the criteria to not show "content was"
var nocontent = "A2|A8|G10|U1";
//Delete the talkpage along with the main page
var deletetalk = true;
//Namespaces to not delete the talkpage of
var nodeletetalkNS = "User|Help";
//Image deletion extention
var image_use = true;
//The summary to use when removing from article
var image_sum = "Commenting out Image:$1 because it has been deleted";
//The button to click when commenting out image
var image_click = 'wpSave';
//If image not found on page, ask to skip it, or just skip it period
var image_asktoskip = false;
//Article wikilink removal extention
var article_use = true;
//Summary to use when removing wikilink
var article_sum = "Removing wikilink to [[$1]] because it was deleted";
//The button to click when removing wikilink
var article_click = 'wpSave';
//The namespaces to ask you if you want to remove link from it (namespace of the page deleted)
var article_remove_ns = ""; //"User|Talk|Wikipedia"; //if is blank, it means main namespace
//If link not found on page, ask to skip it
var article_asktoskip = false;
//namespaces to not remove link (namespace of page where the link is being removed from)
var article_noremove_ns = "User|Wikipedia|User_talk|Image|Category|Category_talk";
//To open the creator's talk page Please set this to false it is experimental
var useopentp = false;
//Default summary for criterias. $1 means where the criteria name will go
//This is NOT what is used if you leave the inputbox blank. See above
//This is called from the function defaultsum()
var thedefaultsum = "Per [[WP:CSD#$1|Criteria for Speedy Deletion, $1]]";
//The default criteria to use if the inputbox is blank
//Note: This is NOT the defaultsum. The defaultsum is the summary to use as default for criterias that you haven't set a special summary
//This is ONLY used if the inputbox is blank, or you entered a summary that is not defined
//This just calls the summary for whatever value you put in the var
var defaultcrit = "I5";
var msgs = {
//This is all the messages used in the script
//Extra summaries that you will type into the inputbox. so if you type "extra1" it will go to the value of "extra1"
//Make sure there is a comma at the end of every line
//Note: The extra summaries are case sensitive. The WP:CSD ones are not
extra1: "Extra summary",
//All the criterias. Replace defualtsum('foo') with "yoursummary". so G1: defaultsum('G1'), becomes G1: "yoursummary",
G1: defaultsum('G1'),
G2: defaultsum('G2'),
G3: defaultsum('G3'),
G4: defaultsum('G4'),
G5: defaultsum('G5'),
G6: defaultsum('G6'),
G7: defaultsum('G7'),
G8: defaultsum('G8'),
G9: defaultsum('G9'),
G10: "Per [[WP:CSD#G10|CSD G10 - Attack page]] - Please don't post [[WP:ATK|attacks]].",
G11: 'Per [[WP:CSD#G11|CSD G11 - Advertising]] - Please see our [[WP:SPAM|guidelines]].',
G12: 'Per [[WP:CSD#G12|CSD G12 - Copyright infringement]], Please see our [[WP:COPYRIGHT|copyright policy]]. Find answers to common questions at our [[Wikipedia:Copyright FAQ|Copyright FAQ]] and [[Wikipedia:Contributing_FAQ#Copyrights|Contributing FAQ]].',
A1: '[[WP:CSD#A1|CSD A1 - Limited to no context]]',
A2: 'per [[WP:CSD#A2|CSD A2 - Foreign language article]], Foreign language articles that exist on another Wikimedia project are eligible for speedy deletion',
A3: "Per [[WP:CSD#A3|CSD A3 - No content whatsoever]], Any article consisting only of links elsewhere, a rephrasing of the title, and/or attempts to correspond with the person or group named by its title",
A4: defaultsum('A4'),
A5: defaultsum('A5'),
A6: "Per [[WP:CSD#G10|CSD G10 - Attack page]] - Please don't post [[WP:ATK|attacks]].",
A7: "Per [[WP:CSD#A7|CSD A7 - Unremarkable people, groups, companies and web content that does not assert the importance or significance of its subject.]]",
A8: 'Per [[WP:CSD#G12|CSD G12 - Copyright infringement]], Please see our [[WP:COPYRIGHT|copyright policy]]. Find answers to common questions at our [[Wikipedia:Copyright FAQ|Copyright FAQ]] and [[Wikipedia:Contributing_FAQ#Copyrights|Contributing FAQ]].',
R1: defaultsum('R1'),
R2: defaultsum('R2'),
R3: defaultsum('R3'),
I1: defaultsum('I1'),
I2: defaultsum('I2'),
I3: defaultsum('I3'),
I4: defaultsum('I4'),
I5: defaultsum('I5'),
I6: defaultsum('I6'),
I7: defaultsum('I7'),
I8: defaultsum('I8'),
I9: defaultsum('I9'),
C1: defaultsum('C1'),
C2: defaultsum('C2'),
C3: defaultsum('C3'),
U1: defaultsum('U1'),
U2: defaultsum('U2'),
T1: defaultsum('T1'),
P1: defaultsum('P1'),
P2: defaultsum('P2'),
prod: 'Prod that is older than 5 days.',
dummy: 'this is a dummy entry to break the comma'
};
if(/*document.getElementById('ca-delete')*/wgCanonicalNamespace != 'Special') {
$(function() {
var tbsd = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tbsd, 'javascript:doeasycsd()', 'speedy delete', 'ca-speedy', 'speedy delete', tab_shortcut);
});
}
var nocontent = nocontent.split('|');
var nodeletetalkNS = nodeletetalkNS.split('|');
var article_remove_ns = article_remove_ns.split('|');
var article_noremove_ns = article_noremove_ns.split('|');
var myPageName = wgPageName.replace(/_/g, ' ');
//alert(msgs.thedefaultsum + msgs.extra1);
function defaultsum(h) {
var f = thedefaultsum.replace(/\$1/g, h);
return f;
}
function doeasycsd() {
var alm = true;
if(window.location.href.indexOf('useurl') == -1) {
var otherurlstf = "";
var useprompt = true;
if(document.getElementById('delete')) {
useprompt = false;
var md = document.getElementById('delete');
var linksf = md.getElementsByTagName('a');
// alert("DEBUG: Over the next "+(linksf.length+1)+" alerts, you will see the urls of all the links in the speedy tag");
for(var i=0; i<linksf.length; i++) {
var ll = linksf[i];
// alert("DEBUG: Link #"+(i+1)+": href: "+ll.href+"\ninnerHTML: "+ll.innerHTML);
if(ll.href.indexOf("Wikipedia:Criteria_for_speedy_deletion") != -1||ll.href.indexOf("WP:CSD") != -1) {
var usecrit = ll.href.split('#');
if(usecrit[1] == undefined) usecrit = false;
else {
// alert("DEBUG: WP:CSD criteria was found on link #"+(i+1)+": href: "+ll.href);
usecrit = usecrit[1];
break;
}
} else var usecrit = false;
}
if(usecrit === false) {
useprompt = true;
//ok not a speedy lets try for a prod
for(var i=0; i<linksf.length; i++) {
var ll = linksf[i];
if(ll.href.indexOf("Template:Prodwarning") != -1) {
var useprod = true;
break;
} else
var useprod = false;
}
if(useprod) {
var useprompt = false;
var r = prompt('A prod tag was found on this page\nTo delete the page using the prod criteria, leave this textbox blank and press ok\nTo use a different criteria, enter it in the textbox and press ok');
if(r==null) { alert("Action canceled"); return; }
if(r=="") r = 'prod';
}
} else {
var r = prompt('A speedy deletion criteria, "'+usecrit+'" was found on this page\nTo delete the page using that criteria, leave this textbox blank and press ok\nTo use a different criteria, enter it in the textbox and press ok');
if(r==null) { alert("Action canceled"); return; }
if(r=="") r = usecrit;
}
}
if(useprompt) var r = prompt('What speedy criteria?');
if(r == null) {
alert('Action canceled'); return;
} else if(r=="s") {
var re = prompt('What extra summary?');
if(re == null) { alert('Action canceled'); return; }
var usesum = re;
var lr = "spec";
var alm = false;
} else if(r=="h") {
var re = prompt('What extra summary to use \nwithout showing "content was"?');
if(re == null) { alert('Action canceled'); return; }
var usesum = re;
var lr = "specnc";
var alm = false;
}
for(var i = 0; i<article_remove_ns.length; i++) {
var nf = article_remove_ns[i];
if(wgCanonicalNamespace == nf) {
var dolink = true;
break;
} else {
var dolink = false;
}
}
if(window.location.href.indexOf('?') != -1) var charuse = '&';
else var charuse = '?';
if(wgCanonicalNamespace == "Image"&&image_use) {
if(confirm("Would you also like to remove all the file links from this image?")) {
var gop = window.location.href.replace('action=delete', '')+charuse+'&imageopen=true';
otherurlstf = "&ext_dorem_img=true&ext_dorem_goto="+escape(gop);
}} else if(dolink && article_use) {
if(confirm("Would you also like to remove all the wikilinks pointing to this page?")) {
var nop = unescape(window.location.href).replace(wgPageName, 'Special:Whatlinkshere/'+wgPageName)+charuse+'&linkopen=true';
otherurlstf = "&ext_dorem_art=true&ext_dorem_goto="+escape(nop);
}}
} else {
var r = gvo('delcrit');
}
if(r.indexOf('s|') == 0) { var usesum = r.replace('s|', ''); var lr = "spec"; var alm = false; }
else if(r.indexOf('h|') == 0) { var usesum = r.replace('h|', ''); var lr = "specnc"; var alm = false; }
if(r!=''&&alm) {
var cr = r.toUpperCase();
eval('if(msgs.'+cr+' != undefined) { var usesum = msgs.'+cr+'; var lr = \''+cr+'\'; } else if(msgs.'+r+' != undefined) { var usesum = msgs.'+r+'; var lr = \''+r+'\'; } else { var usesum = msgs.'+defaultcrit+'; var lr = defaultcrit; }');
}
if(window.location.href.indexOf('speedydel') == -1) {
if(lr == "spec") { lr = "s|"+usesum; }
if(lr == "specnc") { lr = "h|"+usesum; }
if(wgNamespaceNumber % 2 == 0 && deletetalk) var urldeletetalk = "&deletetalk="+escape(((wgCanonicalNamespace != '')?wgCanonicalNamespace+'_talk:':'Talk:')+wgTitle);
else var urldeletetalk = "";
window.location.href = (document.getElementById('ca-delete').firstChild.href+'&speedydel=true&delcrit='+escape(lr)+'&useurl=true'+urldeletetalk+otherurlstf);
if(useopentp) { window.open(document.getElementById('ca-history').firstChild.href+'&opentalk=true&limit=1'); window.open(document.getElementById('ca-history').firstChild.href+'&opentalk=true&opencontribs=true&limit=1'); }
} else if(window.location.href.indexOf('speedydel') != -1) {
var mydel = document.getElementById('wpReason');
if(mydel) {
var olddelsum = mydel.value;
for(var i = 0; i<nocontent.length; i++) {
var nc = nocontent[i];
if(lr == nc||lr=="specnc") {
var donotc = true;
break;
} else {
var donotc = false;
}
}
if(donotc||mydel.value=="") { var olddelsum = ""; } else { var olddelsum = "- "+olddelsum; }
var newdelsum = usesum+" "+olddelsum;
document.getElementById('wpReason').value = newdelsum;
var inputs = document.getElementsByTagName('input');
for(var i = 0; i<nodeletetalkNS.length; i++) {
var nd = nodeletetalkNS[i];
if(wgCanonicalNamespace == nd) {
var donod = false;
break;
} else {
var donod = true;
}
}
if(window.location.href.indexOf('deletetalk') != -1&&deletetalk&&donod) {
var wop = window.location.href.split('&deletetalk=')[0].replace(wgPageName, gvo('deletetalk'));//+'&closewindow=true';
createCookie('delscript_goto', escape(wop));
}
if(window.location.href.indexOf('ext_dorem_img=true') != -1) {
var gop = gvo('ext_dorem_goto');
createCookie('delscript_goto', escape(gop));
createCookie('delscript_imagepage', escape(wgTitle));
}
if(window.location.href.indexOf('ext_dorem_art=true') != -1) {
var nop = gvo('ext_dorem_goto');
createCookie('delscript_goto', escape(nop));
createCookie('delscript_linkpage', escape(myPageName));
}
for (i=0; i<inputs.length; i++) {
if (inputs[i].name == 'wpConfirmB') {
inputs[i].click();
}
}
}
}
}
if(readCookie('delscript_goto') != null) {
var cookie = unescape(readCookie('delscript_goto'));
eraseCookie('delscript_goto');
window.location.href = (cookie);
}
if(window.location.href.indexOf('imageopen=true') != -1) {
var togoto = "";
$(function() {
if(readCookie('delscript_doimg') == null) {
var ok = true;
if(ok) {
createCookie('delscript_image_ok', 0);
var main1 = document.getElementById('filelinks');
if(main1) {
var main2 = main1.nextSibling.nextSibling;
if(main2) {
var main3 = main2.nextSibling;
if(main3) {
var main4 = main3.nextSibling.nextSibling;
if(main4) {
if(main2.tagName == "P" && main3.id == "linkstoimage" && main4.tagName == "UL") {
var lis = main4.getElementsByTagName('li');
for(var i = 0; i < lis.length; i++) {
var hr = lis[i].firstChild.href;
var realpg = unescape(readCookie('delscript_imagepage'));
var wnopen = hr+'?action=edit&remimage=true&image_to_delete='+escape(realpg);
//window.open(wnopen);
togoto += "|"+wnopen;
}
togoto += "|"+window.location.href.split('&imageopen=true')[0];
createCookie('delscript_togoto', escape(togoto.substr(1)));
createCookie('delscript_doimg', 'yes');
eraseCookie('delscript_oktogoto');
location.reload();
}
}}}}
}} else {
eraseCookie('delscript_doimg');
createCookie('delscript_numgoto', '0');
var oldnum = parseInt(readCookie('delscript_numgoto'));
var newnum = oldnum + 1;
createCookie('delscript_numgoto', newnum);
var myarr = unescape(readCookie('delscript_togoto')).split('|');
//alert('doimg. togoto is set, and it is: '+myarr+'; numgoto is: '+readCookie('delscript_numgoto')+' newnum: '+newnum+'; oldnum: '+oldnum);
window.location.href = myarr[oldnum];
}
});
}
if(window.location.href.indexOf('linkopen=true') != -1) {
var togoto = ""; var templategoto = "";
$(function() {
if(readCookie('delscript_doart') == null) {
var ok = true;
if(ok) {
if(readCookie('delscript_latergoto') != null) { togoto = unescape(readCookie('delscript_latergoto')); eraseCookie('delscript_latergoto'); var notemplate = true; }
else {
var notemplate = false;
var lis = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
for(var i = 0; i < lis.length; i++) {
var hr = lis[i].firstChild;
if(!hr) continue;
hr = hr.href;
if(hr.indexOf('&redirect=no') != -1) var isRedir = true;
else var isRedir = false;
var page_ns = hr.substr(('http://'+location.host).length);
page_ns = page_ns.split(':')[0];
if(page_ns == hr) page_ns = "";
else {
page_ns = page_ns.split('/');
page_ns = page_ns[(page_ns.length - 1)];
}
for(var j=0; j<article_noremove_ns.length; j++) {
var nk = article_noremove_ns[j];
if(page_ns == nk) {
var oktocont = false;
break;
} else var oktocont = true;
}
if(!oktocont) continue;
var realpg = unescape(readCookie('delscript_linkpage'));
if(!isRedir) var wnopen = hr+'?&action=edit&remlink=true&link_to_delete='+escape(realpg);
else var wnopen = hr+'?&action=delete&speedydel=true&delcrit=r1&useurl=true';
if(page_ns == "Template") templategoto += "|"+wnopen;
else togoto += "|"+wnopen;
}
togoto += "|"+window.location.href.split('&linkopen=true')[0];
}
if(templategoto != '') templategoto += "|"+window.location.href;
if(togoto.indexOf('|') == 0) togoto = togoto.substr(1);
if(templategoto.indexOf('|') == 0) templategoto = templategoto.substr(1);
if(notemplate) templategoto = "";
var mygoto = (templategoto != '')?templategoto:togoto;
if(mygoto == templategoto) createCookie('delscript_latergoto', escape(togoto));
createCookie('delscript_togoto', escape(mygoto));
createCookie('delscript_doart', 'yes');
eraseCookie('delscript_oktogoto');
location.reload();
}} else {
eraseCookie('delscript_doart');
createCookie('delscript_numgoto', '0');
var oldnum = parseInt(readCookie('delscript_numgoto'));
var newnum = oldnum + 1;
createCookie('delscript_numgoto', newnum);
var myarr = unescape(readCookie('delscript_togoto')).split('|');
//alert('doimg. togoto is set, and it is: '+myarr+'; numgoto is: '+readCookie('delscript_numgoto')+' newnum: '+newnum+'; oldnum: '+oldnum);
window.location.href = myarr[oldnum];
}
});
}
if(window.location.href.indexOf('remimage=true') != -1 && window.location.href.indexOf('action=edit') != -1) {
$(function() {
var oldtext = document.getElementById('wpTextbox1').value;
var txt = document.getElementById('wpTextbox1');
var img = gvo('image_to_delete');
var regimg = img.replace(/\./g, '\\.').replace(/\*/g, '\\*').replace(/\//g, '\\/')
.replace(/[ _]/g, '[ _]')
var reg1 = new RegExp('\\[\\[[Ii]mage:\\s*'+regimg+'\\s*(\\|.*?\\]|\\])\\]', "ig");
var rpl1 = '<!-- Commented out because image was deleted: [[Image:'+img+'$1] -->';
var reg2 = new RegExp('([Ii]mage:)?'+regimg, "ig");
var rpl2 = '<!-- Commented out because image was deleted: $1'+img+' -->';
var newtext = oldtext.replace(reg1, rpl1);
var is_same = (newtext == oldtext);
if(is_same) newtext = oldtext.replace(reg2, rpl2);
txt.value = newtext;
document.getElementById('wpSummary').value = image_sum.replace(/\$1/g, img);
document.getElementById('wpMinoredit').checked = "checked";
document.getElementById('wpWatchthis').checked = "";
if(is_same&&image_asktoskip) {
var oktoclick = confirm("The image, "+img+" was not found on this page \n probably due to it being in an odd format \n press ok to go and remove it yourself,\n or cancel to just abort this edit and move on to the next");
} else var oktoclick = false;
createCookie('delscript_oktogoto', 'yes');
if(!oktoclick) document.getElementById(image_click).click();
//if(image_click == "wpSave") window.close();
});
}
if(window.location.href.indexOf('remlink=true') != -1 && window.location.href.indexOf('action=edit') != -1) {
$(function() {
var oldtext = document.getElementById('wpTextbox1').value;
var txt = document.getElementById('wpTextbox1');
var lnk = gvo('link_to_delete');
var reglnk = lnk.replace(/\./g, '\\.').replace(/\*/g, '\\*').replace(/\//g, '\\/')
.replace(/[ _]/g, '[ _]')
var reg = new RegExp('\\[\\['+reglnk+'\\|?(.*?)\\]\\]', "ig");
newtext = oldtext.replace(reg, '{{D:$1}}');
newtext = newtext.replace(/\{\{D\:\}\}/g, lnk);
newtext = newtext.replace(/\{\{D:(.*?)\}\}/g, '$1');
txt.value = newtext;
document.getElementById('wpSummary').value = article_sum.replace(/\$1/g, lnk);
document.getElementById('wpMinoredit').checked = "checked";
document.getElementById('wpWatchthis').checked = "";
if(newtext == oldtext&&article_asktoskip) {
var oktoclick = confirm("The link, "+lnk+" was not found on this page \n probably due to it being in an odd format \n press ok to go and remove it yourself,\n or cancel to just abort this edit and move on to the next");
} else var oktoclick = false;
createCookie('delscript_oktogoto', 'yes');
if(!oktoclick) document.getElementById(article_click).click();
//if(image_click == "wpSave") window.close();
});
}
if(readCookie('delscript_togoto') != null&&readCookie('delscript_oktogoto') != null) {
// alert('Togoto is set, and it is: '+readCookie('delscript_togoto')+'; numgoto is: '+readCookie('delscript_numgoto'));
var oldnum = parseInt(readCookie('delscript_numgoto'));
var newnum = oldnum + 1;
createCookie('delscript_numgoto', newnum);
var myarr = unescape(readCookie('delscript_togoto')).split('|');
if(newnum == myarr.length) { eraseCookie('delscript_togoto'); eraseCookie('delscript_numgoto'); }
eraseCookie('delscript_oktogoto');
window.location.href = myarr[oldnum];
}
if(useopentp && window.location.href.indexOf('opentalk=true') != -1 && window.location.href.indexOf('action=history') != -1) {
$(function() {
for(var i=0; i<document.links.length; i++) {
var l = document.links[i];
if(l.innerHTML.indexOf('Earliest') == 0) {
window.location.href = (l.href+'&opentalk=true');
return;
} else { foundit = false; }
}
if(!foundit) {
for(var i=0; i<document.getElementsByTagName('form').length; i++){
var k = document.getElementsByTagName('form')[i];
if(k.method=="get" && k.firstChild.name == "title" && k.firstChild.type == "hidden") {
var lastli = k.getElementsByTagName('li')[(k.getElementsByTagName('li').length - 1)];
var g = lastli.getElementsByTagName('span')[0].getElementsByTagName('a');
for(var j = 0; j<g.length; j++) {
var f = g[j];
if(f.firstChild.data == "Talk") {
var go = f.href;
} else if(f.firstChild.data == "contribs"&&window.location.href.indexOf('opencontribs=true') != -1) {
var wo = f.href;
}
}
}
}
if(window.location.href.indexOf('opencontribs=true') != -1) {
window.location.href = (wo);
}
if(window.location.href.indexOf('opencontribs=true') == -1) {
window.location.href = (go);
}
}
});
}
//URL parameter function:
//Originally from [[User:Lupin/autoedit.js]]
function gvo(paramName) {
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var h=document.location;
var m;
if (m=cmdRe.exec(h)) {
try {
return unescape(decodeURI(m[1]));
} catch (someError) {}
}
return null;
};
if(window.location.href.indexOf('action=delete') != -1 && document.title.indexOf('Action complete') == 0&&!deletetalk) {
$(function() {
if(document.getElementById('t-whatlinkshere').firstChild.href.indexOf('&') != -1) { var chara = '&'; } else { var chara = '?'; }
window.location.href = (document.getElementById('t-whatlinkshere').firstChild.href+chara+'delfrom=true');
});
}
if(window.location.href.indexOf('delfrom=true') != -1&&!deletetalk) {
$(function() {
var bx = document.getElementById('contentSub');
var hea = bx;
var bxlw = document.createElement('div');
bxlw.id = "msgwrapper";
bxlw.innerHTML = '<big><font color="green">Page successfully deleted!</font></big>';
hea.parentNode.insertBefore(bxlw, hea.nextSibling);
});
}
//END
//</nowiki></pre>
function loadJS(s) {
s = s.replace(/^\[\[/, '').replace(/\]\]$/, '').replace(" ", "_");
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=' + s
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
function loadJSext(s) {
document.write('<script type="text/javascript" src="'+ s + '"></script>');
}
function loadCSS(page){
page=page.replace(" ", "_");
document.write('<style type="text/css">@import "'+mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?title='+page+'&action=raw&ctype=text/css";</style>');
}
function loadCSSext(page){
document.write('<style type="text/css">@import "'+page+'";</style>');
}
importScript('User:^demon/vero.js');
importScript('User:Mr.Z-man/closeAFD.js');