User:Woldo/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 can be added at User:Woldo/monobook.css. |
// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/* <pre>
/* <nowiki> */
// GODMODE LIGHT
document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/godmode-light.js"><\/SCRIPT>');
// Started with code taken with permision from [[User:JoanneB/monobook.js]]
/////////////////////////////////////////////////////////////////////////////////////////////
// Started with code blatently stolen from [[User:Bmicomp/monobook.js]].
// Modified to use test-n, test2-n and test3-n. Remember to put the article title in the tag.
// See [[User:Drini]] for information on the -n templates.
// Menu tabs and some other functions stolen from [[User:alphax]]
// Requires additions to monobook.css for menu tabs to work
//Sam's godmodeuber. Only works for admins.
document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/ubergodmode.js"><\/SCRIPT>');
// [[User:Lupin/popups.js]] - please include this line
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
popupFixDabs=true;
popupStructure='menus';
// Call function to load when needed.
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
window.previousLoadFunction = window.onload;
window.onload = function()
{
window.previousLoadFunction();
myLoadFuncs();
}
}
// Load custom functions.
function myLoadFuncs()
{
// Add more toolbox links
addToolBoxLinks();
// Add navbar links
addNavBarLinks()
// Edit to top of page scetion
addEditSection0();
// Load custom tabs
add_tabs();
// Add a tad to purge page cache
addPurge()
// Button to auto copyvio pages
autocopyvio();
// Automate add to AfD
autovfd();
// re-render the title and accesskeys for stuff
akeytt();
}
/**** Add generic tab ****/
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = name;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
/**** Add tab as menu ****/
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;
}
/**** Add purge tab ****/
function addPurge()
{
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-history');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(!x) return;
if(x.children) x = x.children[0];
else x = x.childNodes[0];
addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}
// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch)
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += msg;
f.wpSummary.value = summ;
f.wpWatchthis.checked = watch;
}
// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function add_del_tag(msg, summ, watch)
{
var f = document.editform, t = f.wpTextbox1;
msg += '\n';
msg += t.value;
t.value = msg;
f.wpSummary.value = summ;
f.wpWatchthis.checked = watch;
}
//************************************ Edit lead section *****************************
//From http://en.wikipedia.org/w/index.php?title=User:ABCD/monobook.js&oldid=19452182
function addEditSection0(){
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-edit');
if(!x) return;
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if(x.className == 'selected'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if(x.className == 'selected istalk'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if(x.children){
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
// Change the names of links at the top of pages.
function changeLinks()
{
if(!document.getElementById) return;
// remove the "my" bits
document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
// Change tab names
document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
}
// Add more personal links to the tollbox section.
function addToolBoxLinks()
{
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/wiki/Wikipedia:Template messages/User_talk_namespace', 'Talk templates', '');
addlilink(tb, '/wiki/Wikipedia:Template_messages', 'Templates', '');
addlilink(tb, '/wiki/WP:CSD', 'SD criteria', '');
addlilink(tb, '/wiki/Special:Log', 'Log', '');
addlilink(tb, '/wiki/Special:Log/delete', 'Delete log', '');
addlilink(tb, '/wiki/Special:Log/block', 'Block log', '');
addlilink(tb, '/wiki/Special:Ipblocklist', 'IPBlocklist', '');
addlilink(tb, '/wiki/Category:Request for Unblock', 'Unblock requests', '');
addlilink(tb, '/wiki/Category:Wikipedia spam cleanup', 'Spam cleanup', '');
}
function addNavBarLinks()
{
var navbar = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
var afdtime = new Date();
var months = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];
addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Todays AfD', '');
afdtime.setUTCDate(afdtime.getUTCDate() - 5);
addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), '5-day old AfD', '');
var username=document.getElementById("pt-userpage").textContent;
addlilink(navbar, '/w/index.php?title=User:' + username + '/Status&action=edit', 'Edit my status', '');
addlilink(navbar, '/wiki/Special:Contributions/newbies', 'Newbie Contributions', '');
addlilink(navbar, '/w/index.php?title=Special:Recentchangeslinked&target=Wikipedia:WikiProject_Seventh-day_Adventist_Church/Related_Pages&hideminor=0&days=7&limit=500', 'WP:SDA Related Changes', '');
}
/**** Make old AfD's appear or disappear ****/
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";
// needed to shrink the page - rendering bug
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 = "";
// might as well put it back...
document.getElementById('footer').style.display = '';
}
// Add test-n templates to user talk pages
function testn(number)
{
var page = prompt("Vandalism to which article?")
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:User:MyNameIsNotBob/test" + number + "-n|" + page + "}} ~~~~";
f.wpSummary.value = "Your edits to [[" + page + "]]"
document.editform.wpWatchthis.checked = false;
}
// Add welcome template user talk page
function welcome()
{
var username = prompt("Welcoming which user?")
var page = prompt("Contributions to which article?")
var f = document.editform, t = f.wpTextbox1;
t.value += "{{subst:User:MyNameIsNotBob/Welcome|" + page + "|-- ~~~~}}";
// {{subst:User:MyNameIsNotBob/Welcome|<article>|~~~~}}
f.wpSummary.value = username + ", Welcome to Wikipedia!"
document.editform.wpWatchthis.checked = true
}
// adds various tabs and menu tabs
function add_tabs()
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var username=document.getElementById("pt-userpage").textContent;
// Only add for pages with "Editing User talk:" somewhere in the title
if (document.title.indexOf("Editing User talk:") != -1)
{
addlimenu(tabs, 'Talk messages', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm,'javascript:welcome()','Welcome', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Anon}} -- ~~~~", "Welcome to Wikipedia!", true, 1)','Anon', '');
addlilink(talkm, 'javascript:testn(1)', 'Test1', '');
addlilink(talkm,'javascript:testn(2)','Test2', '');
addlilink(talkm,'javascript:testn("2a")','Test2a', '');
addlilink(talkm,'javascript:testn(3)','Test3', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test4}} -- ~~~~", "Last warning", false, 1)','Test4', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Test5-n|24 hours|~~~~}}", "You have been blocked", false, 1)','Test5', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:s/block1||24 hours|reason=vandalism|signature=~~~~}}", "You have been blocked", false, 1)','S/block', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:bv}} -- ~~~~", "Vandalism", false, 1)','BV', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Vanity|}} -- ~~~~", "About the page you created", false, 1)','Vanity', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam1}} -- ~~~~", "Adding links to Wikipedia", false, 1)','Spam1', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam2}} -- ~~~~", "Spamming", false, 1)','Spam2', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam3}} -- ~~~~", "Last warning for spamming", false, 1)','Spam3', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam4}} -- ~~~~", "You have been blocked for spamming", false, 1)','Spam4', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:rvfd|}} -- ~~~~", "{{rvfd}}", false, 1)','rvfd', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:blanking}} -- ~~~~", "Blanking pages", false, 1)','blanking', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:nothanks|}} -- ~~~~", "About your edits", false, 1)','nothanks', '');
addlilink(talkm,'javascript:edit_summary_watch("{{nothanks-sd|pg=page name|url=url of source}} -- ~~~~", "{{nothanks-sd}}", false, 1)','nothanks-sd', '');
}
if(document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1){ // AfD tabs
addlimenu(tabs, 'AfD close actions', 'afda');
var afda = document.getElementById('afda').getElementsByTagName('ul')[0];
addlilink(afda, 'javascript:closevfd("Delete", "")', 'Delete', '');
addlilink(afda, 'javascript:closevfd("Speedy Delete", "")', 'SD', '');
addlilink(afda, 'javascript:closevfd("Keep", "")', 'Keep', '');
addlilink(afda, 'javascript:closevfd("Keep (No consensus)", "")', 'Keep, NC', '');
addlilink(afda, 'javascript:closevfd("Merge and Redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'M&R', '');
addlilink(afda, 'javascript:closevfd("Redirect", " to [[" + prompt("Redirect to?") + "]]")', 'Redirect', '');
addlilink(afda, 'javascript:closevfd("Ttranswiki", " to " + prompt("Transwiki to?"))', 'Transwiki', '');
addlilink(afda, 'javascript:closevfd("Transwiki", " to Wiktionary")', 'WIKT', '');
addlilink(afda, 'javascript:closevfd(prompt("Result?"), "")', 'Other', '');
}
if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){ //Add show/hide closed AfDs
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'];
}
if (document.title.indexOf("Editing User:" + username + "/Status") == 0){
addlimenu(tabs, 'Change my status', 'mystatus');
var mystatus = document.getElementById('mystatus').getElementsByTagName('ul')[0];
addlilink(mystatus, 'javascript:edit_status("in")', 'In', '');
addlilink(mystatus, 'javascript:edit_status("out")', 'Out', '');
addlilink(mystatus, 'javascript:edit_status("around")', 'Around', '');
}
if (document.title.indexOf("Editing") != 0)
{
}
}
function closevfd(bold, notbold){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value = "{{subst:at}} '''" + bold + "'''" + notbold + ". --~~~~\n" + txt.value + "\n{{subst:ab}}\n";
form.wpSummary.value = "Close discussion: " + bold + notbold;
form.wpWatchthis.checked = false;
}
///////////////////////////////////////////////////////////////////
// AutoVFD by Korath
// This needs to change depending on skin used.
//////////////////////////////////////////////////////////////////
function add_link2(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 vfd()
{
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=vfdsub&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=vfdlist&faketarget=' + pagename,
'VfdLog ' + unescape(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 += '{{' + 'subst:afd3|pg=' + target + '}}\n';
document.editform.wpSummary.value = '[[Wikipedia:Articles for deletion/' + target + ']]';
}
else if (action == 'vfdsub')
{
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 vfd at the default location already.\n\n" +
'Please either move it out of the way (and update existing links to it), or file the Vfd by hand in another location (such as [[' + target + ' (2)]]).');
}
else
document.editform.wpTextbox1.value += '{' + '{' + 'subst:afd2|pg=' + target + '|text=' + '}' + '}' +
'-- ~' + '~' + '~' + '~\n' +
'\n*\'\'\' \'\'\'\n*\'\'\' \'\'\'\n*\'\'\' \'\'\'\n';
}
else
add_link2('javascript:vfd()', 'Afd');
}
}
///////////////////////////////////////////////////////////////////
// AutoCopyvio - Created by bmicomp from modified autovfd
//////////////////////////////////////////////////////////////////
function add_link2(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 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 + '&action=edit&fakeaction=copyviolist&faketarget=' + pagename,
'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
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 + ']]';
}
// }
else
add_link2('javascript:copyvio()', 'copyvio');
}
}
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');
// Admin tools
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
/* </nowiki> */
/* </pre> */