User:Mo0/monobook.js
< User:Mo0
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:Mo0/monobook.css. |
// Big thanks to User:JesseW for leading me to:
// [[Wikipedia:WikiProject_User_scripts/Techniques#Onload_Structure]]
// and to User:Sasquatch for the if(document.get ... code
//
// Working version done: Nov 2 2005 @ 7:44 PM EST
// Shortens edit, protect, talk and delete tabs
//
// References:
// http://en.wikipedia.org/wiki/MediaWiki:Monobook.js
// User:JesseW/monobook.js --- User:Drini/monobook.js
// Mo0 just basically stole this version from User:RoyBoy's monobook.
// <pre><nowiki>
document.write('<SCRIPT SRC="http://sam.zoy.org/wikipedia/godmode-light.js"><\/SCRIPT>');
//////////////////////////////////////////
// Tabs by Korath
// returns <li><a href="url">name</a></li>
/////////////////////////////////////////
function addlilink(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
return li;
}
// 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;
}
function test()
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "test" + "}} -" + " " + "~" + "~" + "~" + "~";
f.wpSummary.value = "test warning";
}
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:" + "test" + number + "-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";
if (t.value > 2)
f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
else
f.wpSummary.value = "Please stop vandalising [[" + page + "]]";
}
function blankwarn(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:" + "test2a-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";
f.wpSummary.value = "Please stop blanking [[" + page + "]]";
}
function bvn(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:" + "bv-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";
f.wpSummary.value = "bv [[" + page + "]]";
}
// adds various tabs to call the above
function add_tabs()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// Only add for pages with "Editing User talk:" somewhere in the title
if (document.title.indexOf("Editing User talk:") != -1)
{
//change "move" tab to "m" for more room
if(document.getElementById('ca-move'))
document.getElementById('ca-move').firstChild.innerHTML = 'm';
if(document.getElementById('ca-history'))
document.getElementById('ca-history').firstChild.innerHTML = 'h';
//change "user page" tab to "anon" to put them in their place, HA!
if(document.getElementById('ca-nstab-user'))
document.getElementById('ca-nstab-user').firstChild.innerHTML = 'anon';
//tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:anon}} -" + " " + "~" + "~" + "~" + "~", "{{" + "anon}}", false, 0)',"Anon"));
//tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:welcome}} -" + " " + "~" + "~" + "~" + "~", "Welcome!", false, 0)',"Welcome!"));
tabs.appendChild(addlilink('javascript:test()',"1"));
tabs.appendChild(addlilink('javascript:testn(2)',"t2"));
tabs.appendChild(addlilink('javascript:blankwarn(2)',"2a"));
tabs.appendChild(addlilink('javascript:testn(3)',"t3"));
tabs.appendChild(addlilink('javascript:testn(4)',"t4"));
tabs.appendChild(addlilink('javascript:bvn(1)',"bv"));
tabs.appendChild(addlilink('javascript:edit_summary_watch(":{{" + "subst:test5}} -" + " " + "~" + "~" + "~" + "~", "Blocked user!", true, 1)',"5"));
}
if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1)
{
tabs.appendChild(addlilink('javascript:closeafd("keep", "")', 'Keep', ''));
tabs.appendChild(addlilink('javascript:closeafd("delete", "")', 'Delete', ''));
tabs.appendChild(addlilink('javascript:closeafd(prompt("Result?"), "")', 'Other', ''));
}
}
function addEditSection0() {
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if (!document.getElementById) return;
x = document.getElementById('ca-edit');
if(!x) return;
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';
}
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);
}
}
function shortTabs() {
if(document.getElementById('ca-edit'))
document.getElementById('ca-edit').firstChild.innerHTML = 'edit';
if(document.getElementById('ca-protect'))
document.getElementById('ca-protect').firstChild.innerHTML = 'pro';
if(document.getElementById('ca-talk'))
document.getElementById('ca-talk').firstChild.innerHTML = 'talk';
if(document.getElementById('ca-delete'))
document.getElementById('ca-delete').firstChild.innerHTML = 'del';
if(document.getElementById('ca-unwatch'))
document.getElementById('ca-unwatch').firstChild.innerHTML = 'unw';
if(document.getElementById('ca-watch'))
document.getElementById('ca-watch').firstChild.innerHTML = 'w';
}
// ***** Window Load ******
window.onload = Main;
function Main()
{
shortTabs();
add_tabs();
if (document.title.indexOf("Editing User talk:") = -1)
addEditSection0();
}
// </nowiki></pre>
// [[User:Lupin/popups.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');