User:H2g2bob/monobook.js

importScript('User:Dispenser/alttextexplorer.js'); // Linkback: User:Dispenser/alttextexplorer.js

/* function menu_move_to_top(menu_name) { menu = document.getElementById(menu_name); if (menu) { parent = menu.parentNode; parent.insertBefore( parent.removeChild(menu), parent.firstChild ); } } addOnloadHook(function {   menu_names = [       "p-search", // search box       "p-tb", // toolbox       "p-interaction", // interaction       "p-navigation", // navigation       ];    while ( menu_name = menu_names.pop ) {       menu_move_to_top(menu_name)    } });

/*

Tab text editor
*/ function tabTexter(ttname,tttext) {   var tab = document.getElementById(ttname); if (tab) tab.firstChild.innerHTML = tttext; } function tabTexterHook {   tabTexter("ca-edit", "edit"); tabTexter("ca-history", "hist"); tabTexter("ca-move", "&rarr;"); tabTexter("ca-unwatch", "☑"); //☐☑☒ tabTexter("ca-watch", "☐"); tabTexter("ca-talk", "talk"); } addOnloadHook(tabTexterHook);

/*

User Warnings for Diffs
*/ function UWMHook {   var url = String(window.location.search); url = "&" + url.substring(url.indexOf("?")+1, url.length); if (url.indexOf("&diff") >= 0 && url.indexOf("&undo") < 0) {      var rx_title = new RegExp( "&title=([^&]*)" )( url ); if (!rx_title || !rx_title[1]) return; var title = String( rx_title[1] ); title = title.replace("_", " ", "g"); var params = url.replace(/&title=[^&]*/, ""); params = params.substring(1, params.length); var d = new Date; var datehead = "===" + Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")[d.getMonth] + " " + d.getFullYear + "==="; /* check if IP */ var is_ip = false; try { var iprx = new RegExp(/* */ "diff.ntitle.*Special.Contributions.([0-9]+.[0-9]+.[0-9]+.[0-9]+)" /* */); var iptx = String( document.getElementById("bodyContent").innerHTML ); if ( iprx.test(iptx) ) is_ip = true; } catch (e) {;} var elem = document.getElementById("contentSub"); elem.innerHTML += /* */ " ==Notices==  " + datehead + "  --~ : ''This message refers to [ a recent edit] to " + title + "." + (is_ip ? " This edit was made from this IP address . IP addresses are sometimes shared between several users - if this edit was not made by you, consider creating an account to avoid confusion with others." : "") + "'' "; /* */ } } addOnloadHook(UWMHook);

// Originally based on http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510 //See WikiProject User scripts/Scripts/Show last diff // addLastDiff function addLastDiff {   addPortletLink (       'p-cactions',        'http://en.wikipedia.org/w/index.php?title=' + mw.config.get('wgPageName') + '&diff=cur&oldid=prev',        'diff',        'ca-last',        'Show most recent diff',        'd',        document.getElementById('ca-history')    ); } $(addLastDiff);