User:Skittleys/old-monobook.js

importScript('User:Skittleys/cactions.js'); //Original source: User:Haza-w/cactions.js

//Useful: mw.util.addPortletLink(where to add it e.g. cactions, url to link to, name, id, title/tooltip-text, key, node to add before...(e.g., document.getElementById('pt-logout'));

/******* The Imports *******/ importScript('User:Alex Smotrov/histcomb.js'); //When a user has edited a page multiple times in a row, this bundles them up into one importScript('User:Ais523/watchlistnotifier.js'); //Notifies of a change in the watchlist importScript('Wikipedia:WikiProject User scripts/Scripts/Add_purge_to_tabs'); //Adds a "purge" tab importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited'); //All changes since your last edit in a diff in "Since" tab importScript('User:Magnus_animum/count.js'); //Adds an edit count tab to each page importScript('User:Ais523/stubtagtab2.js'); // Tab to mark as stub. Gets options from Wikipedia:WikiProject Stub sorting dump //http://en.wikipedia.org/w/api.php?action=parse&prop=text&text=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWikipedia%3AWikiProject_Stub_sorting%2FStub_types%2FCommerce&format=xml  FOR when I want to edit the script further importScript('User:Cacycle/watchlistSorter.js'); // "Sorts, color-codes by namespace, Keeps a Most recent section on top. importScript('User:Omegatron/monobook.js/dashfixer.js'); // em-dash fixer importScript('User:Barticus88/WhatLinksHere.js'); //Choose namespace for "What links here" pages importScript('MediaWiki:Gadget-markblocked.js', 'ru'); //Strikes out all blocked users importScript('User:Sander Säde/quickpreview.js'); importScript('User:Henrik/js/automod.js'); //Status updates importScript('User:Ais523/bracketmatch.js'); // Bracket highlighting importScript('User:Cameltrader/Advisor.js'); //points out stylistic issues

/*******************************************/

importScript('User:AndyZ/peerreviewer.js'); //User:AndyZ/peerreviewer.js

/****** Add WikiProject Banners *********/

// User:Outriggr/metadatatest.js importScript('User:Outriggr/metadatatest.js'); assessmentMyTemplateCode = ["", "", "", "", "", "", "", "", "", "", ""]; assessmentDefaultProject = "TemplateA"; //

/******** Floating sidebar ********/ /* DISABLED // Originally at http://meta.wikimedia.org/wiki/Help:User_style/floating_quickbar // Restructure the page so that the sidebar can be floated addOnloadHook(function { content = document.getElementById("column-content");	// Find the main content column // Move the footer into the main column so that it scrolls footer = document.getElementById("footer");         // Find the footer footer.parentNode.removeChild(footer);              // Remove the footer from the global wrapper content.appendChild(footer);                        // Place footer at the end of the content column; // Move the tabs into the main column so that they scroll tabs = document.getElementById("p-cactions");       // Find the top tab list tabs.parentNode.removeChild(tabs);                  // Remove the tab list from the side column content.insertBefore(tabs,content.firstChild);      // Place tab list at the beginning of the content column // Move the personal links into the main column so that they scroll personal = document.getElementById("p-personal");   // Find the personal links list var nodeBefore = document.getElementById('pt-logout'); mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.js', 'js', 'pt-monobookjs', 'monobook.js is used for storing user javascripts', '', nodeBefore); mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.css', 'css', 'pt-monobookcss', 'monobook.css is used for storing user CSS styles', '', nodeBefore); // (I made this!) mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/todo', 'todo', 'pt-todo', 'my to-do list', '', nodeBefore); // also make one for "goals"? //mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/Sandbox', 'My sandbox', 'pt-sandbox', 'My sandbox is used for testing things', '', nodeBefore);

personal.parentNode.removeChild(personal);         // Remove the personal links list from the side column content.insertBefore(personal,content.firstChild); // Place personal links list at the beginning of the content column }); END DISABLED SIDEBAR*/

/**************************/

//Give the labels on the personal toolbar shorter names addOnloadHook(function {   var tab = document.getElementById('pt-preferences');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'prefs'; }); addOnloadHook(function {   var tab = document.getElementById('pt-mytalk');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'talk'; }); addOnloadHook(function {   var tab = document.getElementById('pt-watchlist');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'watches'; }); addOnloadHook(function {   var tab = document.getElementById('pt-mycontris');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'edits'; }); addOnloadHook(function {   var tab = document.getElementById('pt-logout');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'logout'; }); addOnloadHook(function {   var tab = document.getElementById('ca-talk');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'talk'; });

