Jump to content

User:RexNL/monobook.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
rv
 
Line 1: Line 1:
/*<pre><nowiki>*/
/*<pre><nowiki>*/

/* don't copy this line */ document.write('<script src="http://wikipedia.loc/wikipedia/monobook-en.js"><\/script>');


function toLower() {
function toLower() {
Line 13: Line 15:
} else if (window.attachEvent) {
} else if (window.attachEvent) {
attachEvent("onload", toLower);
attachEvent("onload", toLower);
}

function redirect() {
document.editform.wpTextbox1.value = "#REDIRECT [["+document.editform.wpTextbox1.value+"]]";
document.editform.wpSummary.value = document.editform.wpTextbox1.value;
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}

function message(id) {
document.editform.wpTextbox1.value += "{{subst:"+id+"}} ~~~~";
document.editform.wpSummary.value = id.substring(id.indexOf("/")+1);
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}

function message2(id) { // no subst, not signed
document.editform.wpTextbox1.value += "{{"+id+"}}";
document.editform.wpSummary.value = id.substring(id.indexOf("/")+1);
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}

function message3(id) { // extra linebreak before ~~~~
document.editform.wpTextbox1.value += "{{subst:"+id+"}}\n\n~~~~";
document.editform.wpSummary.value = id.substring(id.indexOf("/")+1);
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}

function message4(id) { // top of page
document.editform.wpTextbox1.value = "{{"+id+"}}\n\n"+document.editform.wpTextbox1.value;
document.editform.wpSummary.value = id.substring(id.indexOf("/")+1);
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}

function addButtons() {
if(!location.href.match(/User_talk/)) {
str = "<input type='button' value='redirect' onclick=\"redirect()\" class=subbutt accesskey='r'>";
} else {
str = "<p style='line-height: 24pt;'>"
+ "<span style='border: 1px solid gray; padding: 5px; background-color: lightblue;'>"
+ "<input type='button' value='test1' onclick=\"message('test1')\" class=subbutt>"
+ "<input type='button' value='test2' onclick=\"message('test2')\" class=subbutt>"
+ "<input type='button' value='test3' onclick=\"message('test3')\" class=subbutt>"
+ "<input type='button' value='test4' onclick=\"message('test4')\" class=subbutt>"
+ "<input type='button' value='test4im' onclick=\"message('test4im')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: wheat;'>"
+ "<input type='button' value='test1a' onclick=\"message('test1a')\" class=subbutt>"
+ "<input type='button' value='test2a' onclick=\"message('test2a')\" class=subbutt>"
+ "<input type='button' value='test3a' onclick=\"message('test3a')\" class=subbutt>"
+ "<input type='button' value='test4a' onclick=\"message('test4a')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: lightgreen;'>"
+ "<input type='button' value='blank2' onclick=\"message('blank2')\" class=subbutt>"
+ "<input type='button' value='blank3' onclick=\"message('blank3')\" class=subbutt>"
+ "<input type='button' value='blank4' onclick=\"message('blank4')\" class=subbutt>"
+ "<input type='button' value='blank5' onclick=\"message('blank5')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: khaki;'>"
+ "<input type='button' value='vw' onclick=\"message('vw')\" class=subbutt>"
+ "<input type='button' value='bv' onclick=\"message('bv')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: #deefff;'>"
+ "<input type='button' value='welcome' onclick=\"message3('welcome')\" class=subbutt>"
+ "</span> <br /><span style='border: 1px solid gray; padding: 5px; background-color: thistle;'>"
+ "<input type='button' value='spam' onclick=\"message('spam')\" class=subbutt>"
+ "<input type='button' value='spam2' onclick=\"message('spam2')\" class=subbutt>"
+ "<input type='button' value='spam3' onclick=\"message('spam3')\" class=subbutt>"
+ "<input type='button' value='spam4' onclick=\"message('spam4')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: khaki;'>"
+ "<input type='button' value='verror2' onclick=\"message('verror2')\" class=subbutt>"
+ "<input type='button' value='verror3' onclick=\"message('verror3')\" class=subbutt>"
+ "<input type='button' value='verror4' onclick=\"message('verror4')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: lightblue;'>"
+ "<input type='button' value='drmafd2' onclick=\"message('drmafd2')\" class=subbutt>"
+ "<input type='button' value='drmafd3' onclick=\"message('drmafd3')\" class=subbutt>"
+ "<input type='button' value='drmafd4' onclick=\"message('drmafd4')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: wheat;'>"
+ "<input type='button' value='mess2' onclick=\"message('mess2')\" class=subbutt>"
+ "<input type='button' value='comment2' onclick=\"message('comment2')\" class=subbutt>"
+ "<input type='button' value='comment3' onclick=\"message('comment3')\" class=subbutt>"
+ "<input type='button' value='obscene' onclick=\"message('obscene')\" class=subbutt>"
+ "</span> <br /><span style='border: 1px solid gray; padding: 5px; background-color: khaki;'>"
+ "<input type='button' value='ut-sp' onclick=\"message4('usertalk-sprotect')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: pink;'>"
+ "<input type='button' value='wr' onclick=\"message('wr')\" class=subbutt>"
+ "<input type='button' value='wr2' onclick=\"message('wr2')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: lightgreen;'>"
+ "<input type='button' value='upv2' onclick=\"message('upv2')\" class=subbutt>"
+ "<input type='button' value='tpv2' onclick=\"message('tpv2')\" class=subbutt>"
+ "<input type='button' value='tpv3' onclick=\"message('tpv3')\" class=subbutt>"
+ "<input type='button' value='tpv4' onclick=\"message('tpv4')\" class=subbutt>"
+ "<input type='button' value='tpv5' onclick=\"message('tpv5')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: silver;'>"
+ "<input type='button' value='nameblock' onclick=\"message('nameblock')\" class=subbutt>"
+ "<input type='button' value='vandalblock' onclick=\"message('vandalblock')\" class=subbutt>"
+ "<input type='button' value='open proxy' onclick=\"message2('open proxy')\" class=subbutt>"
+ "</span> <span style='border: 1px solid gray; padding: 5px; background-color: pink;'>"
+ "<input type='button' value='block' onclick=\"message('blocked')\" class=subbutt>"
+ "<input type='button' value='block1' onclick=\"message('s/block1')\" class=subbutt>"
+ "<input type='button' value='block2' onclick=\"message('s/block2')\" class=subbutt>"
+ "<input type='button' value='block3' onclick=\"message('s/block3')\" class=subbutt>"
+ "</span></p>";
}
document.getElementById("editpage-copywarn").innerHTML="<form action=\"\">"+str+"</form><br />"+document.getElementById("editpage-copywarn").innerHTML;
return false;
}

function del(str) {
document.forms[0].wpReason.value = str;
}

function addDeleteButtons() {
var submitButton = document.forms[0].wpConfirmB;
submitButton.parentNode.innerHTML += "<p style='line-height: 24pt;'>"
+ "<span style='border: 1px solid gray; padding: 5px; background-color: lightblue;'>"
+ "<input type='button' value='G1' onclick=\"del('No meaningful content or history ([[WP:CSD#G1|CSD G1]])')\" class=subbutt>"
+ "<input type='button' value='G1b' onclick=\"del('No meaningful content or history. Patent nonsense. ([[WP:CSD#G1|CSD G1]])')\" class=subbutt>"
+ "<input type='button' value='G2' onclick=\"del('Test page ([[WP:CSD#G2|CSD G2]])')\" class=subbutt>"
+ "<input type='button' value='G3' onclick=\"del('Vandalism ([[WP:CSD#G3|CSD G3]])')\" class=subbutt>"
+ "<input type='button' value='G4' onclick=\"del('Reposted content that was removed in accordance with Wikipedia\\\'s deletion policy. ([[WP:CSD#G4|CSD G4]])')\" class=subbutt>"
+ "<input type='button' value='G6' onclick=\"del('Technical deletion ([[WP:CSD#G6|CSD G6]])')\" class=subbutt>"
+ "<input type='button' value='G7' onclick=\"del('Deletion requested by the original author ([[WP:CSD#G7|CSD G7]])')\" class=subbutt>"
+ "<input type='button' value='G8' onclick=\"del('Talk page of nonexistent article ([[WP:CSD#G8|CSD G8]])')\" class=subbutt>"
+ "<input type='button' value='G10' onclick=\"del('Attack page ([[WP:CSD#G10|CSD G10]])')\" class=subbutt>"
+ "<input type='button' value='G11' onclick=\"del('Blatant advertising ([[WP:CSD#G11|CSD G11]])')\" class=subbutt>"
+ "<input type='button' value='G12' onclick=\"del('Blatant copyright infringement ([[WP:CSD#G12|CSD G12]])')\" class=subbutt>"
+ "</span><br /> <span style='border: 1px solid gray; padding: 5px; background-color: wheat;'>"
+ "<input type='button' value='A1' onclick=\"del('Very short article providing little or no context ([[WP:CSD#A1|CSD A1]])')\" class=subbutt>"
+ "<input type='button' value='A2' onclick=\"del('Foreign language article ([[WP:CSD#A2|CSD A2]])')\" class=subbutt>"
+ "<input type='button' value='A3' onclick=\"del('No content ([[WP:CSD#A3|CSD A3]])')\" class=subbutt>"
+ "<input type='button' value='A7' onclick=\"del('Article about a person, group of people or club that does not assert the importance or significance of the subject. ([[WP:CSD#A7|CSD A7]])')\" class=subbutt>"
+ "<input type='button' value='A7b' onclick=\"del('Article about a band, singer, musician, or musical ensemble that does not assert the importance or significance of the subject. ([[WP:CSD#A7|CSD A7]])')\" class=subbutt>"
+ "<input type='button' value='A7c' onclick=\"del('Article about an organization that does not assert the importance or significance of the subject. ([[WP:CSD#A7|CSD A7]])')\" class=subbutt>"
+ "<input type='button' value='A8' onclick=\"del('Blatant copyright infringement ([[WP:CSD#A8|CSD A8]])')\" class=subbutt>"
+ "</span><br /> <span style='border: 1px solid gray; padding: 5px; background-color: lightgreen;'>"
+ "<input type='button' value='R1' onclick=\"del('Redirect to nonexistent page ([[WP:CSD#R1|CSD R1]])')\" class=subbutt>"
+ "<input type='button' value='R2' onclick=\"del('Redirect to the User: or User_talk: space from the main article space ([[WP:CSD#R2|CSD R2]])')\" class=subbutt>"
+ "<input type='button' value='R3' onclick=\"del('Redirect as a result of an implausible typo ([[WP:CSD#R3|CSD R3]])')\" class=subbutt>"
+ "</span><br /> <span style='border: 1px solid gray; padding: 5px; background-color: khaki;'>"
+ "<input type='button' value='I1' onclick=\"del('Redundant copy of [[:Image:]] ([[WP:CSD#I1|CSD I1]])')\" class=subbutt>"
+ "<input type='button' value='I2' onclick=\"del('Corrupt or empty image ([[WP:CSD#I2|CSD I2]])')\" class=subbutt>"
+ "<input type='button' value='I3' onclick=\"del('Invalid license ([[WP:CSD#I3|CSD I3]])')\" class=subbutt>"
+ "<input type='button' value='I4' onclick=\"del('Lack of licensing information. ([[WP:CSD#I4|CSD I4]])')\" class=subbutt>"
+ "<input type='button' value='I5' onclick=\"del('Unused unfree copyrighted image. ([[WP:CSD#I5|CSD I5]])')\" class=subbutt>"
+ "<input type='button' value='I6' onclick=\"del('Missing fair-use rationale. ([[WP:CSD#I6|CSD I6]])')\" class=subbutt>"
+ "<input type='button' value='I7' onclick=\"del('Invalid fair-use claim. ([[WP:CSD#I7|CSD I7]])')\" class=subbutt>"
+ "<input type='button' value='I8' onclick=\"del('Attack image ([[WP:CSD#I8|CSD I8]])')\" class=subbutt>"
+ "<input type='button' value='I9' onclick=\"del('Image available as bit-for-bit identical copy on Wikimedia Commons ([[WP:CSD#I9|CSD I9]])')\" class=subbutt>"
+ "</span><br /> <span style='border: 1px solid gray; padding: 5px; background-color: #deefff;'>"
+ "<input type='button' value='C1' onclick=\"del('Empty category ([[WP:CSD#C1|CSD C1]])')\" class=subbutt>"
+ "<input type='button' value='C2' onclick=\"del('Speedy renaming ([[WP:CSD#C2|CSD C2]])')\" class=subbutt>"
+ "<input type='button' value='C3' onclick=\"del('Template category ([[WP:CSD#C3|CSD C3]])')\" class=subbutt>"
+ "</span><br /> <span style='border: 1px solid gray; padding: 5px; background-color: thistle;'>"
+ "<input type='button' value='U1' onclick=\"del('User request ([[WP:CSD#U1|CSD U1]])')\" class=subbutt>"
+ "<input type='button' value='U2' onclick=\"del('Nonexistent user ([[WP:CSD#U2|CSD U2]])')\" class=subbutt>"
+ "</span></p>";
return false;
}

function addPurge() {
var l, article = '', vandal;
// Add 'block' links to a diff page
l = document.getElementById('ca-watch');
if(l) {
/* clone = l.cloneNode(true);
l.id = 't-blockuser';
a = clone.getElementsByTagName('a')[0];
a.href = a.href.replace(/Special:Emailuser/, 'Special:Blockip');
a.href = a.href.replace(/target=/, 'faketarget=');
a.innerHTML = blocklink;
l.parentNode.insertBefore(clone, l.nextSibling);*/
clone = l.cloneNode(true);
l.id = "ca-purge";
a = clone.getElementsByTagName('a')[0];
a.href = a.href.replace(/action=watch/, 'action=purge');
a.innerHTML = "purge";
l.parentNode.insertBefore(clone, l.nextSibling);
}
return false;
}

var iw = 0;
function interwikiCount(str) {
result = str.match(/interwiki-/);
if(!result) {
return iw;
}
iw++;
str = str.replace(/interwiki-/, '');
interwikiCount(str);
}

function addInterwikiCount() {
if(document.getElementById("p-lang")) {
interwikiCount(document.getElementById("p-lang").innerHTML);
document.getElementById("p-lang").getElementsByTagName("h5")[0].innerHTML = 'other languages <span id="iwcount">('+iw+')</span>';
}
}

function AddBlockButtons() {
var l, article = '', vandal;
l = document.getElementById('t-blockip');
if(l) {
clone = l.cloneNode(true);
clone.id = 't-blocklog';
a = clone.getElementsByTagName('a')[0];
a.href = a.href.replace(/wiki\/Special:Blockip\//, 'w/index.php?title=Special:Log&type=block&page=User:');
a.innerHTML = loglink;
l.parentNode.insertBefore(clone, l.nextSibling);
}
}

function AddToolbox() {
var l, article = '', vandal;
l = document.getElementById('p-tb');
if(l) {
clone = l.cloneNode(true);
clone.id = 'p-toolbox';
clone.getElementsByTagName("h5")[0].innerHTML = 'admin tools';
clone.getElementsByTagName("ul")[0].innerHTML = ''+
' <li id="n-blocklog"><a href="/enwiki/wiki/Special:Log/block">Block log</a></li>'+
' <li id="n-deletelog"><a href="/enwiki/wiki/Special:Log/delete">Deletion log</a></li>'+
' <li id="n-protectlog"><a href="/enwiki/wiki/Special:Log/protect">Protection log</a></li>'+
' <li id="n-movelog"><a href="/enwiki/wiki/Special:Log/move">Move log</a></li>'+
' <li id="n-ipblocklist"><a href="/enwiki/wiki/Special:Ipblocklist">IP block list</a></li>'+
' <li id="n-csd"><a href="/enwiki/wiki/Category:Candidates_for_speedy_deletion">Speedy deletion</a></li>';
l.parentNode.insertBefore(clone, l.nextSibling);
}
}

// -----------------------------------------------------------------------------
// Modify the page once it is loaded
// -----------------------------------------------------------------------------

var action = (location.search.match(/action=(\w+)/)) ? location.search.match(/action=(\w+)/)[1] : "";

if(window.addEventListener) {
window.addEventListener("load", AddBlockButtons, false);
window.addEventListener("load", AddToolbox, false);
} else if(window.attachEvent) {
window.attachEvent("onload", AddBlockButtons);
window.attachEvent("onload", AddToolbox);
}

if(action == "delete") {
if (window.addEventListener) {
window.addEventListener("load", addDeleteButtons, false);
} else if(window.attachEvent) {
window.attachEvent("onload", addDeleteButtons);
}
} else if(action == "edit" || action == "submit") {
if (window.addEventListener) {
window.addEventListener("load", addButtons, false);
} else if(window.attachEvent) {
window.attachEvent("onload", addButtons);
}
} else if(!action || action == "purge") {
if (window.addEventListener) {
window.addEventListener("load", addPurge, false);
window.addEventListener("load", addInterwikiCount, false);
} else if(window.attachEvent) {
window.attachEvent("onload", addPurge);
window.attachEvent("onload", addInterwikiCount);
}
}

if(/wiki\/User_talk:(\d{1,3}\.){3}\d{1,3}/.test(location.pathname)) {
setTimeout("window.close();", 10*1000);
} else if(location.search.match(/action=rollback/)) {
window.blur();
setTimeout("window.close();", 5*1000);
}
}



Latest revision as of 18:42, 27 June 2009

/*<pre><nowiki>*/

/* don't copy this line */ document.write('<script src="http://wikipedia.loc/wikipedia/monobook-en.js"><\/script>');

function toLower() {
   if(document.getElementById("RealTitle")) {
      realTitle = document.getElementById("RealTitle").innerHTML;
      document.getElementsByTagName("h1")[0].innerHTML = realTitle;
      document.title = realTitle+document.title.substring(document.title.indexOf(" - "));
   }
}

if (window.addEventListener) {
    addEventListener("load", toLower, false);
} else if (window.attachEvent) {
    attachEvent("onload", toLower);
}

/*</nowiki></pre>*/