User:Dylan Lake/monobook.js

/// /*

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) }; /*



/*



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

/*

//

// // User:Lupin/popups.js

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

popupOnEditSelection=false; popupSubpopups=true;

//

//Please leave the following line //user:Where/usertabs addOnloadHook(function {  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history      return;   }   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {      username_a = document.URL.match(/:.*:(.*)/);      username=username_a[1];      addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");   } });

// //

// User:Jsimlo/shortcuts.js document.write(' '); function shortcutsInit { shortcutsAddLink ('LOP', 'Wikipedia:List of policies'); shortcutsAddLink ('A', 'Wikipedia:Attribution'); shortcutsAddLink ('NPOV', 'Wikipedia:Neutral point of view'); shortcutsAddLink ('NOT', 'Wikipedia:What Wikipedia is not'); shortcutsAddLink ('CSD', 'Wikipedia:Criteria for speedy deletion'); shortcutsAddLink ('News', 'Wikipedia:Village pump (news)'); shortcutsAddLink ('Policy', 'Wikipedia:Village pump (policy)'); shortcutsAddLink ('Tech', 'Wikipedia:Village pump (technical)'); shortcutsAddLink ('Proposals', 'Wikipedia:Village pump (proposals)'); shortcutsAddLink ('Assistance', 'Wikipedia:Village pump (assistance)'); shortcutsAddLink ('Misc', 'Wikipedia:Village pump (miscellaneous)'); shortcutsAddLink ('AFD', 'Wikipedia:Articles for deletion'); shortcutsAddLink ('Help desk', 'Wikipedia:Help desk'); shortcutsAddLink ('Math', 'Wikipedia:Reference desk/Mathematics'); shortcutsAddLink ('SR', 'Wikipedia:Simplified Ruleset'); shortcutsAddLink ('monobook.js', 'User:Dylan Lake/monobook.js'); shortcutsAddLink ('Jimbo', 'User:Jimbo Wales'); shortcutsAddLink ('MOS', 'Wikipedia:Manual of Style'); shortcutsAddLink ('IAR', 'Wikipedia:Ignore all rules'); shortcutsAddLink ('Editing', 'Wikipedia:Editing policy'); shortcutsAddLink ('N', 'Wikipedia:Notability'); shortcutsAddLink ('AN', 'WP:AN'); shortcutsAddLink ('RFC', 'Wikipedia:Requests for comment'); shortcutsAddLink ('Newpages', 'Special:Newpages'); shortcutsAddLink ('5P', 'Wikipedia:Five pillars'); shortcutsAddLink ('Principles', 'User:Jimbo Wales/Statement of principles'); }

// from User:Thebainer/monobook.js

// 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");

}); //

// Log tools document.write(' ');

//

// UTC clock document.write(' '); //

// This script changes the "Your signature with timestamp" edit button to use a real em dash instead of two hyphens.

(function {    var oldAddButton = addButton;    if (typeof(oldAddButton) != 'function') return;    addButton = function  {        if (arguments.length > 2)            arguments[2] = arguments[2].replace(/^--(~+)$/, '—$1');        oldAddButton.apply(this, arguments);    }; });

//

// Admin-like RC Patrol tools

document.write(' ');

//

// User:Zocky/SearchBox.js document.write(' ');

// ADD UNWATCH LINKS:

addOnloadHook(function {    if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;    if (!document.forms[0] || !document.forms[0].namespace) return;

//var query_prefix = "title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=submit&remove=1&id[]="; var query_prefix = "action=unwatch&title=";

// get list of all links in content: var links = document.getElementById('content').getElementsByTagName('a');

// make a static copy of the nodelist and lose the original for speed // while we're at it, prune the uninteresting links from the list var linksCopy = new Array ; for (var i = 0; i < links.length; i++) { if (/[?&]action=history([&#]|$)/.test(links[i].href)) linksCopy.push(links[i]); }   links = linksCopy;

for (var i = 0; i < links.length; i++) { // create unwatch link and append it after history link var unwatch = document.createElement('a'); unwatch.href = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?" + query_prefix + encodeURIComponent(links[i].title); unwatch.title = "Unwatch "+links[i].title; unwatch.appendChild(document.createTextNode("unwatch")); links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);

// insert a delimiter between the two links var delim = links[i].previousSibling; delimText = (delim.nodeType == 3 ? delim.nodeValue : ""); // kluge to handle case where "diff" is unlinked delim = document.createTextNode(delimText.replace(/^.*diff/, "")); links[i].parentNode.insertBefore(delim, unwatch); } });

//

// copy wikEd (http://en.wikipedia.org/wiki/User:Cacycle/wikEd.js) frame to wpTextbox1 textarea if (typeof(wikEdUseWikEd) != 'undefined') { if (wikEdUseWikEd == true) { WikEdUpdateTextarea; } }

// make changes to wpTextbox1 textarea

// copy wpTextbox1 textarea back to wikEd frame if (typeof(wikEdUseWikEd) != 'undefined') { if (wikEdUseWikEd == true) { WikEdUpdateFrame; } } // User:Outriggr/metadatatest.js importScript('User:Outriggr/metadatatest.js'); defaultProject = "WPBiography";

importScript('User:Alex_Smotrov/qpreview.js');

// install User:Cacycle/wikEdDiff enhanced diff view using ajax document.write(' ');

// User:Dschwen/wikiminiatlas2.js - please include this line document.write(' '); // Adds a tab allowing you to edit the 0th section of a page (the top area usually used as an introduction).

//

addOnloadHook(function {    var x;    if (!(x = document.getElementById('ca-edit') )) return;    var url;    if (!(url = x.getElementsByTagName('a')[0] )) return;    if (!(url = url.href )) return;    var y = mw.util.addPortletLink('p-cactions', url+"&section=0", '0', 'ca-edit-0', 'Edit the lead section of this page', '0', x.nextSibling);

y.className = x.className; // steal classes from the the edit tab... x.className = 'istalk';    // ...and make the edit tab have no right margin

// exception: don't steal the "selected" class unless actually editing section 0: if (/(^| )selected( |$)/.test(y.className)) { if (!document.editform || !document.editform.wpSection           || document.editform.wpSection.value != "0") { y.className = y.className.replace(/(^| )selected( |$)/g, "$1"); x.className += ' selected'; }   } });

//

// ///