User:WAvegetarian/monobook.js

// raw version at http://en.wikipedia.org/w/index.php?title=User:WAvegetarian/monobook.js&action=raw&ctype=text/javascript&dontcountme=s // // w:User:Lupin/popups.js

simplePopups = true; popupShortcutKeys = true; // more options at http://en.wikipedia.org/wiki/Wikipedia:Tools/Navigation_popups

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

// Live Preview customization (from User:Pilaf/Live_Preview), // edit this to your own liking.

wpUserName  = 'WAvegetarian';   // User name to display in signatures wpShowImages = true;     // Enable downloading and displaying of images

// Include Live Preview...

document.write(' ');

/* This is to keep track of who is using the Live Preview: w:User:Pilaf/livepreview.js */

//************************************ Purge cache tab ***************************** //From http://en.wikipedia.org/w/index.php?title=User:Trilobite/Tools&oldid=17855224 function addPurgeTab { ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge'); }

//************************************ Changes since I last edited **************************** //From w:User:JesseW/monobook.js function addSinceTab { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited }   else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) { var thetitle=document.title.slice(0, String(document.title).indexOf(" - ")); var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', ''); l.lastChild.title="Changes since I last edited"; } } function do_since_I_last_edited { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode ("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild)

var username=textContent(document.getElementById("pt-userpage")); var hists=document.getElementById("pagehistory").childNodes; for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName && textContent(hists[n].getElementsByTagName("span")[0])==username) { document.location=hists[n].childNodes[1].href; return; } }

msg.replaceChild(document.createTextNode ("You have not edited this page! (recently)"), msg.firstChild); }

//****************** Are you sure you don't want a Summary? ******************************* //From http://en.wikipedia.org/w/index.php?title=User:ABCD/monobook.js&oldid=19452182 function addForceSummary{ if(!/&action=edit/.test(window.location.href)) return; if(/&section=new/.test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; }

function forceSummary{ var form = document.forms.editform; if(!form.wpSummary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){     var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',form.wpSummary.value); if(r == null) return false; form.wpSummary.value = r;   } return true; }

//************************************ Edit lead section ***************************** //From http://en.wikipedia.org/w/index.php?title=User:ABCD/monobook.js&oldid=19452182 function addEditSection0{ ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page']; if(!document.getElementById) return; var x = document.getElementById('ca-edit'); if(!x) return; var y = document.createElement('LI'); y.id = 'ca-edit-0'; if(x.className == 'selected'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; }   } else if(x.className == 'selected istalk'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; }   } else { y.className = x.className; x.className = 'istalk'; }   var z = document.createElement('A'); if(x.children){ z.href = x.children[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); }else{ z.href = x.childNodes[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); } }

//************************************ Regexp replace tab ************************************ //From http://en.wikipedia.org/w/index.php?title=User:Trilobite/Tools&oldid=17855224 //Renamed by JesseW. function regexpReplaceTab { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing ") == 0) addlilink(tabs, 'javascript:replace', 'replace', ''); } function replace { var s = prompt("Search regexp?"); if(s) { var r = prompt("Replace regexp?"); if(!r && r != '') return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } }

//************************************ Tabs at bottom ************************************ function tabsAtBottom { var tabs = document.getElementById('p-cactions').cloneNode(true); tabs.id = 'mytabs'; var listitems = tabs.getElementsByTagName('LI'); for (var i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id; } document.getElementById('column-content').appendChild(tabs); }

//************************************ Utility functions ************************************ function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; } function addlilink2(tabs, url, name, id, title) { var l=addlilink(tabs,url,name,id); l.lastChild.title=title; return l; } /**** Add tab as menu ****/ function addlimenu(tabs, name, id) {   var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabs.appendChild(li); return li; } // ******* Cross browser textcontent function textContent(el) { if (el.textContent) return el.textContent; return el.innerText; }

//***************************************************************************************** window.onload = Main;

function Main { // autoWikiWatchlist; if (LivePreviewInstall) LivePreviewInstall; addForceSummary var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; // addlimenu(tabs, 'Watchlists', 'watchlists-menu'); // addWikiWatchlist("Interests"); // addWikiWatchlist("Wikipedia"); // addWikiWatchlist("Conversations"); // addWikiWatchlist("News"); addlilink2(tabs, "javascript:doLastDiff", 'last', '',"Show most recent diff"); // addlilink2(tabs, "javascript:doPUI", 'PUI', '', "Tag images as unverifiedimage"); addSinceTab; /*Complicated if statements; need to find a neat way to do this...*/ // doNextItem; regexpReplaceTab; addEditSection0; addPurgeTab; // tabsAtBottom; //automate; //cesarb_fixDiffOverflowLoadListener; addUnwatch; }

//