User:Doc glasgow/monobook.js
Appearance
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:Doc glasgow/monobook.css. |
/* <pre><nowiki> */
function winc(s) {
s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=' + s
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
winc('[[User:Voice_of_All/Addtabs/monobook.js]]'); // Helper tools
winc('[[User:Lupin/recent2.js]]'); // Anti-vandal tool
winc('[[User:Cactus.man/Scripts/MoreTabs.js]]'); // Additional tabs for user & project pages
winc('[[User:Cactus.man/Scripts/FixDiffWidth.js]]'); // Fix diff widths
winc('[[User:Voice of All/UTCclock.js]]'); // Add date and time to the personal menu
winc('[[User:Voice of All/RC/monobook.js]]'); // History tools
winc('[[User:Voice_of_All/Revert/monobook.js]]'); // Diff page links
winc('[[User:Voice_of_All/Deletion/monobook.js]]'); // AfD/PfD/Copyvio and tagging tabs
winc('[[User:Interiot/Tool2/code.js]]'); //Interiot's javascript edit counter
winc('[[User:Lupin/popups.js]]'); // [[User:Lupin/popups.js]]
// Call function to load when needed.
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
window.previousLoadFunction = window.onload;
window.onload = function()
{
window.previousLoadFunction();
myLoadFuncs();
}
}
// Load custom functions.
function myLoadFuncs()
{
// Add more toolbox links
addToolBoxLinks();
// Add navbar links
addNavBarLinks()
// Edit to top of page scetion
addEditSection0();
// Load custom tabs
add_tabs();
// re-render the title and accesskeys for stuff
akeytt();
}
/**** Add generic tab ****/
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = name;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
/**** 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;
}
// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch)
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += msg;
f.wpSummary.value = summ;
f.wpWatchthis.checked = watch;
}
// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function add_del_tag(msg, summ, watch)
{
var f = document.editform, t = f.wpTextbox1;
msg += '\n';
msg += t.value;
t.value = msg;
f.wpSummary.value = summ;
f.wpWatchthis.checked = watch;
}
//************************************ 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§ion=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§ion=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 + '§ion=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 + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
// Change the names of links at the top of pages.
function changetitles() {
if(!document.getElementById) return;
document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk';
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-nstab-user'))
document.getElementById('ca-nstab-user').firstChild.innerHTML = 'user';
if(document.getElementById('ca-talk'))
document.getElementById('ca-talk').firstChild.innerHTML ='talk';
if(document.getElementById('ca-edit'))
document.getElementById('ca-edit').firstChild.innerHTML = 'edit';
if(document.getElementById('ca-history'))
document.getElementById('ca-history').firstChild.innerHTML = 'hist';
}
if (window.addEventListener) window.addEventListener("load",changetitles,false);
else if (window.attachEvent) window.attachEvent("onload",changetitles);
// Add more personal links to the tollbox section.
function addToolBoxLinks()
{
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/w/index.php?title=Special:Ipblocklist&action=unblock', 'Unblock', '');
}
function addNavBarLinks()
{
var navbar = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
addlilink(navbar, '/wiki/Special:Log', 'Logs', '');
addlilink(navbar, '/w/index.php?title=Special:Log&type=newusers&user=&page=&limit=100&offset=0', 'New users', '');
addlilink(navbar, '/w/index.php?title=Special:Newpages&limit=500&offset=500&namespace=0', 'New pages(2)', '');
var afdtime = new Date();
var months = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];
addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), 'Todays AfD', '');
afdtime.setUTCDate(afdtime.getUTCDate() - 5);
addlilink(navbar, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
+ '_' + months[afdtime.getUTCMonth()] + '_' + afdtime.getUTCDate(), '5-day old AfD', '');
var username=document.getElementById("pt-userpage").textContent;
}
// adds various tabs and menu tabs
function add_tabs()
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var username=document.getElementById("pt-userpage").textContent;
// Only add for pages with "Edit" somewhere in the title
if (document.title.indexOf("Edit") != -1)
{
addlimenu(tabs, 'Talk messages', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen S/Templates/Warning}}", "Regarding your edits (test1)", true, 1)','LEVEL1', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen S/Templates/Vandalism}}", "Warning, please stop now (test2)", true, 1)','WARNING', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen S/Templates/Final}}", "Final warning (test4)", false, 1)','FINAL', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen S/Templates/Blocked}}", "You have been blocked", false, 1)','TEMP BLOCK', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen S/Templates/Indefblocked}}", "You have been indefinitely blocked", false, 1)','PERM BLOCK', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:UsernameBlocked}}-- ~~~~", "You have been blocked", false, 1)','username', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen_S/Templates/Welcome}}", "Welcome to Wikipedia!", true, 1)','Welcome', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen_S/Templates/WelcomeEmail}}", "Welcome to Wikipedia!", true, 1)','WelcomeEmail', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Anon}}-- ~~~~", "Welcome to Wikipedia!", false, 1)','WelcomeAnon', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:defwarn}}-- ~~~~", "Defamation/Vandalism", false, 1)','Defamation', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:anon vandal}}-- ~~~~", "Vandalism", false, 1)','stop vandal!', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:Vanity|}}-- ~~~~", "About the page you created", false, 1)','Vanity', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam1}}-- ~~~~", "Adding links to Wikipedia", false, 1)','Spam1', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam2}}-- ~~~~", "Spamming", false, 1)','Spam2', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam3}}-- ~~~~", "Spamming", false, 1)','Spam3', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam4}}-- ~~~~", "Last warning for spamming", false, 1)','Spam4', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:spam5}}-- ~~~~", "You have been blocked for spamming", false, 1)','Spam5', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:3RR}}-- ~~~~", "Warning", false, 1)','3RR', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen_S/Templates/Notability}}", "Your article", false, 1)','notability', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:blanking}}-- ~~~~", "Blanking pages", false, 1)','blanking', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:nothanks|}}-- ~~~~", "About your edits", false, 1)','nothanks', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:nothanks-sd|pg=page name|url=url of source}}-- ~~~~", "nothanks-sd", false, 1)','nothanks-sd', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:User:Glen_S/Templates/Pav|}}", "Present", false, 1)','Pavlova', '');
addlilink(talkm,'javascript:edit_summary_watch("{{Indefblockeduser}}", "This user is indefinitely blocked", false, 1)','Indefblocked', '');
addlilink(talkm,'javascript:edit_summary_watch("{{usertalk-sprotect}}", "This talk page has been protected", false, 1)','usertalk-sprotect', '');
addlilink(talkm,'javascript:edit_summary_watch("{{sprotect}}", "This article has been semiprotected", false, 1)','sprotect', '');
addlilink(talkm,'javascript:edit_summary_watch("{{vprotect}}", "This article has been protected", false, 1)','vprotect', '');
addlilink(talkm,'javascript:edit_summary_watch("{{deleted}}", "This article has been deleted", false, 1)','deleted', '');
addlilink(talkm,'javascript:edit_summary_watch("{{subst:unsigned|}}", "Adding unsigned template", false, 1)','unsigned', '');
}
if(document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1){ // AfD tabs
addlimenu(tabs, 'AfD close actions', 'afda');
var afda = document.getElementById('afda').getElementsByTagName('ul')[0];
addlilink(afda, 'javascript:closevfd("Delete", "")', 'Delete', '');
addlilink(afda, 'javascript:closevfd("Speedy Delete", "")', 'SD', '');
addlilink(afda, 'javascript:closevfd("Keep", "")', 'Keep', '');
addlilink(afda, 'javascript:closevfd("Keep (No consensus)", "")', 'Keep, NC', '');
addlilink(afda, 'javascript:closevfd("Merge and Redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'M&R', '');
addlilink(afda, 'javascript:closevfd("Redirect", " to [[" + prompt("Redirect to?") + "]]")', 'Redirect', '');
addlilink(afda, 'javascript:closevfd("Ttranswiki", " to " + prompt("Transwiki to?"))', 'Transwiki', '');
addlilink(afda, 'javascript:closevfd("Transwiki", " to Wiktionary")', 'WIKT', '');
addlilink(afda, 'javascript:closevfd(prompt("Result?"), "")', 'Other', '');
}
if(document.title.indexOf("Wikipedia:Articles for deletion") == 0){ //Add show/hide closed AfDs
addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
ta['ca-hide'] = ['', 'Hide closed AFDs'];
addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
ta['ca-show'] = ['', 'Show closed AFDs'];
}
if (document.title.indexOf("Editing User:" + username + "/Status") == 0){
addlimenu(tabs, 'Change my status', 'mystatus');
var mystatus = document.getElementById('mystatus').getElementsByTagName('ul')[0];
addlilink(mystatus, 'javascript:edit_status("online")', 'Online', '');
addlilink(mystatus, 'javascript:edit_status("away")', 'Away', '');
addlilink(mystatus, 'javascript:edit_status("busy")', 'Busy', '');
}
if (document.title.indexOf("Editing") != 0)
{
}
}
function closevfd(bold, notbold){
var form = document.editform;
var txt = form.wpTextbox1;
txt.value = "{{subst:at}} '''" + bold + "'''" + notbold + ". --~~~~\n" + txt.value + "\n{{subst:ab}}\n";
form.wpSummary.value = "Close discussion: " + bold + notbold;
form.wpWatchthis.checked = false;
}
//
addOnloadHook(Dfn_js_con)
function Dfn_js_con()
{
//moves
Mvaluejs_class = 'spork';
//edits
Rvaluejs_class = 'spork';
//uploads
Uvaluejs_class = 'spork';
}
//
/* </nowiki></pre> */
// Script from [[User:ais523/editcount.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:ais523/editcount.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// Script from [[User:Gimmetrow/replace.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Gimmetrow/replace.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');