Skip to content

Commit 1dfb478

Browse files
committed
Fix typesetting after like and bump to v1.0.1
1 parent 61123b2 commit 1dfb478

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

_files/js/inforge/bbmath/mathjax-loader.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ window.MathJax = {
2525
document.head.appendChild(script);
2626
})();
2727

28-
function retypesetMathjax(post)
28+
var retypesetDisabled = false;
29+
30+
function retypesetMathjax()
2931
{
30-
$(post).off('DOMSubtreeModified', postModifiedHandler);
32+
$(this).off('DOMSubtreeModified', retypesetMathjax);
33+
if (retypesetDisabled) {
34+
setTimeout(retypesetMathjax, 500);
35+
return;
36+
}
37+
retypesetDisabled = true;
38+
$(this).on('DOMSubtreeModified', retypesetMathjax);
3139
window.MathJax.typesetPromise().then(() => {
32-
$(post).on('DOMSubtreeModified', postModifiedHandler);
40+
retypesetDisabled = false;
3341
}).catch((err) => console.log(err.message));
3442
}
3543

36-
function postModifiedHandler()
37-
{
38-
retypesetMathjax(this);
39-
}
40-
4144
$(window).on('load', function() {
4245
$('article.message, article.resourceBody-main, blockquote.message-body').each(function() {
43-
$(this).on('DOMSubtreeModified', postModifiedHandler);
46+
$(this).on('DOMSubtreeModified', retypesetMathjax);
4447
});
4548
});

addon.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"legacy_addon_id": "",
33
"title": "[Inforge] BbMath",
44
"description": "Add BBCode to support equations and inline math.",
5-
"version_id": 1000070,
6-
"version_string": "1.0.0",
5+
"version_id": 1000170,
6+
"version_string": "1.0.1",
77
"dev": "Inforge",
88
"dev_url": "https://www.inforge.net",
99
"faq_url": "https://github.com/InforgeNet/BbMath/wiki/Frequently-Asked-Questions",

0 commit comments

Comments
 (0)