MDL-48760 maths filters: Upgrade to mathjax 2.5
authorAdrian Greeve <adrian@moodle.com>
Thu, 12 Feb 2015 05:21:01 +0000 (13:21 +0800)
committerAdrian Greeve <adrian@moodle.com>
Fri, 13 Feb 2015 06:26:11 +0000 (14:26 +0800)
filter/mathjaxloader/db/upgrade.php
filter/mathjaxloader/settings.php
filter/mathjaxloader/upgrade.txt
filter/mathjaxloader/version.php
filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js
filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js
filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js
filter/mathjaxloader/yui/src/loader/js/loader.js

index acab499..bf7fedd 100644 (file)
@@ -47,5 +47,25 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
     // Moodle v2.8.0 release upgrade line.
     // Put any upgrade step following this.
 
+    // Moodle v2.9.0 release upgrade line.
+    // Put any upgrade step following this.
+
+    if ($oldversion < 2015021200) {
+
+        $httpurl = get_config('filter_mathjaxloader', 'httpurl');
+        // Don't change the config if it has been manually changed to something besides the default setting value.
+        if ($httpurl === "http://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js") {
+            set_config('httpurl', 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js', 'filter_mathjaxloader');
+        }
+
+        $httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
+        // Don't change the config if it has been manually changed to something besides the default setting value.
+        if ($httpsurl === "https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js") {
+            set_config('httpsurl', 'https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js', 'filter_mathjaxloader');
+        }
+
+        upgrade_plugin_savepoint(true, 2015021200, 'filter', 'mathjaxloader');
+    }
+
     return true;
 }
index 978587c..1ca7670 100644 (file)
@@ -33,14 +33,14 @@ if ($ADMIN->fulltree) {
     $item = new admin_setting_configtext('filter_mathjaxloader/httpurl',
                                          new lang_string('httpurl', 'filter_mathjaxloader'),
                                          new lang_string('httpurl_help', 'filter_mathjaxloader'),
-                                         'http://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js',
+                                         'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js',
                                          PARAM_RAW);
     $settings->add($item);
 
     $item = new admin_setting_configtext('filter_mathjaxloader/httpsurl',
                                          new lang_string('httpsurl', 'filter_mathjaxloader'),
                                          new lang_string('httpsurl_help', 'filter_mathjaxloader'),
-                                         'https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js',
+                                         'https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js',
                                          PARAM_RAW);
     $settings->add($item);
 
index ca95016..87db75e 100644 (file)
@@ -1,3 +1,14 @@
+=== 2.9 ===
+
+* Update to the latest version of MathJax setting "httpurl" and "httpsurl" to:
+  http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js
+
+  and
+
+  https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js
+
+=== Before 2.9 ===
+
 Setting "httpsurl" default changed from:
 
 https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/MathJax.js
index b825781..21e2f19 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version  = 2014111000;
+$plugin->version  = 2015021200;
 $plugin->requires = 2014110400;  // Requires this Moodle version
 $plugin->component= 'filter_mathjaxloader';
index 11b4a9d..83b6d8d 100644 (file)
Binary files a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js and b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js differ
index ccebf0c..809018e 100644 (file)
Binary files a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js and b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js differ
index 11b4a9d..83b6d8d 100644 (file)
Binary files a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js and b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js differ
index aad01b3..835a864 100644 (file)
@@ -111,14 +111,20 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
     contentUpdated: function(event) {
         var self = this;
         Y.use('mathjax', function() {
+            if (typeof window.MathJax === "undefined") {
+                return;
+            }
+            var processdelay = window.MathJax.Hub.processSectionDelay;
+            // Set the process section delay to 0 when updating the formula.
+            window.MathJax.Hub.processSectionDelay = 0;
             self._setLocale();
             event.nodes.each(function (node) {
                 node.all('.filter_mathjaxloader_equation').each(function(node) {
-                    if (typeof window.MathJax !== "undefined") {
-                        window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]);
-                    }
+                    window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]);
                 });
             });
+            // Set the delay back to normal after processing.
+            window.MathJax.Hub.processSectionDelay = processdelay;
         });
     }
 };