diff --git a/CHANGELOG.md b/CHANGELOG.md index baa0860ea..0e6d8c6c2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.12 +**v1.11.12.8** *(2015-10-18)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.12.8/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.12.8/builds/4chan-X-noupdate.crx "Chromium version")] +- Update to support MathJax on /sci/. + **v1.11.12.7** *(2015-10-13)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.12.7/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.12.7/builds/4chan-X-noupdate.crx "Chromium version")] - Add keybind for `[sjis]` tags (default: `Alt+a`). - Update max comment length on /jp/ (now 5000, read from board). diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 8a02c2b29..ab6916bbc 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 2504291f1..61dcb0a2c 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.11.12.7 +// @version 1.11.12.8 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 27080a9ef..19e22f54c 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.11.12.7 +// @version 1.11.12.8 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -414,7 +414,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.12.7', + VERSION: '1.11.12.8', NAMESPACE: '4chan X.', boards: {} }; @@ -15415,7 +15415,7 @@ }); } if (g.BOARD.ID === 'sci') { - $.globalEval('window.addEventListener(\'jsmath\', function(e) {\n if (!jsMath) return;\n if (jsMath.loaded) {\n // process one post\n jsMath.ProcessBeforeShowing(e.target);\n } else if (jsMath.Autoload && jsMath.Autoload.checked) {\n // load jsMath and process whole document\n jsMath.Autoload.Script.Push(\'ProcessBeforeShowing\', [null]);\n jsMath.Autoload.LoadJsMath();\n }\n}, false);'); + $.globalEval('window.addEventListener(\'mathjax\', function(e) {\n if (window.MathJax) {\n window.MathJax.Hub.Queue(function() {\n if (!e.target.querySelector(\'.MathJax\')) {\n window.MathJax.Hub.Typeset(e.target);\n }\n });\n } else {\n if (!document.querySelector(\'script[src^="//cdn.mathjax.org/"]\')) {\n window.loadMathJax();\n window.loadMathJax = function() {};\n }\n }\n}, false);'); Post.callbacks.push({ name: 'Parse /sci/ math', cb: this.math @@ -15451,18 +15451,21 @@ })(this)); }, math: function() { - if ((this.isClone && doc.contains(this.origin.nodes.root)) || !$('.math', this.nodes.comment)) { + var cb; + if (!(/\[(math|eqn)\]/.test(this.nodes.comment.textContent) || $('.math:not([id])', this.nodes.comment))) { return; } - return $.asap(((function(_this) { + cb = (function(_this) { return function() { - return doc.contains(_this.nodes.comment); + if (!doc.contains(_this.nodes.comment)) { + return; + } + $.off(d, 'PostsInserted', cb); + return $.event('mathjax', null, _this.nodes.comment); }; - })(this)), (function(_this) { - return function() { - return $.event('jsmath', null, _this.nodes.comment); - }; - })(this)); + })(this); + $.on(d, 'PostsInserted', cb); + return cb(); } }; @@ -18629,10 +18632,6 @@ ".current {\n" + " font-weight: bold;\n" + "}\n" + -":root.fixed.bottom-header #jsMath_button {\n" + -" bottom: auto;\n" + -" top: 1px;\n" + -"}\n" + "@media (min-width: 1300px) {\n" + " :root.fixed:not(.centered-links) #header-bar {\n" + " white-space: nowrap;\n" + @@ -20570,9 +20569,6 @@ " background-color: #282A2E;\n" + " border-color: #111;\n" + "}\n" + -":root.tomorrow img[src*=\"//boards.4chan.org/js/jsMath/fonts/\"] {\n" + -" filter: invert(100%);\n" + -"}\n" + "/* Header */\n" + ":root.tomorrow #header-bar.dialog {\n" + " background-color: rgba(40,42,46,0.9);\n" + diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index ab1e36ce8..5cd1b008b 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 474b56b45..1532b1a3e 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.12.7 +// @version 1.11.12.8 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -414,7 +414,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.12.7', + VERSION: '1.11.12.8', NAMESPACE: '4chan X.', boards: {} }; @@ -15415,7 +15415,7 @@ }); } if (g.BOARD.ID === 'sci') { - $.globalEval('window.addEventListener(\'jsmath\', function(e) {\n if (!jsMath) return;\n if (jsMath.loaded) {\n // process one post\n jsMath.ProcessBeforeShowing(e.target);\n } else if (jsMath.Autoload && jsMath.Autoload.checked) {\n // load jsMath and process whole document\n jsMath.Autoload.Script.Push(\'ProcessBeforeShowing\', [null]);\n jsMath.Autoload.LoadJsMath();\n }\n}, false);'); + $.globalEval('window.addEventListener(\'mathjax\', function(e) {\n if (window.MathJax) {\n window.MathJax.Hub.Queue(function() {\n if (!e.target.querySelector(\'.MathJax\')) {\n window.MathJax.Hub.Typeset(e.target);\n }\n });\n } else {\n if (!document.querySelector(\'script[src^="//cdn.mathjax.org/"]\')) {\n window.loadMathJax();\n window.loadMathJax = function() {};\n }\n }\n}, false);'); Post.callbacks.push({ name: 'Parse /sci/ math', cb: this.math @@ -15451,18 +15451,21 @@ })(this)); }, math: function() { - if ((this.isClone && doc.contains(this.origin.nodes.root)) || !$('.math', this.nodes.comment)) { + var cb; + if (!(/\[(math|eqn)\]/.test(this.nodes.comment.textContent) || $('.math:not([id])', this.nodes.comment))) { return; } - return $.asap(((function(_this) { + cb = (function(_this) { return function() { - return doc.contains(_this.nodes.comment); + if (!doc.contains(_this.nodes.comment)) { + return; + } + $.off(d, 'PostsInserted', cb); + return $.event('mathjax', null, _this.nodes.comment); }; - })(this)), (function(_this) { - return function() { - return $.event('jsmath', null, _this.nodes.comment); - }; - })(this)); + })(this); + $.on(d, 'PostsInserted', cb); + return cb(); } }; @@ -18629,10 +18632,6 @@ ".current {\n" + " font-weight: bold;\n" + "}\n" + -":root.fixed.bottom-header #jsMath_button {\n" + -" bottom: auto;\n" + -" top: 1px;\n" + -"}\n" + "@media (min-width: 1300px) {\n" + " :root.fixed:not(.centered-links) #header-bar {\n" + " white-space: nowrap;\n" + @@ -20570,9 +20569,6 @@ " background-color: #282A2E;\n" + " border-color: #111;\n" + "}\n" + -":root.tomorrow img[src*=\"//boards.4chan.org/js/jsMath/fonts/\"] {\n" + -" filter: invert(100%);\n" + -"}\n" + "/* Header */\n" + ":root.tomorrow #header-bar.dialog {\n" + " background-color: rgba(40,42,46,0.9);\n" + diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 5e003b7e9..2a6c85840 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index b82e27011..f4bd6c624 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.12.7 +// @version 1.11.12.8 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 18c1fa8e8..3010487f1 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.12.7 +// @version 1.11.12.8 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -414,7 +414,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.12.7', + VERSION: '1.11.12.8', NAMESPACE: '4chan X.', boards: {} }; @@ -15415,7 +15415,7 @@ }); } if (g.BOARD.ID === 'sci') { - $.globalEval('window.addEventListener(\'jsmath\', function(e) {\n if (!jsMath) return;\n if (jsMath.loaded) {\n // process one post\n jsMath.ProcessBeforeShowing(e.target);\n } else if (jsMath.Autoload && jsMath.Autoload.checked) {\n // load jsMath and process whole document\n jsMath.Autoload.Script.Push(\'ProcessBeforeShowing\', [null]);\n jsMath.Autoload.LoadJsMath();\n }\n}, false);'); + $.globalEval('window.addEventListener(\'mathjax\', function(e) {\n if (window.MathJax) {\n window.MathJax.Hub.Queue(function() {\n if (!e.target.querySelector(\'.MathJax\')) {\n window.MathJax.Hub.Typeset(e.target);\n }\n });\n } else {\n if (!document.querySelector(\'script[src^="//cdn.mathjax.org/"]\')) {\n window.loadMathJax();\n window.loadMathJax = function() {};\n }\n }\n}, false);'); Post.callbacks.push({ name: 'Parse /sci/ math', cb: this.math @@ -15451,18 +15451,21 @@ })(this)); }, math: function() { - if ((this.isClone && doc.contains(this.origin.nodes.root)) || !$('.math', this.nodes.comment)) { + var cb; + if (!(/\[(math|eqn)\]/.test(this.nodes.comment.textContent) || $('.math:not([id])', this.nodes.comment))) { return; } - return $.asap(((function(_this) { + cb = (function(_this) { return function() { - return doc.contains(_this.nodes.comment); + if (!doc.contains(_this.nodes.comment)) { + return; + } + $.off(d, 'PostsInserted', cb); + return $.event('mathjax', null, _this.nodes.comment); }; - })(this)), (function(_this) { - return function() { - return $.event('jsmath', null, _this.nodes.comment); - }; - })(this)); + })(this); + $.on(d, 'PostsInserted', cb); + return cb(); } }; @@ -18629,10 +18632,6 @@ ".current {\n" + " font-weight: bold;\n" + "}\n" + -":root.fixed.bottom-header #jsMath_button {\n" + -" bottom: auto;\n" + -" top: 1px;\n" + -"}\n" + "@media (min-width: 1300px) {\n" + " :root.fixed:not(.centered-links) #header-bar {\n" + " white-space: nowrap;\n" + @@ -20570,9 +20569,6 @@ " background-color: #282A2E;\n" + " border-color: #111;\n" + "}\n" + -":root.tomorrow img[src*=\"//boards.4chan.org/js/jsMath/fonts/\"] {\n" + -" filter: invert(100%);\n" + -"}\n" + "/* Header */\n" + ":root.tomorrow #header-bar.dialog {\n" + " background-color: rgba(40,42,46,0.9);\n" + diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 9cc4ef2d2..08ed57338 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index 401c849a4..ee5ad9b38 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index b9898399e..6eaf902c1 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index d758bd551..9e7520e4c 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "meta": { "name": "4chan X", "fork": "ccd0", - "version": "1.11.12.7", - "date": "2015-10-14T02:20:26.038Z", + "version": "1.11.12.8", + "date": "2015-10-18T07:39:28.149Z", "page": "https://www.4chan-x.net/", "downloads": "https://www.4chan-x.net/builds/", "oldVersions": "https://raw.githubusercontent.com/ccd0/4chan-x/",