TheDJ has uploaded a new change for review.
https://gerrit.wikimedia.org/r/124064
Change subject: MathJax: Listen for wikipage.content hook
......................................................................
MathJax: Listen for wikipage.content hook
This brings us one step closer to solving the JS rendering bug. The
remaining issue is how to know that the enabler script needs to be
loaded.
Bug: 36060
Change-Id: I9cbd032afaf90a735c92f055c2bf82766e9acbe0
---
M modules/ext.math.mathjax.enabler.js
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math
refs/changes/64/124064/1
diff --git a/modules/ext.math.mathjax.enabler.js
b/modules/ext.math.mathjax.enabler.js
index 77cc425..1fc03c0 100644
--- a/modules/ext.math.mathjax.enabler.js
+++ b/modules/ext.math.mathjax.enabler.js
@@ -200,14 +200,16 @@
* @param {function} callback to be executed after text elements have
rendered [optional]
*/
$.fn.renderTex = function ( callback ) {
- var elem = this.find( '.tex' ).parent().toArray();
+ mw.log( 'Use of renderTex() is deprecated. Hook into wikipage.content
instead' );
+ mathJax.renderTex( this );
+ return this;
+ }
- if ( !$.isFunction( callback ) ) {
- callback = $.noop;
- }
+ mathJax.renderTex = function ( $content ) {
+ var elem = $content.find( '.tex' ).parent().toArray();
function render () {
- MathJax.Hub.Queue( ['Typeset', MathJax.Hub, elem, callback] );
+ MathJax.Hub.Queue( ['Typeset', MathJax.Hub, elem] );
}
mw.loader.using( 'ext.math.mathjax.mathjax', function () {
@@ -217,7 +219,6 @@
MathJax.Hub.Startup.signal.MessageHook( 'End', render );
}
} );
- return this;
};
mathJax.Load = function () {
@@ -243,4 +244,6 @@
mathJax.Load();
} );
+ mw.hook( 'wikipage.content' ).add( mathJax.renderTex );
+
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/124064
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cbd032afaf90a735c92f055c2bf82766e9acbe0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: TheDJ <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits