MediaWiki:Gadget-catchcalc-boot.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/*
* Catch-calculator bootstrap (loads on every page, tiny).
* This Gadgets version can't scope a gadget to a page/category, so instead we
* ship this minimal loader sitewide and pull the heavy data + UI module
* (ext.gadget.catchcalc-app, ~80 KB) only on pages that actually contain the
* <div id="catch-calculator"> mount point.
*/
( function () {
'use strict';
function go() {
if ( !document.getElementById( 'catch-calculator' ) ) { return; }
mw.loader.using( [ 'ext.gadget.catchcalc-app' ] ).catch( function () {
var n = document.getElementById( 'catch-calculator' );
if ( n ) { n.textContent = 'Catch calculator failed to load.'; }
} );
}
if ( document.readyState !== 'loading' ) { go(); }
else { document.addEventListener( 'DOMContentLoaded', go ); }
}() );