diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6526622..5d6d4b3b0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.13 +**v1.11.13.2** *(2015-10-18)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.2/builds/4chan-X-noupdate.crx "Chromium version")] +- Merge v1.11.12.8: Update to support MathJax on /sci/. +- Gallery bugfixes. + **v1.11.13.1** *(2015-10-16)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.1/builds/4chan-X-noupdate.crx "Chromium version")] - HTML/CSS tweaks for Mona font toggle button. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 2879f0d3b..febc2b494 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 2f73e6c12..ff1568b46 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.13.1 +// @version 1.11.13.2 // @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 912717b05..c22c9888d 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.13.1 +// @version 1.11.13.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -415,7 +415,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.1', + VERSION: '1.11.13.2', NAMESPACE: '4chan X.', boards: {} }; @@ -9960,6 +9960,7 @@ }, build: function(image) { var candidate, cb, dialog, entry, file, k, key, len1, len2, menuButton, nodes, post, q, ref, ref1, ref2, ref3, thumb, value; + cb = Gallery.cb; if (Conf['Fullscreen Gallery']) { $.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() { return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close); @@ -9997,7 +9998,6 @@ } menuButton = $('.menu-button', dialog); nodes.menu = new UI.Menu('gallery'); - cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); if (Conf['Mouse Wheel Volume']) { $.on(nodes.frame, 'wheel', Volume.wheel); @@ -10139,7 +10139,9 @@ if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { Header.scrollTo(post.nodes.root); } - return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + if (isNaN(oldID) || newID === (oldID + 1) % Gallery.images.length) { + return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + } }, error: function() { var ref; @@ -10326,9 +10328,17 @@ return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); }, setHeight: function() { - var current, dim, frame, height, ref, ref1, ref2, width; + var current, dim, frame, height, minHeight, ref, ref1, ref2, style, width; ref = Gallery.nodes, current = ref.current, frame = ref.frame; - return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null; + style = current.style; + if (Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0)) { + ref2 = dim.split('x'), width = ref2[0], height = ref2[1]; + minHeight = Math.min(doc.clientHeight - 25, height / width * frame.clientWidth); + style.minHeight = minHeight + 'px'; + return style.minWidth = (width / height * minHeight) + 'px'; + } else { + return style.minHeight = style.minWidth = null; + } }, setDelay: function() { return Gallery.delay = +this.value; @@ -15427,7 +15437,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 @@ -15463,18 +15473,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(); } }; @@ -18641,10 +18654,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" + @@ -20601,9 +20610,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 47082a58c..eee381f66 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 26c3cbb0d..29fcaca22 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.13.1 +// @version 1.11.13.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -415,7 +415,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.1', + VERSION: '1.11.13.2', NAMESPACE: '4chan X.', boards: {} }; @@ -9960,6 +9960,7 @@ }, build: function(image) { var candidate, cb, dialog, entry, file, k, key, len1, len2, menuButton, nodes, post, q, ref, ref1, ref2, ref3, thumb, value; + cb = Gallery.cb; if (Conf['Fullscreen Gallery']) { $.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() { return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close); @@ -9997,7 +9998,6 @@ } menuButton = $('.menu-button', dialog); nodes.menu = new UI.Menu('gallery'); - cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); if (Conf['Mouse Wheel Volume']) { $.on(nodes.frame, 'wheel', Volume.wheel); @@ -10139,7 +10139,9 @@ if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { Header.scrollTo(post.nodes.root); } - return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + if (isNaN(oldID) || newID === (oldID + 1) % Gallery.images.length) { + return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + } }, error: function() { var ref; @@ -10326,9 +10328,17 @@ return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); }, setHeight: function() { - var current, dim, frame, height, ref, ref1, ref2, width; + var current, dim, frame, height, minHeight, ref, ref1, ref2, style, width; ref = Gallery.nodes, current = ref.current, frame = ref.frame; - return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null; + style = current.style; + if (Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0)) { + ref2 = dim.split('x'), width = ref2[0], height = ref2[1]; + minHeight = Math.min(doc.clientHeight - 25, height / width * frame.clientWidth); + style.minHeight = minHeight + 'px'; + return style.minWidth = (width / height * minHeight) + 'px'; + } else { + return style.minHeight = style.minWidth = null; + } }, setDelay: function() { return Gallery.delay = +this.value; @@ -15427,7 +15437,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 @@ -15463,18 +15473,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(); } }; @@ -18641,10 +18654,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" + @@ -20601,9 +20610,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 b2d933131..4e3c16010 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 5c8988076..83d0d5735 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.13.1 +// @version 1.11.13.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 4d00da9d2..54ec0eec3 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.13.1 +// @version 1.11.13.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -415,7 +415,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.1', + VERSION: '1.11.13.2', NAMESPACE: '4chan X.', boards: {} }; @@ -9960,6 +9960,7 @@ }, build: function(image) { var candidate, cb, dialog, entry, file, k, key, len1, len2, menuButton, nodes, post, q, ref, ref1, ref2, ref3, thumb, value; + cb = Gallery.cb; if (Conf['Fullscreen Gallery']) { $.one(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', function() { return $.on(d, 'fullscreenchange mozfullscreenchange webkitfullscreenchange', cb.close); @@ -9997,7 +9998,6 @@ } menuButton = $('.menu-button', dialog); nodes.menu = new UI.Menu('gallery'); - cb = Gallery.cb; $.on(nodes.frame, 'click', cb.blank); if (Conf['Mouse Wheel Volume']) { $.on(nodes.frame, 'wheel', Volume.wheel); @@ -10139,7 +10139,9 @@ if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { Header.scrollTo(post.nodes.root); } - return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + if (isNaN(oldID) || newID === (oldID + 1) % Gallery.images.length) { + return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError); + } }, error: function() { var ref; @@ -10326,9 +10328,17 @@ return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); }, setHeight: function() { - var current, dim, frame, height, ref, ref1, ref2, width; + var current, dim, frame, height, minHeight, ref, ref1, ref2, style, width; ref = Gallery.nodes, current = ref.current, frame = ref.frame; - return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null; + style = current.style; + if (Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0)) { + ref2 = dim.split('x'), width = ref2[0], height = ref2[1]; + minHeight = Math.min(doc.clientHeight - 25, height / width * frame.clientWidth); + style.minHeight = minHeight + 'px'; + return style.minWidth = (width / height * minHeight) + 'px'; + } else { + return style.minHeight = style.minWidth = null; + } }, setDelay: function() { return Gallery.delay = +this.value; @@ -15427,7 +15437,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 @@ -15463,18 +15473,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(); } }; @@ -18641,10 +18654,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" + @@ -20601,9 +20610,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 7c842e387..7c0c8a45e 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 d5eb5ca23..7efe3bdf0 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 87b831cb2..88d3372b6 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index 06f7cbcfb..8686e15fc 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "meta": { "name": "4chan X", "fork": "ccd0", - "version": "1.11.13.1", - "date": "2015-10-17T03:43:21.599Z", + "version": "1.11.13.2", + "date": "2015-10-18T07:48:28.182Z", "page": "https://www.4chan-x.net/", "downloads": "https://www.4chan-x.net/builds/", "oldVersions": "https://raw.githubusercontent.com/ccd0/4chan-x/",