User:Cemil Yilburak/monobook.js

// User:Lupin/popups.js

importScript('User:Lupin/popups.js'); //Useful: mw.util.addPortletLink(where to add it e.g. cactions, url to link to, name, id, title/tooltip-text, key, to be added right after...(e.g., 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:Haza-w/cactions.js'); //User:Haza-w/cactions.js */

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

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

/******** Floating sidebar ********/ // Originally at http://meta.wikimedia.org/wiki/Help:User_style/floating_quickbar // Restructure the page so that the sidebar can be floated $(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 mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.js', 'js', 'pt-monobookjs', 'monobook.js is used for storing user javascripts', '', 'pt-logout'); mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/monobook.css', 'css', 'pt-monobookcss', 'monobook.css is used for storing user CSS styles', '', 'pt-logout'); // (I made this!) mw.util.addPortletLink('p-personal', '/wiki/Special:MyPage/todo', 'todo', 'pt-todo', 'my to-do list', '', 'pt-mycontris'); // 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', '', 'pt-logout'); //mw.util.addPortletLink('p-personal', '/w/index.php?title=Special%3AAllpages&from=Skittleys&namespace=2', 'My subpages', 'pt-subpages', 'Subpages of my userspace', '', 'pt-logout');

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 });

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

/* WORK IN Progress

// Stubfix code // Originally by User:Georgemoney // Made functional by me.

$(function{    if(wgCanonicalNamespace == "") {   //Check if it's article to add the tab        //var taburl = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=edit&stubfix=1";        mw.util.addPortletLink("p-cactions", "javascript:stubremove", "rms", "ca-stubrm", "Remove stub tags");    } });

//check if we are editing and we want to stubfix if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('stubfix=1') != -1) { document.getElementById('wpSummary').value = "Removing stub tag"; var contents = document.getElementById('wpTextbox1').value; var newcontents = contents.replace(/\{\{.*?stubs?(\|?.*)\}\}/g, ""); document.getElementById('wpTextbox1').value = newcontents; document.getElementById('wpWatchthis').checked = ""; document.getElementById('wpDiff').click; }// end if (edit) }); //addOnloadHook //END STUBFIX CODE

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

//Give the labels on the personal toolbar shorter names $(function {   var tab = document.getElementById('pt-preferences');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'prefs'; }); $(function {   var tab = document.getElementById('pt-mytalk');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'talk'; }); $(function {   var tab = document.getElementById('pt-watchlist');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'watching'; }); $(function {   var tab = document.getElementById('pt-mycontris');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'contribs'; }); $(function {   var tab = document.getElementById('pt-logout');    if(!tab) return;    var tablink = tab.getElementsByTagName('a')[0];    if(!tablink) return;    tablink.firstChild.nodeValue = 'logout'; }); $(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 Six tabs script. if (wgNamespaceNumber >= 0) $(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 = ''; } else {   el_move = caMain; el_create = caTalk; id2 = 'dicussion'; } 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-'+id2, id2+' history', '', el_create.nextSibling); mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',    'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling); } /* if (wgNamespaceNumber %2) caMain.style.marginRight = '0.3em'; */ /* else caTalk.style.marginRight = '0.3em';  */ caTalk.style.marginLeft = '1em'; caEdit.style.marginLeft = '0.3em'; caHistory.style.marginLeft = '0.3em'; })

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

// My variant of the "User tabs" script // Please leave the following line // user:Where/usertabs $(function { if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history     return;  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     var username = encodeURIComponent( wgTitle );     mw.util.addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "Contribs", "ca-contrib", "User contributions");     mw.util.addPortletLink("p-cactions", "http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "# edits", "ca-editcount", "Edit count from Interiot's Tool1");     mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=move&user=" + username, "moves", "ca-pagemoves", "Page moves by this user");     mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&page=User:" + username, "Blocks", "ca-blog", "Blocks received by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "subpages", "", "List of pages in this user's userspace"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=block&user=" + username, "Blocks out", "", "Blocks by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=protect&user=" + username, "Protects", "", "Protections by this user"); mw.util.addPortletLink("p-cactions", wgServer + "/w/index.php?title=Special:Log&type=delete&user=" + username, "+XFDs", "", "Deletions by this user");

//My fix to add some space! var needSpace = document.getElementById('ca-contrib'); needSpace.style.marginLeft = '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 document.getElementById('wpPreview').click; //preview page } //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

$(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!!!!!!!! $(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} });



$(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