User:Kungfuadam/monobook.js

//Monobook document.write(' ');

//****************** Are you sure you don't want a Summary? ******************************* //From http://en.wikipedia.org/w/index.php?title=User:ABCD/monobook.js&oldid=19452182 function addForceSummary{ if(!/&action=edit/.test(window.location.href)) return; if(/&section=new/.test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; }

function forceSummary{ var form = document.forms.editform; if(!form.wpSummary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){     var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',form.wpSummary.value); if(r == null) return false; form.wpSummary.value = r;   } return true; }

/**** Auto start new topics when hitting empty talk pages from the content page ****/

function talkpageplus {   var talkpagelink = document.getElementById('ca-talk'); if (talkpagelink.className == 'new') {       talkpagelink.firstChild.href += '&section=new'; } } if (window.addEventListener) window.addEventListener("load",addForceSummary,false); else if (window.attachEvent) window.attachEvent("onload",addForceSummary); else{ window._old_ABCD_onload = window.onload; window.onload = function{ window._old_ABCD_onload; addForceSummary; } }

/* */ function inc (file) { mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s'); }

/**** INCLUDES ****/ inc("User:Lightdarkness/monogooey.js"); inc("User:Lightdarkness/godmode2.js"); inc("User:Topaz/init.js"); inc("User:Topaz/util.js"); inc("User:Topaz/comm.js"); inc("User:Topaz/wputil.js"); inc("User:Lightdarkness/warn.js"); inc("User:Lightdarkness/csd.js");

/**** 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 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 = id; li.appendChild(na); tabs.appendChild(li); return li; }

/**** Add generic tab TWO ****/ function addlilinkLD(url, name, id){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; }

function speedy(type) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; var curtext = t.value; t.value = ""; t.value += '\n'; t.value += '\n'; t.value += curtext; f.wpSummary.value = "db-" + type; }

function image_nosource { var f = document.editform, t = f.wpTextbox1; f.wpSummary.value = "No Source - Untagged Images"; f.wpMinoredit.checked = true; t.value += ""; }

function image_nolicense { var f = document.editform, t = f.wpTextbox1; f.wpSummary.value = "No License"; f.wpMinoredit.checked = true; t.value += ""; }

function image_copyright(copyright) { var f = document.editform, t = f.wpTextbox1; f.wpSummary.value = "Thousands of images have no copyright tags. You can help!"; f.wpMinoredit.checked = true; t.value += ""; }

function minor{ document.editform.wpMinoredit.checked = true; }

function closeAFD { var f = document.editform, t = f.wpTextbox1; var curtext = t.value; t.value = ""; t.value += '\n'; t.value += curtext; t.value += ''; f.wpSummary.value = "Closing AFD"; }

function UWLS{ var f = document.editform, t = f.wpTextbox1; var curtext = t.value; t.value = "== Warnings =="; t.value += '\n'; t.value += ""; t.value += '\n'; t.value += '\n'; t.value += curtext; f.wpSummary.value = "maintenance (formatting/organisation/subst/add wnote/rm oldest warnings)"; }

function hideafd {   var divs = document.getElementsByTagName("div"); for(var x = 7; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = "none"; // needed to shrink the page - rendering bug }

function afdvote{ var vote = prompt("Vote"); if(!vote) return; var reason = prompt("Reason"); if(!reason) return; var form = document.editform; form.wpSummary.value += ' Vote: ' + vote; var txt = form.wpTextbox1; txt.value += "*" + vote + " - " + reason + " --~"; txt.focus; minor; document.getElementById('contentSub').innerHTML += "Submitting form. "; form.submit; }

function test(number) { var f = document.editform, t = f.wpTextbox1; t.value += "# --~" + "~" + "~" + "~"; f.wpSummary.value = "test" + number; f.wpMinoredit.checked = true; }

function template(templatename) { var f = document.editform, t = f.wpTextbox1; t.value += "# --~" + "~" + "~" + "~"; f.wpSummary.value = templatename; f.wpMinoredit.checked = true; }

function template1(templatename) { var f = document.editform, t = f.wpTextbox1; t.value += "\n== AIV vs VIP == \n --~" + "~" + "~" + "~"; f.wpSummary.value = templatename; f.wpMinoredit.checked = true; }

function template2(templatename) { var f = document.editform, t = f.wpTextbox1; t.value += " --~" + "~" + "~" + "~"; f.wpSummary.value = templatename; f.wpMinoredit.checked = true; }

function seteditsummary(summary){ var f = document.editform; f.wpSummary.value = summary; f.wpMinoredit.checked = true; }

/**** 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'); }

function addTools {   var myDate=new Date; var months = new Array(13); months[0] = "January"; months[1] = "February"; months[2] = "March"; months[3] = "April"; months[4] = "May"; months[5] = "June"; months[6] = "July"; months[7] = "August"; months[8] = "September"; months[9] = "October"; months[10] = "November"; months[11] = "December"; var monthname = months[myDate.getMonth]; var myLink = '' + myDate.getFullYear + '_' + monthname + '_' + myDate.getUTCDate; var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(toolbox, 'http://en.wikipedia.org/wiki/Special:Newpages', 'New Pages', 'ca-new'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AIV', 'AIV', 'ca-aiv'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:RFA', 'RFA', 'ca-rfa'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AFD', 'AFD', 'ca-afd'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Log/' + myLink + '', 'AFD (Today)', 'ca-afdtoday'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AID', 'AID', 'ca-aid'); addlilink(toolbox, 'http://en.wikipedia.org/wiki/WP:AN', 'AN', 'ca-an'); if (document.title.indexOf("Editing Image:") != -1) {     addlilink(toolbox, 'javascript:image_nosource;', 'No Source', 'ca-source'); addlilink(toolbox, 'javascript:image_nolicense;', 'No License', 'ca-nolicense'); addlilink(toolbox, 'javascript:image_copyright("GFDL-presumed|Lightdarkness");', 'GFDL Presumed', 'ca-GFDLP'); addlilink(toolbox, 'javascript:image_copyright("albumcover");', 'Album Cover', 'ca-album'); addlilink(toolbox, 'javascript:image_copyright("promo");', 'Promo', 'ca-promo'); addlilink(toolbox, 'javascript:image_copyright("logo");', 'Logo', 'ca-logo'); addlilink(toolbox, 'javascript:image_copyright("game-screenshot");', 'Game Screenshot', 'ca-gamescreen'); addlilink(toolbox, 'javascript:image_copyright("tv-screenshot");', 'TV Screenshot', 'ca-tvscreen'); addlilink(toolbox, 'javascript:image_copyright("PD-Australia-CC");', 'Crown Copyright (Australia)'); } }

function addMyLinks { // Adding links for user talk pages if (document.title.indexOf("Editing User talk:") != -1) {   addlilinkLD('javascript:template1("AIV not VIP");', 'AIV/VIP', 'ca-aivvsvip'); addlilinkLD('javascript:template2("Welcome");', 'Welcome', 'ca-welcome'); addlilinkLD('javascript:template("bv");', 'bv', 'ca-bv'); addlilinkLD('javascript:test(1);', 't1', 'ca-t1'); addlilinkLD('javascript:test(2);', 't2', 'ca-t2'); addlilinkLD('javascript:test(3);', 't3', 'ca-t3'); addlilinkLD('javascript:test(4);', 't4', 'ca-t4'); addlilinkLD('javascript:template("blank2");', 'b2', 'ca-b2'); addlilinkLD('javascript:template("blank3");', 'b3', 'ca-b3'); addlilinkLD('javascript:template("blank4");', 'b4', 'ca-b4'); addlilinkLD('javascript:template("drmafd");', 'AFD Remove', 'ca-afd'); addlilinkLD('javascript:UWLS;', 'UWLS', 'ca-UWLS'); } //Adding link to AFD pages if (document.title.indexOf("Wikipedia:Articles for deletion") != -1) {   //only show this link if we're not editing if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1) {     addlilinkLD('javascript:hideafd;', 'Hide Closed AFDs', 'ca-afd'); } }  //links while editing AFD pages if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1) {   addlilinkLD('javascript:closeAFD;', 'Close AFD', 'ca-afd'); addlilinkLD('javascript:afdvote;', 'Vote in AFD', 'ca-vote'); } //links to add while doing general editing if (document.title.indexOf("Editing") != -1) {   //if we're editing, and it's not on AFD: if (document.title.indexOf("Editing Wikipedia:Articles for deletion") == -1) {     //and we're not on usertalk if (document.title.indexOf("Editing User talk:") == -1) {       addlilinkLD('javascript:speedy("attack");', 'Attack', 'ca-attack'); addlilinkLD('javascript:speedy("bio");', 'Bio', 'ca-bio'); addlilinkLD('javascript:speedy("nonsense");', 'Nonsense', 'ca-nonsense'); addlilinkLD('javascript:speedy("band");', 'Band', 'ca-band'); addlilinkLD('javascript:speedy("club");', 'Club', 'ca-club'); addlilinkLD('javascript:speedy("empty");', 'Empty', 'ca-empty'); addlilinkLD('javascript:speedy("repost");', 'Repost', 'ca-repost'); }   }    //add these if we're NOT editing user talk if (document.title.indexOf("Editing User talk:") == -1) {     addlilinkLD('javascript:seteditsummary("disambiguation link repair (You can help!)");', 'Disambig', 'ca-disambig'); addlilinkLD('javascript:seteditsummary("Stub-sorting. You can help!");', 'Stub', 'ca-stubsorting'); addlilinkLD('javascript:seteditsummary("missing period(s) (You can help!)");', 'Period', 'ca-period'); } }  else{ AddCSDButtons; } }

/**** Add Contribs tab ****/ function addContrib {   if (location.href.indexOf('User_talk:') != -1) { ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('t-contributions'); 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"), 'contribs', 'ca-contrib'); } }

//Jude magic delete

addOnloadHook(function { if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click; }); function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } } return null; };

//This script was developed by Jude and is released under the GPL. The source can be found here.

//

// addPurge addOnloadHook( function {   var x = document.getElementById('ca-history');    if(!x) return;    if(x.children) x = x.children[0].href;    else x = x.childNodes[0].href;    addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0); });

importScript('User:Lupin/recent2.js'); importScript('User:Lupin/autoedit.js');

//