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,16 +1,17 @@
/**
* From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js
*/
if ( typeof mathJax === 'undefined' ) {
/*global mathJax:true, MathJax, wikEd:true */
( function ( mw, $ ) {
if ( typeof mathJax === 'undefined' ) {
mathJax = {};
}
}
mathJax.version = '0.2';
mathJax.version = '0.2';
mathJax.loaded = false;
mathJax.loaded = false;
mathJax.Config = function() {
mathJax.Config = function() {
MathJax.Hub.Config({
root: mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax',
config: ['TeX-AMS-texvc_HTML.js'],
@ -20,17 +21,18 @@ mathJax.Config = function() {
menuSettings: { zoom: 'Click' },
'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) {
return true;
}
// create configuration element
var config = 'mathJax.Config();';
var script = document.createElement( 'script' );
config = 'mathJax.Config();';
script = document.createElement( 'script' );
script.setAttribute( 'type', 'text/x-mathjax-config' );
if ( window.opera ) {
script.innerHTML = config;
@ -45,9 +47,9 @@ mathJax.Load = function(element) {
this.loaded = true;
return false;
};
};
mathJax.Init = function() {
mathJax.Init = function() {
this.Load( document.getElementById('bodyContent') || document.body );
// compatibility with wikEd
@ -76,8 +78,10 @@ mathJax.Init = function() {
MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] );
}
};
};
};
jQuery( document ).ready( function() {
$( document ).ready( function() {
mathJax.Init();
} );
} );
}( mediaWiki, jQuery ) );