/************************************************************************/ //My variation of the WP:WikiProject User Scripts/Scripts/Six tabs script. if (wgNamespaceNumber >= 0) addOnloadHook(function{ var pCactions = document.getElementById('p-cactions'); if (!pCactions) return; var caMain = pCactions.getElementsByTagName('li')[0]; var caTalk = document.getElementById('ca-talk'); var caEdit = document.getElementById('ca-edit'); if (!caEdit) caEdit = document.getElementById('ca-viewsource'); var caHistory = document.getElementById('ca-history'); if (!caMain || !caTalk || !caEdit || !caHistory) return; var el_move, el_create, id2; if (wgNamespaceNumber % 2) { //talk space  el_move = caTalk; el_create = caMain; id2 = ; id2dash = ; id2cap = ''; } else {   el_move = caMain; el_create = caTalk; id2 = 'dicussion'; id2dash = '-discussion'; id2cap = 'Discussion '; } caEdit.firstChild.innerHTML = 'edit'; caHistory.firstChild.innerHTML = 'history'; el_move.parentNode.insertBefore(caHistory, el_move.nextSibling); el_move.parentNode.insertBefore(caEdit, el_move.nextSibling); var href = el_create.firstChild.getAttribute('href', 2); if (el_create.className.indexOf('new') < 0){ mw.util.addPortletLink('p-cactions', href + '?action=history', 'history',    'ca-history'+id2dash, id2cap+'history', '', el_create.nextSibling); mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',    'ca-edit'+id2dash, 'Edit '+id2, '', el_create.nextSibling); }  caMain.style.marginRight = '0.25em'; caTalk.style.marginRight = '0.2em'; caTalk.style.marginLeft = '1.1em'; })

/*********************************************/

// My code to replace the template on articles that are labelled as a "biochem" stub but are clearly related to pharmacology! // Loosely based on the stubtagtab2 and stubremove scripts

function replacestub { var contents = document.getElementById('wpTextbox1').value;      //collect everything currently in article var newcontents = contents.replace(/\{\{biochem(istry)?-stub\}\}/gi, ""); //find biochem-stub or biochemistry-stub, replace document.getElementById('wpTextbox1').value = newcontents + "debuggeriffic"; //put all the contents back document.getElementById('wpSummary').value = "Replacing biochem-stub with pharma-stub"; //edit summary } //end replacestub

/* function biochem2pharma { if (window.location.href.indexOf('action=edit') != -1) { replacestub; } //we're editing else if (window.location.href.indexOf('action=edit') == -1) { //not editing yet location.href = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURIComponent(mw.config.get('wgPageName')) + "&action=edit&bchm2phm=1"; //go edit }//end else }//end biochem2pharma

addOnloadHook(function {       //Generate a tab   if(wgCanonicalNamespace == ""  || wgNamespaceNumber == 4)    {   //Only add stubs to articles      mw.util.addPortletLink('p-cactions', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&bchm2phm=1', 'bchm2phm', 'ca-bchm2phm', 'Convert a biochemistry stub to a pharmacology stub');   }    if(document.getElementById("editform") != null && location.href.indexOf("&bchm2phm=1")!= -1 && (wgCanonicalNamespace == "" || wgNamespaceNumber == 4))      {  replacestub; } });

/******************************************************** IN PROGRESS!!!!!!!! addOnloadHook(function {  if(editmode)

/* Make red links really stand out when I am editing */ /* a.new{font-weight:bold; text-decoration:underline;} */ /* Make red links appear as almost-normal text when I am reading */ /* a.new{color:#444444} });



addOnloadHook(function{ if ((wgNamespaceNumber % 2 || wgNamespaceNumber==4) && document.URL.match(/&action=(edit|submit)/)) {

var wpSave = document.getElementById('wpSave'); if (!wpSave) return; //if you can't save, you obviously can't add sig!

if (!window.sigText) //change normal sig button as well sigText = '— \'; mwEditButtons[9].tagOpen = sigText;

//create button var btn = document.createElement('input'); btn.type='button'; btn.value = '~'; btn.onclick = function{ insertTags(sigText,,) }; btn.style.marginRight = '4px'; btn.title = 'Put your signature'; //if (window.sigAccessKey){ //btn.accessKey = sigAccessKey; //btn.title += ' [' + tooltipAccessKeyPrefix + btn.accessKey + ']'; //} wpSave.parentNode.insertBefore(btn, wpSave); /* //for 'Wikipedia:' namespace: Sig is ok on Forum pages, on all others put it after Save button if ( wgNamespaceNumber==4 && (!wgTitle.match(^(Village pump|Reference desk\/|Deletion review\/|Articles for deletion\/|Templates for deletion\/|.*noticeboard.*|Requests for (adminship|checkuser|arbitration|feedback|page protection|mediation)|Bot requests|Help desk|Editor review|Adminship survey|Cleanup|Miscellany for deletion|New contributors\' help page|Media copyright questions)))) { wpSave.parentNode.insertBefore(btn, wpSave.nextSibling); return; //avoid warning below } */

//warn if saving without signature wpSave.onclick = function{ if (document.editform.wpTextbox1.value.indexOf('~\') >= 0 ) return true else return confirm('No signature?') } } }); //note: still does not put this on non-talk/WP pages

/***********************************/

addOnloadHook(function{ var nodeBefore = document.getElementById('pt-logout'); mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.js', 'js', 'pt-js', 'monobook.js is used for storing user javascripts', , nodeBefore); mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.css', 'css', 'pt-css', 'monobook.css is used for storing user CSS styles', , nodeBefore); // (I made this!) mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/todo', 'todo', 'pt-todo', 'my to-do list', '', nodeBefore); // also make one for "goals"?

mw.util.addPortletLink('p-personal', '/w/index.php?title=Special:PrefixIndex&prefix=Skittleys&namespace=2', 'subs', 'pt-subs', 'Subpages of my userspace', '', document.getElementById('pt-preferences'));

mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/sandbox', 'sand', 'pt-sand', 'my sandbox', '', document.getElementById('pt-js'));

});