User:Bob/monobook.js
Appearance
< User:Bob
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Bob/monobook.css. |
/* <nowiki> */
importScript('User:Bob/script/addlimenu.js');
importScript('User:TheFearow/qstring.js');
importScript('MediaWiki:LinkFixr.js');
importScript('User:Ais523/stubtagtab.js');
importScript('User:Omegatron/monobook.js/autolinker.js');
importScript('User:Alex Smotrov/histcomb.js');
importScript('User:Alex Smotrov/qpreview.js');
importScript('User:Bob/script/easywelcome.js');
importScript('User:Bob/script/namespacesearch.js');
importScript('User:Bob/script/portlets.js');
importScript('User:Bob/script/clock.js');
importScript('User:Bob/script/hideyellowboxes.js');
importScript('User:Lupin/recent2.js');
importScript('User:Lupin/autoedit.js');
if (wgNamespaceNumber >= 0)
$(function() {
var todaysDate = getTheDate();
var namespaces = new Array("", "Talk:", "User:", "User_talk:",
"Wikipedia:", "Wikipedia_talk:", "Image:", "Image_talk:",
"MediaWiki:", "MediaWiki_talk:", "Template:", "Template_talk:",
"Help:", "Help_talk:", "Category:", "Category_talk:",
"Portal:", "Portal_talk:");
/* set the page and talk page names for use throughout the page */
if(wgNamespaceNumber % 2 == 0) { // if it's not a talk page
var thisPage = namespaces[wgNamespaceNumber] + wgTitle;
var thisTalk = namespaces[wgNamespaceNumber + 1] + wgTitle;
thisPage = encodeURIComponent(thisPage);
thisTalk = encodeURIComponent(thisTalk);
var currentPage = thisPage;
} else {
var thisPage = namespaces[wgNamespaceNumber - 1] + wgTitle;
var thisTalk = namespaces[wgNamespaceNumber] + wgTitle;
thisPage = encodeURIComponent(thisPage);
thisTalk = encodeURIComponent(thisTalk);
var currentPage = thisTalk;
}
var pCactions = document.getElementById('p-cactions');
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = pCactions.getElementsByTagName('li')[1];
var caEdit = document.getElementById('ca-edit');
var caView = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
var caMove = document.getElementById('ca-move');
var caWatch = document.getElementById('ca-watch');
var caUnwatch = document.getElementById('ca-unwatch');
var caProtect = document.getElementById('ca-protect');
var caDelete = document.getElementById('ca-delete');
var caAdd = document.getElementById('ca-addsection');
var editText = (caView) ? 'view source' : 'edit';
// Hide tabs
if (caMain) caMain.style.display = 'none';
if (caEdit) caEdit.style.display = 'none';
if (caTalk) caTalk.style.display = 'none';
if (caView) caView.style.display = 'none';
if (caHistory) caHistory.style.display = 'none';
if (caMove) caMove.style.display = 'none';
if (caProtect) caProtect.style.display = 'none';
if (caDelete) caDelete.style.display = 'none';
if (caAdd) caAdd.style.display = 'none';
if (!caWatch) caWatch = caUnwatch;
var pageText = getElementUrlText(caMain);
var talkText = 'discussion'; // getElementUrlText(caTalk);
/* page menu */
var newPage = addLiMenu(pageText,caWatch);
if( caMain.className.search('new') == 0 ) {
mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage+'&action=edit','create');
newPage.className += " red";
newPage.firstChild.nextSibling.className += " red";
} else {
mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage,'view '+pageText);
mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage+'&action=edit',editText);
mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage+'&action=history','history');
mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?diff=cur&oldid=prev&title='+thisPage,'last');
if (caMove) mw.util.addPortletLink(newPage.id,wgServer+'/wiki/Special:MovePage/'+ thisPage, 'move');
if (caProtect) mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage+'&action=protect', 'protect');
if (caDelete) mw.util.addPortletLink(newPage.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisPage+'&action=delete', 'delete');
}
mw.util.addPortletLink(newPage.id, mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + thisPage, 'page log');
if(caMain.className.search(/selected/i) != -1) newPage.className += ' selected';
/* talk menu */
var newTalk = addLiMenu(talkText,caWatch);
if( caTalk.className.search('new') == 0 ) {
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=edit','create');
newTalk.className += " red";
newTalk.firstChild.nextSibling.className += " red";
} else {
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk,'view '+talkText);
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=edit','edit');
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=edit§ion=new','add comment');
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=history','history');
mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?diff=cur&oldid=prev&title='+thisTalk,'last');
if (caMove) mw.util.addPortletLink(newTalk.id,wgServer+'/wiki/Special:MovePage/'+ thisTalk, 'move');
if (caProtect) mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=protect', 'protect');
if (caDelete) mw.util.addPortletLink(newTalk.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+thisTalk+'&action=delete', 'delete');
}
mw.util.addPortletLink(newTalk.id, mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&page=' + thisTalk, 'page log');
if(caTalk.className.search(/selected/i) != -1) newTalk.className += ' selected';
/* if we're in the userspace, add more info */
if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) {
if ( wgTitle.indexOf("/") == -1 ) {
var uname = wgTitle;
} else {
var uname = wgTitle.substring(0, wgTitle.indexOf("/"));
}
var userMenu = addLiMenu('user info');
mw.util.addPortletLink(userMenu.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:PrefixIndex&from='+uname+'/&namespace=2', 'userspace');
mw.util.addPortletLink(userMenu.id, 'http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?site=en.wikipedia.org&username='+uname, 'edit count');
mw.util.addPortletLink(userMenu.id,wgServer+'/wiki/Special:Contributions/'+uname,'contribs');
mw.util.addPortletLink(userMenu.id,mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:DeletedContributions&target='+uname,'deleted contribs');
mw.util.addPortletLink(userMenu.id, mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:Log&user='+uname,'user log');
mw.util.addPortletLink(userMenu.id, mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:Log&type=block&user='+uname,'block log');
if (caDelete) mw.util.addPortletLink(userMenu.id,wgServer+"/wiki"+'/Special:Blockip/'+uname,'block');
}
var cleanupMenu = addLiMenu('cleanup');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=cleanup','cleanup');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=wikify','wikify');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=notability','notability');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=pov','neutrality');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=crystal|date='+todaysDate, 'crystal ball');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=context','little context');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=uncategorized', 'uncategorized');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=unreferenced','unreferenced');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=onesource','one source');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=refimprove','more refs');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=copyedit','copyedit');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=rewrite','rewrite');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=notenglish','foreign lang');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=internallinks','no links');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=expand','expand');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=update','update');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=trivia','trivia');
mw.util.addPortletLink(cleanupMenu.id,'/w/index.php?title='+currentPage+'&action=edit&tag=hoax','hoax');
if(QueryString.exists('tag')) {
if(document.getElementById('mw-recreate-deleted-warn') || document.getElementById('noarticletext')) {
alert('You are about to (re)create a page that does not exist; tagging has been aborted.');
return;
}
var tagText = QueryString.get('tag');
var f = document.editform, t = f.wpTextbox1;
t.value = "{" + "{" + tagText + "}}\n" + t.value;
f.wpSummary.value = "adding {{"+tagText+"}} tag";
f.wpSave.click();
return;
}
var csdMenu = addLiMenu('csd');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-g1','nonsense');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-g2','test');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-g3','vandalism');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-g10','attack');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-g11','spam/ad');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-bio','bio');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-band','band');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-inc','corporation');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-group','organization');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-a2','foreign lang');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-a7','insignificant');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-a1','no context');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=db-a3','empty');
mw.util.addPortletLink(csdMenu.id,'/w/index.php?title='+currentPage+'&action=edit&csd=other','other...');
if(QueryString.exists('csd')) {
if(QueryString.get('csd') == 'other') {
var csdText = prompt('Please type a reason for speedy deletion:');
csdText = 'db|'+csdText;
} else {
var csdText = QueryString.get('csd');
}
var f = document.editform, t = f.wpTextbox1;
if(t.value.substr(0,2) == "{"+"{") {
if(!confirm('There is another template on this page. Continue tagging?'))
return;
} else {
if(document.getElementById('mw-recreate-deleted-warn') || document.getElementById('noarticletext')) {
alert('You are about to (re)create a page that does not exist; tagging has been aborted.');
return;
}
}
t.value = "{" + "{" + csdText + "}}\n" + t.value;
f.wpSummary.value = "Requesting speedy deletion per [[WP:CSD]]";
f.wpSave.click();
return;
}
});
/* </nowiki> */