From 08607adbd5a95ad57c28b7fce58806717c58f7ad Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Sun, 10 Apr 2011 16:55:43 +0000 Subject: [PATCH] Remove the loading of the MathJax library since it is performed in the view. --- static/plugin_dbui/src/appbase.js | 29 +----------------------- static/plugin_dbui/src/appgridmathjax.js | 10 ++++---- static/plugin_dbui/src/appmgr.js | 13 ++--------- 3 files changed, 7 insertions(+), 45 deletions(-) diff --git a/static/plugin_dbui/src/appbase.js b/static/plugin_dbui/src/appbase.js index b751343a..658d4587 100644 --- a/static/plugin_dbui/src/appbase.js +++ b/static/plugin_dbui/src/appbase.js @@ -19,18 +19,10 @@ Ext.namespace('App'); * Configuration option for all json stores */ -/** - * @cfg {Boolean} App.mathJax - * The path of the MathJax.js script. - * It is equal to undefined if it does not exist. - * This constants is defined by the server and should not be used directly. - * The plugin should be loaded with the function App.loadMathJax. - */ - /** * @param {String} App.version version of the library */ -App.version = '0.4.0' +App.version = '0.4.1' /** * Helper function mimicking the encode_field function running on the server @@ -119,22 +111,3 @@ App.isPlugin = function (component, ptype) { } return false; }; - -/** - * Helper function to load the MathJax library - * The loading is an asynchronous operation. - * When finished the function callback is executed. - * If the library is not there the callback is executed to. - * @param {Function} callback - * @param {Object} scope scope for the callback - */ -App.loadMathJax = function (callback, scope) { - - if (App.mathJax) { - Ext.Loader.load([App.mathJax], callback, scope); - - } else { - callback.call(scope); - } -}; - diff --git a/static/plugin_dbui/src/appgridmathjax.js b/static/plugin_dbui/src/appgridmathjax.js index c94647f7..d91220ec 100644 --- a/static/plugin_dbui/src/appgridmathjax.js +++ b/static/plugin_dbui/src/appgridmathjax.js @@ -13,14 +13,12 @@ App.grid.MathJax = Ext.extend(Object, { init: function (grid) { - function processMath() { - MathJax.Hub.PreProcess(); - MathJax.Hub.Process(); + function processMath(gridView) { + var domEl = Ext.getDom(gridView.el); + MathJax.Hub.Queue(["Typeset",MathJax.Hub, domEl]); } - // NOTE: in some case mathJax error appears on the first rendering - // Adding a delay of 0.1 s seems to fixed this problem - grid.getView().on('refresh', processMath, grid, {delay: 100}); + grid.getView().on('refresh', processMath, grid); } }); diff --git a/static/plugin_dbui/src/appmgr.js b/static/plugin_dbui/src/appmgr.js index 9cbc5ac7..42be7cc1 100644 --- a/static/plugin_dbui/src/appmgr.js +++ b/static/plugin_dbui/src/appmgr.js @@ -27,18 +27,9 @@ App.Mgr = Ext.extend(Object, { constructor: function (config) { Ext.apply(this, config); App.Mgr.superclass.constructor.apply(this); - - // If the MathJax library is required load it - App.loadMathJax(this.configure, this); + Dbui.getViewport(this.launch, this); }, - - /** - * Callback function to get the viewport configuration from the server - */ - configure: function () { - Dbui.getViewport(this.launch, this); - }, - + /** * Call back function to launch the application. * -- GitLab