User:Malinaccier/monobook.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
importScript("User:Jfmantis/pagesCreated.js"); // [[User:Jfmantis/pagesCreated.js]]
importScript("User:Lupin/recent2.js");
importScript('User:Mr.Z-man/moverevert.js');
// [[User:Dschwen/highlightredirects.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//This script ([[User:ais523/highlightmyname2.js]]) highlights all instances of the
//logged-in user's username on pages by giving them a bright red background. It only
//checks bodyContent, not titles or sidebars, and doesn't change edit windows or
//Special:Preferences.
//<nowiki><pre>
function highlightmyname(n,p) //node, parent node
{
while(n!=null)
{
if(n.nodeType==3) //text node
{
if(n.data.toLowerCase().indexOf(wgUserName.toLowerCase())!=-1)
{
var ix=n.data.toLowerCase().indexOf(wgUserName.toLowerCase());
var t1=ix?document.createTextNode(n.data.substr(0,ix)):null;
var t2=document.createTextNode(n.data.substr(ix,wgUserName.length));
var t3=ix+wgUserName.length==n.data.length?null:
document.createTextNode(n.data.substr(ix+wgUserName.length));
var s1=document.createElement("SPAN");
s1.style.backgroundColor="#FF0000";
s1.appendChild(t2);
var s2=document.createElement("SPAN");
if(t1!=null) s2.appendChild(t1);
s2.appendChild(s1);
if(t3!=null) s2.appendChild(t3);
p.replaceChild(s2,n);
if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes
n=s2.nextSibling;
}
else
n=n.nextSibling;
}
else
{
if(n.firstChild!=null) highlightmyname(n.firstChild,n);
n=n.nextSibling;
}
}
}
addOnloadHook(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&&
location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")
highlightmyname(document.getElementById('bodyContent').firstChild,
document.getElementById('bodyContent'));
});
//</pre></nowiki>
//[[Category:Wikipedia scripts]]
importScript('User:AzaToth/twinkle.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');
importScript('User:Ais523/adminrights.js');
//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?");
if (close != null && close != "") {
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof wgUserGroups == "object" && wgUserGroups) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
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 + "'''." + nonadmin + " " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
if (t.value.length > 0) {
t.value += '\n';
}
t.value += "{"+"{subst:" + "ab" + "}}";
f.wpSummary.value = "Closing debate; result was " + close + nonadmin;
}
}
function autoafd_relist() {
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0) {
t.value += '\n';
}
t.value += "{"+"{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof wgUserGroups == "object" && wgUserGroups) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
f.wpSummary.value = "Relisting debate" + nonadmin;
}
function autoafd_keep() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
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;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof wgUserGroups == "object" && wgUserGroups) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
f.wpSummary.value = "Article survived AfD" + nonadmin;
}
}
}
function autoafd_no_consensus() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
if (votepage != null && votepage != "") {
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?");
if (date != null && date != "") {
var redirect = prompt("Redirect to?");
if (redirect != null && redirect != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
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;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof wgUserGroups == "object" && wgUserGroups) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD" + nonadmin;
}
}
}
}
function autoafd_merge() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var redirect = prompt("Merge and redirect to?");
if (redirect != null && redirect != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (redirect != null && redirect != "") {
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?");
if (date != null && date != "") {
var result = prompt("Result was?");
if (result != null && result != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
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;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof wgUserGroups == "object" && wgUserGroups) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
f.wpSummary.value = "AfDed; result was " + result + nonadmin;
}
}
}
}
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) {
addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
}
if (document.title.indexOf("Editing Talk:") != -1) {
addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep");
addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge");
addPortletLink('p-cactions', 'javascript:autoafd_other()', "other");
}
}
addOnloadHook(autoafd_add_afd_tabs);
//end AfD closing script
//Auto AFD script
//Please include the two following lines
//Modified version of AutoVFD script to work with AFD
//Script Modified by User:Jtkiefer
//Further modified to work with [[WP:AFDC]] by [[User:ais523]]
// This needs to change depending on skin used.
function add_link(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
tabs.appendChild(li);
}
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 afd()
{
document.editform.wpTextbox1.value = '{{' + 'subst:afd}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'afd';
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 = date.getUTCFullYear() + '_' + months[date.getUTCMonth()] + '_' + date.getUTCDate();
var pagename = strip_namespace(target);
window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/' + pagename + '&action=edit&fakeaction=afdsub&faketarget=' + target,
'Afd ' + unescape(target),
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
window.open('/w/index.php?title=Wikipedia:Articles_for_deletion/Log/' + date + '&action=edit&fakeaction=afdlist&faketarget=' + pagename,
'AfdLog ' + unescape(target),
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
function autoafd()
{
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 == 'afdlist')
{
document.editform.wpTextbox1.value += '{{' + 'Wikipedia:Articles for deletion/' + target + '}}\n';
document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
}
else if (action == 'afdsub')
{
if (document.editform.wpTextbox1.value.length > 0)
{
target = document.editform.action;
target = unescape(target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'))).replace(/_/g, ' ');
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' +
'{{'+'REMOVE THIS TEMPLATE WHEN '+'CLOSING THIS AfD|>>add cat here<<}}\n'+
':{{la|' + target + '}} – <includeonly>([[Wikipedia:Articles for deletion/' + target + '|View AfD]])</includeonly>\n'+
'Reason for nomination. ~~' + '~~\n*\n*\n*\n';
}
else
add_link('javascript:afd()', 'Afd');
}
}
addOnloadHook(autoafd);
//
addOnloadHook(function() {
addPortletLink('p-navigation','/wiki/Wikipedia:RFPP','RFPP');
addPortletLink('p-navigation',' http://toolserver.org/%7Erussell/cgi-bin/csd.py','Speedy deletion');
addPortletLink('p-navigation','/wiki/WP:AIV','AIV');
addPortletLink('p-navigation','/wiki/Wikipedia:Articles_for_deletion/Old/Open_AfDs','Old AFDs');
});