User:Kingboyk/monobook.js

// // addLink helper function function addLink(where, url, name, id, title, key, after){ //* where is the id of the toolbar where the button should be added; //  i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb". //   //* url is the URL which will be called when the button is clicked. //  javascript: urls can be used to do more complex things. //   //* name is what will appear as the name of the button. //   //* id is the id of the button; it's best to define one. //  Use a prefix to make sure its unique. Optional. //   //* title is the tooltip title that gives a longer description //  of the button; if you define a accesskey, mention it here. Optional. //   //* key is the char you want for the accesskey. Optional. //   //* after is the id of the button you want to follow this one. Optional. //   var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); }   if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} }   // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

// addlilink helper function function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) {       if(key && title) {           ta[id] = [key, title]; }       else if(key) {           ta[id] = [key, '']; }       else if(title) {           ta[id] = ['', title]; }   }    // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

// WikiProject User scripts/Scripts/CloseAFD.js //this helps automate AfD closing by adding a 'close' tab to AfD debates //written by User:Johnleemk based on WikiProject User scripts/Scripts/test-n.js by User:Celestianpower

function autoafd_result { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = " " + close + ". " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += ""; f.wpSummary.value = "Closing debate; result was " + close; }

function autoafd_relist { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "~" + "~" + "~" + "~"; f.wpSummary.value = "Relisting debate"; }

function autoafd_keep { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD"; }

function autoafd_no_consensus { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD with no consensus"; }

function autoafd_redirect { var date = prompt("Nomination was made when?") var redirect = prompt("Redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article redirected to " + redirect + " as per AfD"; }

function autoafd_merge { var date = prompt("Nomination was made when?") var redirect = prompt("Merge and redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article merged and redirected to " + redirect + " as per AfD"; }

function autoafd_other { var date = prompt("Nomination was made when?") var result = prompt("Result was?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "AfDed; result was " + result; }

function autoafd_add_afd_tabs { // Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) {     addLink('p-cactions', 'javascript:autoafd_result', "close"); addLink('p-cactions', 'javascript:autoafd_relist', "relist"); } if (document.title.indexOf("Editing Talk:") != -1) {     addLink('p-cactions', 'javascript:autoafd_keep', "keep"); addLink('p-cactions', 'javascript:autoafd_no_consensus', "no consensus"); addLink('p-cactions', 'javascript:autoafd_redirect', "redirect"); addLink('p-cactions', 'javascript:autoafd_merge', "merge"); addLink('p-cactions', 'javascript:autoafd_other', "other"); } }

addOnloadHook(autoafd_add_afd_tabs);

// WikiProject User scripts/Scripts/Logs link // adds a 'logs for this page' link to the navigation bar // if the page is a user's page, talk page or subpage, the link will go to logs for the user instead // if the page is a special page, then no link is displayed

addOnloadHook(function {

// get page title var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/; ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' '); // if this is a user, show the logs for the user rather than the page if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) { regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/; user = regDropSubpages.exec(ptitle)[1]; url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user; } else if(window.location.href.indexOf("Special:") != -1) { // don't display link for special pages return; } else { url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle; } tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0]; l = addlilink(tabs, url, "Logs", "pt-logs");

});

/**** afd helper ****/ document.write(' ');

/* This is to keep track of who is using this extension: User:Jnothman/afd_helper/script.js */

//afdh_summaryprompt = false;

// User:Cryptic/toggleundelete.js // to 'select all' in history restore function toggle_undelete { var f = document.getElementById("undelete"); if (f) {     var inputs = f.getElementsByTagName("input"); var i;     for (i = 0; i < inputs.length; ++i) if (inputs[i].type == "checkbox") inputs[i].checked = !inputs[i].checked; } }

function setup_toggle_undelete { if (document.title == "View and restore deleted pages") {     var f = document.getElementById("undelete"); if (f) {         var h2 = f.getElementsByTagName("h2")[0]; if (h2) {             var button = document.createElement('input'); button.type = "button"; button.value = "Invert"; button.setAttribute('onClick', 'toggle_undelete'); f.insertBefore(button, h2); }       }    } }

addOnloadHook(setup_toggle_undelete);

// edit counter document.write(' ');

// History tools /* document.write(' '); */

// User:Lupin/popups.js

document.write(' ');

popupFixDabs=true; //

// add "delete" link to page moves: function addDeleteLink { var targetSpan = document.getElementById('specialDeleteTarget'); var linkSpan = document.getElementById('specialDeleteLink'); if (targetSpan == null || linkSpan == null) return;

var targetLink = targetSpan.getElementsByTagName("A")[0]; if (targetLink == null) return;

var targetTitle = targetLink.childNodes[0].data;

var deleteHref = "http://en.wikipedia.org/w/index.php?action=delete&title=" + escape(targetTitle);

var deleteSpan = null; with (easyDom) { deleteSpan = span({ "class": "plainlinks" }, " (", a({ "href": deleteHref, "class": "external text" }, "delete"), ")"); }

linkSpan.appendChild(deleteSpan); } addOnloadHook(addDeleteLink);

document.write(' ');

// User:Outriggr/metadatatest.js importScript('User:Outriggr/metadatatest.js'); assessmentMyProjects = ["WPBiography"];

// CSD AutoReason document.write(' ');