User:Haha J. Wales/monobook.js

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //   |——————————————————————————————————————————————————————————————————————————————————————————————————————|    // //    |-| I feel I am a fairly good JavaScript programming, so feel free to ask me questions about any     |-|    // //   |-| scripts on this page. I've gotten the majority of my scripts from WP:US/S, if you want code, |-|   // //   |-| then go there. |-|   // //    |——————————————————————————————————————————————————————————————————————————————————————————————————————|    // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// importScript('User:Animum/reset.js'); importScript('User:DerHexer/rollback.js'); importScript('User:^demon/csd.js'); importScript("User:Lupin/recent2.js"); // User:Lupin/popups.js popupHideDelay=0.1; popupDelay=1; popupAdminLinks=true; popupsFixDabs=true; importScript('User:Lupin/popups.js');

importScript('User:AzaToth/twinkle.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/MotD closure script'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:Animum/count.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Fix lowercase first letter problem'); //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 //MfD compatibility function automfd_result { var result = prompt("What was the result"); var f = document.editform, t = wpTextbox1; t.value = "" + " " + result + "." + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; t.value += '\n' + ""; f.wpSummary.value = "Closing debate; result was " + result; f.wpMinoredit.checked = false; } //End MfD compatibility function autoafd_result { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0'); t.value = "{{subst:" + "at" + "}} " + close + ". " + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "ab" + "}}"; 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 += "{{subst:" + "relist" + "|~" + "~" + "~}}"; 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 = "{{subst:" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\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 = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=no consensus|votepage=" + votepage + "}}" + '\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 = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=redirect to " + redirect + "|votepage=" + votepage + "}}" + '\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 = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=merge and redirect to " + redirect + "|votepage=" + votepage + "}}" + '\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 = "{{subst:" + "oldafdfull" + "|date=" + date + "|result=" + result + "|votepage=" + votepage + "}}" + '\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) {     mw.util.addPortletLink('p-cactions', 'javascript:autoafd_result', "close"); mw.util.addPortletLink('p-cactions', 'javascript:autoafd_relist', "relist"); } if( document.title.indexOf( "Editing Wikipedia:Miscellany for deletion/" ) != -1 ) {     mw.util.addPortletLink('p-cactions', 'javascript:automfd_result', "close"); } if (document.title.indexOf("Editing Talk:") != -1) {     mw.util.addPortletLink('p-cactions', 'javascript:autoafd_keep', "keep"); mw.util.addPortletLink('p-cactions', 'javascript:autoafd_no_consensus', "no consensus"); mw.util.addPortletLink('p-cactions', 'javascript:autoafd_redirect', "redirect"); mw.util.addPortletLink('p-cactions', 'javascript:autoafd_merge', "merge"); mw.util.addPortletLink('p-cactions', 'javascript:autoafd_other', "other"); } } addOnloadHook(autoafd_add_afd_tabs); //end AfD closing script function addLink(where, url, name, id, title, key, after) { // addLink accepts either an id or a DOM node, mw.util.addPortletLink only takes a node if (after && !after.cloneNode) after = document.getElementById(after); return mw.util.addPortletLink(where, url, name, id, title, key, after); } //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); } importScript('User:Animum/headers.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/warn.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add toolbox link'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add tab'); // // STATUS CHANGER addOnloadHook(function { var subpage = "/Status";  var scheme = "/StatusTemplate";  var subpagelink = wgServer + "/w/index.php?title=User:" + encodeURIComponent(wgUserName + subpage);  var logout = document.getElementById( 'pt-logout' );  //Add the links  mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "", logout);  mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "", logout);  mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "", logout);  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?  //Get new status  var statusRegExp = /&action=edit&newstatus=(.*)/;  var status = statusRegExp.exec(location.href)[1];  //Modify the form  document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}"; document.getElementById('wpSummary').value = "Status: "+status; document.getElementById('wpMinoredit').checked = 'checked'; //Submit it! document.getElementById('editform').submit; }); // importScript('User:Steel359/^demon.js'); function MainPageReadonly {   if( wgTitle == "Main Page" && wgAction=="edit" && document.getElementById("newarticletext") ) {      if( userIsInGroup( 'sysop' ) ) {        var noeditform = document.getElementById("editform");        noeditform.style.display="none";        var protwarning = document.getElementById("protectedpagewarning");        protwarning.style.display="none"; }      var replaceContent = document.getElementById("bodyContent");      replaceContent.innerHTML="  " + "ERROR: The main page is currently unavailable. However, you are welcome to edit any other article we have." + " ";        if( userIsInGroup( 'sysop' ) ) { replaceContent.innerHTML += "" + wgUserName + ", undelete this page."; } } } addOnloadHook(MainPageReadonly); function makeDocLink { if( wgCanonicalNamespace == "Template" && document.getElementById("doc_editlinks") ) { var editsection = document.getElementById("doc_editlinks"); editsection.innerHTML = '[view]' + " " + '[edit]'; } } addOnloadHook(makeDocLink); importScript('User:Voice of All/addtabs/monobook.js'); function addPurgeLinkToToolbox { addToolboxLink('http://en.wikipedia.org/w/index.php?title=' + wgPageName + '&action=purge', "Purge this page", , , '', "Purge the cache for this page."); } addOnloadHook(addPurgeLinkToToolbox); function tagArticle { var template = prompt("What tag to place?"); document.editform.wpTextbox1.value = "\{\{" + template + "\}\}\n" + document.editform.wpTextbox1.value; document.editform.wpSummary.value = "\+\{\{" + template.toLowerCase + "\}\}"; document.editform.wpMinoredit.checked = true; document.editform.wpSave.click; } function addTagLink { if( (wgNamespaceNumber != -1) && wgAction == "edit") { addToolboxLink('javascript:tagArticle', "Tag page", , , '', "Tag this page with a template"); } } addOnloadHook(addTagLink);

function addSubpageLink { var subpagename = wgPageName.split( '/' )[1]; if( wgNamespaceNumber != 0 && !subpagename ) { addToolboxLink(mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=Special:Prefixindex/" + wgPageName + "/", "Subpages", , , '', 'View the subpages of this page'); } } addOnloadHook(addSubpageLink);

function addRightsLink { var subpagename = wgPageName.split( '/' )[1]; if( ( wgNamespaceNumber == "3" || wgNamespaceNumber == "2" ) && !subpagename ) { addToolboxLink("http://en.wikipedia.org/w/index.php?title=Special%3AListusers&username=" + wgTitle + "&group=&limit=1", "User\'s rights", , , "View the access roles to which this user has access"); } }

addOnloadHook(addRightsLink); addOnloadHook(function {   var subpagename = wgPageName.split( '/' )[1];    if( ( wgNamespaceNumber == "3" || wgNamespaceNumber == "2" ) && !subpagename ) {    addToolboxLink("http://en.wikipedia.org/w/index.php?title=Special:DeletedContributions&target=" + wgTitle, 'Deleted Contributions', 'Foo2', 'Foo3', 'Foo4'); } });

function welcomeACC { f = document.editform, t = f.wpTextbox1; t.value += "== " + "Welcome!" +" ==\n" + "{{subst:" + "User:WODUP/Welcome after creating a requested account}} \~\~\~\~"; f.wpMinoredit.checked = true; f.wpSummary.value = "Welcome to Wikipedia!"; f.submit; }

addOnloadHook(function { if(wgCanonicalNamespace == "User_talk" && wgAction == "edit" && document.title.indexOf("\(section\)") == -1) {    mw.util.addPortletLink('p-cactions', 'javascript:welcomeACC', 'welcome new acc', , ); } });

//