JSHint: Fix var statement and global scope issues.

Change-Id: Ia567d10b72f86963eb344cd5579738532531d3d9
This commit is contained in:
Timo Tijhof 2013-02-06 20:14:02 -08:00
parent 8a29221a83
commit 282960c4ba
1 changed files with 76 additions and 72 deletions

View File

@ -1,7 +1,8 @@
/** /**
* From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js * From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js
*/ */
/*global mathJax:true, MathJax, wikEd:true */
( function ( mw, $ ) {
if ( typeof mathJax === 'undefined' ) { if ( typeof mathJax === 'undefined' ) {
mathJax = {}; mathJax = {};
} }
@ -20,17 +21,18 @@ mathJax.Config = function() {
menuSettings: { zoom: 'Click' }, menuSettings: { zoom: 'Click' },
'HTML-CSS': { imageFont: null, availableFonts: ['TeX'] } 'HTML-CSS': { imageFont: null, availableFonts: ['TeX'] }
}); });
MathJax.OutputJax.fontDir = mathJax.fontDir = mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; MathJax.OutputJax.fontDir = mathJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts';
}; };
mathJax.Load = function(element) { mathJax.Load = function(element) {
var config, script;
if (this.loaded) { if (this.loaded) {
return true; return true;
} }
// create configuration element // create configuration element
var config = 'mathJax.Config();'; config = 'mathJax.Config();';
var script = document.createElement( 'script' ); script = document.createElement( 'script' );
script.setAttribute( 'type', 'text/x-mathjax-config' ); script.setAttribute( 'type', 'text/x-mathjax-config' );
if ( window.opera ) { if ( window.opera ) {
script.innerHTML = config; script.innerHTML = config;
@ -78,6 +80,8 @@ mathJax.Init = function() {
}; };
}; };
jQuery( document ).ready( function() { $( document ).ready( function() {
mathJax.Init(); mathJax.Init();
} ); } );
}( mediaWiki, jQuery ) );