jsMath -> MathJax on /sci/.

This commit is contained in:
ccd0 2015-10-18 00:32:16 -07:00
parent 54f545e87b
commit bf9d380190
3 changed files with 19 additions and 19 deletions

View File

@ -302,10 +302,6 @@ audio.controls-added {
.current { .current {
font-weight: bold; font-weight: bold;
} }
:root.fixed.bottom-header #jsMath_button {
bottom: auto;
top: 1px;
}
@media (min-width: 1300px) { @media (min-width: 1300px) {
:root.fixed:not(.centered-links) #header-bar { :root.fixed:not(.centered-links) #header-bar {
white-space: nowrap; white-space: nowrap;

View File

@ -3,9 +3,6 @@
background-color: #282A2E; background-color: #282A2E;
border-color: #111; border-color: #111;
} }
:root.tomorrow img[src*="//boards.4chan.org/js/jsMath/fonts/"] {
filter: invert(100%);
}
/* Header */ /* Header */
:root.tomorrow #header-bar.dialog { :root.tomorrow #header-bar.dialog {

View File

@ -26,15 +26,18 @@ Fourchan =
if g.BOARD.ID is 'sci' if g.BOARD.ID is 'sci'
$.globalEval ''' $.globalEval '''
window.addEventListener('jsmath', function(e) { window.addEventListener('mathjax', function(e) {
if (!jsMath) return; if (window.MathJax) {
if (jsMath.loaded) { window.MathJax.Hub.Queue(function() {
// process one post if (!e.target.querySelector('.MathJax')) {
jsMath.ProcessBeforeShowing(e.target); window.MathJax.Hub.Typeset(e.target);
} else if (jsMath.Autoload && jsMath.Autoload.checked) { }
// load jsMath and process whole document });
jsMath.Autoload.Script.Push('ProcessBeforeShowing', [null]); } else {
jsMath.Autoload.LoadJsMath(); if (!document.querySelector('script[src^="//cdn.mathjax.org/"]')) {
window.loadMathJax();
window.loadMathJax = function() {};
}
} }
}, false); }, false);
''' '''
@ -66,6 +69,10 @@ Fourchan =
return return
math: -> math: ->
return if (@isClone and doc.contains @origin.nodes.root) or !$ '.math', @nodes.comment return unless /\[(math|eqn)\]/.test(@nodes.comment.textContent) or $('.math:not([id])', @nodes.comment)
$.asap (=> doc.contains @nodes.comment), => cb = =>
$.event 'jsmath', null, @nodes.comment return unless doc.contains @nodes.comment
$.off d, 'PostsInserted', cb
$.event 'mathjax', null, @nodes.comment
$.on d, 'PostsInserted', cb
cb()