User:Mike Dillon/monobook.js

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');