User:Covington/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 can be added at User:Covington/monobook.css. |
/* <pre><nowiki> */
function addForceSummary()
{
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
}
function forceSummary()
{
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
{
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
$(addForceSummary);
/* </nowiki></pre> */
//<pre><nowiki>
// Add time to your monobook "personal menu" list at the very top of the page.
// Created by [[User:Mathwiz2020]]
//
// Indicate where you would like the time to appear:
// pt-userpage, pt-mytalk, pt-preferences,
// pt-watchlist, pt-mycontris, pt-logout
//
gsTimeInsertBefore = ''; // leave blank to append after "logout"
//
function makeTime()
{
var li = document.createElement( 'li' );
li.id = 'pt-time';
var mySpan = document.createElement( 'span' );
mySpan.appendChild( document.createTextNode( '00:00:00' ) );
li.appendChild( mySpan );
if ( ! gsTimeInsertBefore ) { // append to end (right) of list
document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
}
else {
var before = document.getElementById( gsTimeInsertBefore );
before.appendChild( li, before );
}
doTime = window.setTimeout("getTime()", 1000);
}
$( makeTime );
function getTime()
{
var time = new Date();
var hours = time.getUTCHours();
if (hours < 10) { hours = "0" + hours; }
var minutes = time.getUTCMinutes();
if (minutes < 10) { minutes = "0" + minutes; }
var seconds = time.getUTCSeconds();
if (seconds < 10) { seconds = "0" + seconds; }
var currentTime = hours + ":" + minutes + ":" + seconds;
document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 8, currentTime);
doTime = window.setTimeout("getTime()", 1000);
}
//</nowiki></pre>
// <pre><nowiki>
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
// </nowiki></pre>
//Please leave the following line
//[[user:Where/usertabs]]
addOnloadHook(function() {
if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
return;
}
if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {
username_a = document.URL.match(/:.*:(.*)/);
username=username_a[1];
addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");
addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");
addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");
addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");
}
});
/// <pre><nowiki>
// Inspired by (borrowed from) Mathwiz2020's monobook.js script includer
function winc(s) {
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:Interiot/Tool2/code.js') // Backup Counter by Interiot
winc('User:Lupin/recent2.js') // Recent Tools RSS by Lupin
winc('User:Lupin/popups.js'); // Popups by Lupin
winc('User:VoA/monobook.js'); // Admin-like RC Patrol Tools by VoA
// </nowiki></pre>