From 8a29221a8359ab2754dcbb493500b550f710e1d5 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 6 Feb 2013 20:08:22 -0800 Subject: [PATCH] JSHint: Fix curly braces. Change-Id: Ib59ab38b2c3d9270d882798242e796b823206a50 --- modules/ext.math.mathjax.enabler.js | 39 ++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index b6ace4844..133a83a08 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -2,7 +2,9 @@ * From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js */ -if ( typeof mathJax === 'undefined' ) mathJax = {}; +if ( typeof mathJax === 'undefined' ) { + mathJax = {}; +} mathJax.version = '0.2'; @@ -22,14 +24,19 @@ mathJax.Config = function() { }; mathJax.Load = function(element) { - if (this.loaded) + if (this.loaded) { return true; + } // create configuration element var config = 'mathJax.Config();'; var script = document.createElement( 'script' ); 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 ); // create startup element @@ -44,16 +51,30 @@ mathJax.Init = function() { this.Load( document.getElementById('bodyContent') || document.body ); // compatibility with wikEd - if ( typeof(wikEd) == 'undefined' ) { wikEd = {}; } - 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']); } ); + if ( typeof(wikEd) == 'undefined' ) { + wikEd = {}; + } + 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 this.oldAjaxPreviewExec = window.ajaxPreviewExec; window.ajaxPreviewExec = function(previewArea) { - if ( typeof(mathJax.oldAjaxPreviewExec) !== 'undefined' ) mathJax.oldAjaxPreviewExec(previewArea); - if ( mathJax.Load(previewArea) ) MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] ); + if ( typeof(mathJax.oldAjaxPreviewExec) !== 'undefined' ) { + mathJax.oldAjaxPreviewExec(previewArea); + } + if ( mathJax.Load(previewArea) ) { + MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] ); + } }; };