User:Lightdarkness/Aranda.js

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

/**** INCLUDES ****/ 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"); inc("User:Lightdarkness/aiv.js");

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

// - // Modify the page once it is loaded // - if (window.addEventListener) { window.addEventListener("load", load, false); } else if (window.attachEvent) { window.attachEvent("onload", load); }

function newbar{ //we only wanna show the newbar if we're editing images if (document.title.indexOf("Editing Image:") != -1) {   topaz.wputil.addsidepanel("tz-catsort", "Category Sorting"); topaz.wputil.addsidepanelbutton("tz-catsort", " -> ",     'javascript:seteditsummary("Category sorting,  ( to )")'  ); topaz.wputil.addsidepanelbutton("tz-catsort", " -> ",     'javascript:seteditsummary("Category sorting,  ( to )")'  ); topaz.wputil.addsidepanelbutton("tz-catsort", " -> ",     'javascript:seteditsummary("Category sorting,  ( to )")'  ); } }

function AddWarningButtons{ if (document.title.indexOf("User talk:") != -1) {     topaz.wputil.addsidepanel("tz-warnings", "Warn User"); topaz.wputil.addsidepanelbutton("tz-warnings", "Expand Warnings", 'javascript:expandwarnings'); } } function AddCSDButtons{ topaz.wputil.addsidepanel("tz-csd", "CSD Tags"); topaz.wputil.addsidepanelbutton("tz-csd", "Expand CSD's", 'javascript:AddCSDButtons1'); } function AddCSDButtons1{ topaz.wputil.addsidepanelbutton("tz-csd", "", 'javascript:CSDPage("db-attack")'); topaz.wputil.addsidepanelbutton("tz-csd", "", 'javascript:CSDPage("db-bio")'); topaz.wputil.addsidepanelbutton("tz-csd", "", 'javascript:CSDPage("db-empty")'); topaz.wputil.addsidepanelbutton("tz-csd", "", 'javascript:CSDPage("db-nonsense")'); topaz.wputil.addsidepanelbutton("tz-csd", "", 'javascript:CSDPage("db-repost")'); }

function expandwarnings{ topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("bv")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("test1")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("test2")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("test3")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("test4")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("test4im")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("blank2")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("blank3")'); topaz.wputil.addsidepanelbutton("tz-warnings", "", 'javascript:WarnUser("blank4")'); }

function load{ addPurge; addContrib; addMyLinks; addTools; newbar; AddWarningButtons; //add link to delete log myArray = document.title.split(/ - /); var page = myArray[0]; myregexp = new RegExp(" "); pageName = page.replace(myregexp, "_"); var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0]; var username = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML; } addlilink(toolbox, '/w/index.php?title=Special%3ALog&type=delete&page=' + pageName + '', 'Deletion log', 'ca-dl');

if (document.title.indexOf("Wikipedia:Articles for deletion") != -1) {   var divs = document.getElementsByTagName("div"); for(var x = 7; x < divs.length; ++x) if(divs[x].className.indexOf("editsection") != -1) { var url = divs[x].getElementsByTagName('a')[0].href; divs[x].innerHTML += '[vote]'; } }  if (location.href.indexOf("&fakeaction=vote") != -1){ afdvote; } }

/* */