User:Mojo Hand/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:Mojo Hand/monobook.css. |
// <syntaxhighlight lang=javascript>
// CSD AutoReason
importScript('User:AuburnPilot/csd.js');
// [[User:Outriggr/metadatatest.js]] <nowiki>
importScript('User:Outriggr/metadatatest.js');
assessmentMyTemplateCode = ["{{WikiProject Virginia|class=|importance=}}"];
assessmentDefaultProject = "WikiProject Virginia";
// </nowiki>
assessmentMarkAsMinor = false;
//
// Edit tools for the vandal whack-a-mole game
// [[User:Kbh3rd/whackamole.js]] - please include this line
//
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Kbh3rd/whackamole.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//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 autoafd_result()
{
var close = prompt("Result of debate?")
var f = document.editform, t = f.wpTextbox1;
t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0');
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 autoafd_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 autoafd_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 = "{{" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article survived AfD";
}
function autoafd_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 = "{{" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article survived AfD with no consensus";
}
function autoafd_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 = "{{" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";
}
function autoafd_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 = "{{" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD";
}
function autoafd_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 = "{{" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "AfDed; result was " + result;
}
function autoafd_add_afd_tabs()
{
// Only add for pages with the right string somewhere in the title
if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
{
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
}
if (document.title.indexOf("Editing Talk:") != -1)
{
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep");
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge");
mw.util.addPortletLink('p-cactions', 'javascript:autoafd_other()', "other");
}
}
$(autoafd_add_afd_tabs);
//end AfD closing script
// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades
// Add an [edit] link to pages
$(function () {
// if this is preview page or generated page, stop
if(
document.getElementById("wikiPreview") ||
document.getElementById("histlegend") ||
document.getElementById("difference") ||
document.getElementById("watchdetails") ||
document.getElementById("ca-viewsource") ||
window.location.href.indexOf("/wiki/Special:") != -1
) {
if(window.location.href.indexOf("&action=edit§ion=0") != -1) {
document.getElementById("wpSummary").value = "/* Intro */ ";
}
return;
};
// get the page title
var pageTitle = mw.config.get('wgPageName');
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="Edit section: '+pageTitle+'">edit intro</a>]</div>';
// insert divContainer into the DOM below the h1
if(window.location.href.indexOf("&action=edit") == -1) {
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
}
});
//[[User:ais523 non-admin/adminrights.js]]
//
// This script highlights bluelinks to admins' userpages or talkpages in bodyContent (that is, everything but the tabs, personal
// links at the top of the screen and sidebar) by giving them a cyan background. Please import this script using importScript,
// rather than copying the code, as the list of admins is hard-coded for performance and if you copy the code the list won't update
// with time (I update it from time to time). You can do this by substing Template:js with this script's name as an argument in your
// monobook.js.
//
// If you want a colour other than cyan, add
// .ais523_adminrights_admin {background-color: #FFFF00 !important}
// (or any other colour code) to your monobook.css file.
//Update this list at
//http://en.wikipedia.org/w/index.php?title=Special:Listusers&limit=5000&group=sysop&ais523update=y
var adminrights=new Array();
importScript('User:Ais523/adminrights-admins.js'); //[[User:Ais523/adminrights.js]]
//Updating script
$(function(){
if(location.href=="http://en.wikipedia.org/w/index.php?title=Special:ListUsers&limit=5000&"+
"group=sysop&ais523update=y")
{
var h=document.getElementById('bodyContent').innerHTML;
var a=new Array();
h=h.split(/\< *li *\>/i);
var i=0;
while(++i<h.length)
{
a[h[i].split(">")[1].split("<")[0]]=h[i].split(/\< *\/ *li *\>/i)[0];
}
for(i in a)
{
document.write("adminrights['"+
encodeURIComponent(i).split("\\").join("\\\\").split("'").join("%27")
.split("(").join("%28").split(")").join("%29")
.split("%21").join("!").split("%2C").join(",")
.split("%3A").join(":")+"']=1;<BR/>");
}
}
});
//Highlighting script. Based on [[User:ais523/highlightmyname.js]].
function highlightadmins(n,p) //node, parent node
{
while(n!=null)
{
if(n.nodeType==1&&n.tagName.toLowerCase()=="a") //anchor
{
if(n.href.indexOf("http://en.wikipedia.org/wiki/User:")!=-1)
{
var u=n.href.split("http://en.wikipedia.org/wiki/User:")[1];
if(adminrights[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#cedff2";
if(n.className==null||n.className=="") n.className="ais523_adminrights_admin";
else n.className+="ais523_adminrights_admin";
}
n=n.nextSibling;
}
else if(n.href.indexOf("http://en.wikipedia.org/wiki/User_talk:")!=-1)
{
var u=n.href.split("http://en.wikipedia.org/wiki/User_talk:")[1];
if(adminrights[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#cedff2";
if(n.className==null||n.className=="") n.className="ais523_adminrights_admin";
else n.className+=" ais523_adminrights_admin";
}
n=n.nextSibling;
}
else if(n.href.indexOf("http://en.wikipedia.org/wiki/Special:Contributions:")!=-1)
{
var u=n.href.split("http://en.wikipedia.org/wiki/Special:Contributions:")[1];
if(adminrights[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#cedff2";
if(n.className==null||n.className=="") n.className="ais523_adminrights_admin";
else n.className+=" ais523_adminrights_admin";
}
n=n.nextSibling;
}
else if(n.href.indexOf("http://en.wikipedia.org/w/index.php?title=User:")!=-1)
{
var u=n.href.split("http://en.wikipedia.org/w/index.php?title=User:")[1];
if(adminrights[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#cedff2";
if(n.className==null||n.className=="") n.className="ais523_adminrights_admin";
else n.className+=" ais523_adminrights_admin";
}
n=n.nextSibling;
}
else if(n.href.indexOf("http://en.wikipedia.org/w/index.php?title=User_talk:")!=-1)
{
var u=n.href.split("http://en.wikipedia.org/w/index.php?title=User_talk:")[1];
if(adminrights[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#cedff2";
if(n.className==null||n.className=="") n.className="ais523_adminrights_admin";
else n.className+=" ais523_adminrights_admin";
}
n=n.nextSibling;
}
else
{
if(n.firstChild!=null) highlightadmins(n.firstChild,n);
n=n.nextSibling;
}
}
else
{
if(n.firstChild!=null) highlightadmins(n.firstChild,n);
n=n.nextSibling;
}
}
}
$(function() {
if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&&
location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&&
location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&&
mw.config.get('wgPageName')!="Special:Preferences")
{
highlightadmins(document.getElementById('bodyContent').firstChild,
document.getElementById('bodyContent'));
}
});
importScript('User:ais523/catwatch.js');
importScript('User:Ohconfucius/script/MOSNUM dates.js'); // [[User:Ohconfucius/script/MOSNUM dates.js]]
// </syntaxhighlight>