User:Johnleemk/monobook.js

// User:Lupin/popups.js - please include this line

mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');

// Filter changes live // User:Lupin/recent2.js - please include this line mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');

popupStructure = 'original'; popupAdminLinks = true; popupFixRedirs = true; popupFixDabs = true; popupOnlyArticleLinks = true;

// This will add an [edit top] link at the top of all pages except preview pages // by User:Pile0nades

// Add an [edit top] link to pages function editTopLink { // if this is preview page or generated page, stop if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' [edit top] ';

// insert divContainer into the DOM before the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

if(window.location.href.indexOf("&action=edit&section=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; }

$(editTopLink);

//this helps with test-n templates

function tnaddlilink(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; }

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 += "" + page + " ~" + "~" + "~" + "~"; f.wpSummary.value = "Vandalism to " + page + " - warning " + number; //this is to make sure I don't watchlist the user talk f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function testnb(number) { var timeblock = prompt("Block for how long?") var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + timeblock + ""; f.wpSummary.value = "Blocking for " + timeblock + " - warning " + number; //this is to make sure I don't watchlist the user talk f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function add_testn_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) {     tabs.appendChild(tnaddlilink('javascript:testn(1)',"t1")); tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2")); tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3")); tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4")); tabs.appendChild(tnaddlilink('javascript:testnb(5)',"t5")); } }

$(add_testn_tabs);

//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 afdaddlilink(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; }

function 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; //this is to make sure I don't watchlist the debate f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function relist { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "~" + "~" + "~" + "~"; f.wpSummary.value = "Relisting debate"; //this is to make sure I don't watchlist the debate f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function 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"; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function 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"; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function 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"; //this is to make sure I don't watchlist a redirect f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function 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"; //this is to make sure I don't watchlist a redirect f.wpWatchthis.checked = ""; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function 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; //this is to focus on the edit summary when we're all done f.wpSummary.focus; }

function add_afd_tabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) {     tabs.appendChild(afdaddlilink('javascript:result',"close")); tabs.appendChild(afdaddlilink('javascript:relist',"relist")); } if (document.title.indexOf("Editing Talk:") != -1) {     tabs.appendChild(afdaddlilink('javascript:keep',"keep")); tabs.appendChild(afdaddlilink('javascript:no_consensus',"no consensus")); tabs.appendChild(afdaddlilink('javascript:redirect',"redirect")); tabs.appendChild(afdaddlilink('javascript:merge',"merge")); tabs.appendChild(afdaddlilink('javascript:other',"other")); } }

$(add_afd_tabs);

//end AfD closing script