User:Nobleeagle/monobook.js

// 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 = true; popupPreviews = true; popupThumbAction = "sizetoggle"; // Helper tools mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js'             + '&action=raw&ctype=text/javascript&dontcountme=s'); // // Log tools document.write(' '); // // History tools mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js'             + '&action=raw&ctype=text/javascript&dontcountme=s'); // // Replace txt document.write(' '); // // AfD/PfD/Copyvio and tagging tabs document.write(' '); // /* */

/* Some of these tools are documented at User:Trilobite/Tools. */ /* Many are based on those employed by User:ABCD. */ /* This set-up is tailored to my monobook.css, but that shouldn't make much difference. */ /* Only tested in Firefox so far. */

/* change the names of personal tools links and the edit tab */ function changelinks { if(!document.getElementById) return; document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk page'; document.getElementById('pt-preferences').firstChild.innerHTML = 'Prefs'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'Watchlist'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contribs'; document.getElementById('pt-logout').firstChild.innerHTML = 'Log out'; if(document.getElementById('ca-edit')) document.getElementById('ca-edit').firstChild.innerHTML = 'edit'; }

/* this function is used to add extra tabs and links */ 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.appendChild(na); tabs.appendChild(li); return li; }

/* add links to the sidebar toolbox */ function addtoolboxlinks { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/User:Nobleeagle/RFA', 'RFA Monitoring', ''); addlilink(tb, '/wiki/Special:Recentchangeslinked/List_of_India-related_topics', 'Ind changes', ''); addlilink(tb, '/wiki/Wikipedia:Vandalism_in_progress', 'Vandalism', ''); addlilink(tb, '/wiki/Special:Listusers', 'List Users', ''); addlilink(tb, '/wiki/Wikipedia:Village_pump_%28all%29', 'Village pump', ''); addlilink(tb, '/wiki/WP:INWNB', 'Noticeboard', ''); addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard/Incidents', 'Incidents', ''); }

/* add a purge tab */ function addpurge { 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'); }

/* add a replace tab in edit mode */ 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); } }

/* add an unverified tab when editing image descriptions */ function unverified { document.editform.wpSummary.value = 'needs a source and copyright tag - see Image copyright tags'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; txt.focus; } function pui { document.editform.wpSummary.value = 'PUI'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; txt.focus; }

/* add tabs to warn vandals */ function vandal(tmplt) { var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ' '; txt.focus; txt = document.editform.wpSummary; txt.value = tmplt document.editform.wpWatchthis.checked = false; }

/* add tabs to fill in deletion summaries */ function speedy (criterion) { var form = document.forms.deleteconfirm; form.wpReason.value = criterion; }

/* add a tab to fill in deletion summaries with a link to VfD */ function vfddelete { var form = document.forms.deleteconfirm; form.wpReason.value = 'Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ''; }

/* add tabs to close VfD discussions */ function closevfd(bold, notbold) { var txt = document.editform.wpTextbox1; txt.value = " " + bold + "" + notbold + ". ~\n" + txt.value + "\n\n"; txt = document.editform.wpSummary; txt.value = "close discussion: " + bold + notbold; document.editform.wpWatchthis.checked = false; }

/* add a VfD keep tab when editing talk pages */ function vfdresult { document.editform.wpSummary.value = 'VfD concluded in favour of keeping'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '==Articles for deletion==\nIn July 2005, this article was nominated for deletion. The result was to keep. See Articles for deletion/ for a record of the discussion. ~';   txt.focus; }

/* add tabs to show and hide closed VfD discussions on log pages */ function hidevfd { var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = "none"; document.getElementById('footer').style.display = 'none'; } function showvfd { var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = ""; document.getElementById('footer').style.display = ''; }

/* add a tab linking to VfD for deleted pages */ function vfdold { var x = document.getElementById('ca-article'); 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(/Special:Undelete/, "Wikipedia:Articles_for_deletion"), 'vfd', ''); }

/* check what kind of page you're viewing and add tabs approriately */ function morelinks { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing ") == 0) addlilink(tabs, 'javascript:replace', 'replace', ''); if(document.title.indexOf("Editing Image:") == 0) { addlilink(tabs, 'javascript:unverified', 'tag', ''); addlilink(tabs, 'javascript:pui', 'pui', ''); }   if(document.title.indexOf("Editing User talk:") == 0) { addlilink(tabs, 'javascript:vandal("blatantvandal")', 'V', ''); addlilink(tabs, 'javascript:vandal("test1a")', 'rm', ''); addlilink(tabs, 'javascript:vandal("Anon vandal")', 'anon', ''); addlilink(tabs, 'javascript:vandal("NPOV0")', 'POV', ''); addlilink(tabs, 'javascript:vandal("Npa3")', 'NPA', ''); addlilink(tabs, 'javascript:vandal("Civil1")', 'C', ''); addlilink(tabs, 'javascript:vandal("spam")', 's1', ''); addlilink(tabs, 'javascript:vandal("test2")', '2', ''); addlilink(tabs, 'javascript:vandal("spam3")', 's3', ''); addlilink(tabs, 'javascript:vandal("spam4")', 's4', ''); }   if(document.title.indexOf("Editing Talk:") == 0) addlilink(tabs, 'javascript:vfdresult', 'vfd', ''); if(document.title.indexOf("Wikipedia:Articles for deletion/Log") == 0) { addlilink(tabs, 'javascript:hidevfd', 'h', 'ca-hide'); addlilink(tabs, 'javascript:showvfd', 's', 'ca-show'); }   if(document.title.indexOf("View and restore deleted pages") == 0) vfdold; }

/* Live Preview by User:Pilaf */ wpUserName = 'Trilobite'; wpShowImages = true; document.write(' ');

//From 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=document.getElementById("pt-userpage").textContent; var hists=document.getElementById("pagehistory").childNodes; for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].textContent==username) { document.location=hists[n].childNodes[1].href; return; }	}

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

/* Go! */ window.onload = Main; function Main { changelinks; addtoolboxlinks addpurge; addSinceTab; morelinks; LivePreviewInstall; }

/* */