JSHint: Fix curly braces.

Change-Id: Ib59ab38b2c3d9270d882798242e796b823206a50
This commit is contained in:
Timo Tijhof 2013-02-06 20:08:22 -08:00
parent ca6a896cb0
commit 8a29221a83

View File

@ -2,7 +2,9 @@
* From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js * From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js
*/ */
if ( typeof mathJax === 'undefined' ) mathJax = {}; if ( typeof mathJax === 'undefined' ) {
mathJax = {};
}
mathJax.version = '0.2'; mathJax.version = '0.2';
@ -22,14 +24,19 @@ mathJax.Config = function() {
}; };
mathJax.Load = function(element) { mathJax.Load = function(element) {
if (this.loaded) if (this.loaded) {
return true; return true;
}
// create configuration element // create configuration element
var config = 'mathJax.Config();'; var config = 'mathJax.Config();';
var script = document.createElement( 'script' ); var script = document.createElement( 'script' );
script.setAttribute( 'type', 'text/x-mathjax-config' ); script.setAttribute( 'type', 'text/x-mathjax-config' );
if ( window.opera ) script.innerHTML = config; else script.text = config; if ( window.opera ) {
script.innerHTML = config;
} else {
script.text = config;
}
document.getElementsByTagName('head')[0].appendChild( script ); document.getElementsByTagName('head')[0].appendChild( script );
// create startup element // create startup element
@ -44,16 +51,30 @@ mathJax.Init = function() {
this.Load( document.getElementById('bodyContent') || document.body ); this.Load( document.getElementById('bodyContent') || document.body );
// compatibility with wikEd // compatibility with wikEd
if ( typeof(wikEd) == 'undefined' ) { wikEd = {}; } if ( typeof(wikEd) == 'undefined' ) {
if ( typeof(wikEd.config) == 'undefined' ) { wikEd.config = {}; } wikEd = {};
if ( typeof(wikEd.config.previewHook) == 'undefined' ) { wikEd.config.previewHook = []; } }
wikEd.config.previewHook.push( function(){ if (window.mathJax.Load(document.getElementById('wikEdPreviewBox') || document.body)) MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'wikEdPreviewBox']); } ); if ( typeof(wikEd.config) == 'undefined' ) {
wikEd.config = {};
}
if ( typeof(wikEd.config.previewHook) == 'undefined' ) {
wikEd.config.previewHook = [];
}
wikEd.config.previewHook.push( function(){
if (window.mathJax.Load(document.getElementById('wikEdPreviewBox') || document.body)) {
MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'wikEdPreviewBox']);
}
} );
// compatibility with ajaxPreview // compatibility with ajaxPreview
this.oldAjaxPreviewExec = window.ajaxPreviewExec; this.oldAjaxPreviewExec = window.ajaxPreviewExec;
window.ajaxPreviewExec = function(previewArea) { window.ajaxPreviewExec = function(previewArea) {
if ( typeof(mathJax.oldAjaxPreviewExec) !== 'undefined' ) mathJax.oldAjaxPreviewExec(previewArea); if ( typeof(mathJax.oldAjaxPreviewExec) !== 'undefined' ) {
if ( mathJax.Load(previewArea) ) MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] ); mathJax.oldAjaxPreviewExec(previewArea);
}
if ( mathJax.Load(previewArea) ) {
MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] );
}
}; };
}; };