User:Mike Dillon/monobook.js
Jump to navigation
Jump to search
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. You may create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
This JavaScript is executed for Mike Dillon on every page load, when User:Mike Dillon is using the Monobook skin.
function buildRawUrl(page, ctype, options) {
if (!options) options = {};
var server = '';
if (options.server) {
server = "http://" + options.server;
}
var url = server + wgScriptPath
+ '/index.php?title='
+ encodeURIComponent( page.replace( / /g, '_' ) )
+ '&action=raw&ctype=' + ctype;
var keys = [ "oldid", "smaxage", "maxage" ];
for (var n in keys) {
if (options[keys[n]]) {
url += "&" + keys[n] + "=" + encodeURIComponent(options[keys[n]]);
}
}
return url;
}
function importScript( page, options ) {
if (!options) options = {};
var key = options.server ? (options.server + page) : page;
if( importedScripts[key] ) {
return;
}
importedScripts[key] = true;
var url = buildRawUrl(page, 'text/javascript', options);
var scriptElem = document.createElement( 'script' );
scriptElem.setAttribute( 'src' , url );
scriptElem.setAttribute( 'type' , 'text/javascript' );
document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}
function importStylesheet( page, options ) {
var url = buildRawUrl(page, 'text/css', options);
var sheet = '@import "' + url + '";';
var styleElem = document.createElement( 'style' );
styleElem.setAttribute( 'type' , 'text/css' );
styleElem.appendChild( document.createTextNode( sheet ) );
document.getElementsByTagName( 'head' )[0].appendChild( styleElem );
}
// Libraries
importScript('User:Mike Dillon/Scripts/i18n.js');
importScript('User:Mike Dillon/Scripts/easydom.js');
importScript('User:Mike Dillon/Scripts/cookies.js');
importScript('User:Mike Dillon/Scripts/params.js');
importScript('User:Mike Dillon/Scripts/langnames.js');
// Modules
var pageHistoryCookieItemCount = 20;
importScript('User:Mike Dillon/Scripts/recentpages.js');
importScript('User:Mike Dillon/Scripts/ancientGreekSortKey.js');
importScript('User:Mike Dillon/Scripts/searchNewWindow.js');
importScript('User:Mike Dillon/Scripts/highlightNonIPA.js');
importScript('User:Mike Dillon/Scripts/convert-kanjitab.js');
importScript('User:Mike Dillon/Scripts/convert-svtopics.js');
importScript('User:Mike Dillon/Scripts/topicCats.js');