Skip to content

Commit

Permalink
Fix typesetting after like and bump to v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeedJack committed Mar 25, 2021
1 parent 61123b2 commit 1dfb478
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions _files/js/inforge/bbmath/mathjax-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ window.MathJax = {
document.head.appendChild(script);
})();

function retypesetMathjax(post)
var retypesetDisabled = false;

function retypesetMathjax()
{
$(post).off('DOMSubtreeModified', postModifiedHandler);
$(this).off('DOMSubtreeModified', retypesetMathjax);
if (retypesetDisabled) {
setTimeout(retypesetMathjax, 500);
return;
}
retypesetDisabled = true;
$(this).on('DOMSubtreeModified', retypesetMathjax);
window.MathJax.typesetPromise().then(() => {
$(post).on('DOMSubtreeModified', postModifiedHandler);
retypesetDisabled = false;
}).catch((err) => console.log(err.message));
}

function postModifiedHandler()
{
retypesetMathjax(this);
}

$(window).on('load', function() {
$('article.message, article.resourceBody-main, blockquote.message-body').each(function() {
$(this).on('DOMSubtreeModified', postModifiedHandler);
$(this).on('DOMSubtreeModified', retypesetMathjax);
});
});
4 changes: 2 additions & 2 deletions addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"legacy_addon_id": "",
"title": "[Inforge] BbMath",
"description": "Add BBCode to support equations and inline math.",
"version_id": 1000070,
"version_string": "1.0.0",
"version_id": 1000170,
"version_string": "1.0.1",
"dev": "Inforge",
"dev_url": "https://www.inforge.net",
"faq_url": "https://github.com/InforgeNet/BbMath/wiki/Frequently-Asked-Questions",
Expand Down

0 comments on commit 1dfb478

Please sign in to comment.