diff --git a/CHANGELOG.md b/CHANGELOG.md index 815a2d98a..8f04c17b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +MayhemYDG: +- Fix whitespaces not being preserved in code tags in /g/. + ### 1.1.11 - 2013-05-04 seaweedchan: - Add `Highlight Posts Quoting You` option @@ -67,18 +70,6 @@ seaweedchan: - Toggle keybind for header auto-hiding MayhemYDG: -======= - - Access it in the `QR` tab of the Settings window. -- Updated archive redirection for /h/, /v/ and /vg/. - -### 3.2.3 - *2013-04-30* - -- Update archive redirection for /c/, /d/, /v/, /vg/, /w/ and /wg/. -- Minor fixes. - -### 3.2.2 - *2013-04-27* - ->>>>>>> b74e0c92fdf2d755d996cb574dddb3c8d964e91a - Fix Unread Count taking into account hidden posts. ### 1.1.2 - 2013-04-26 diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 1fe73dc33..7ff0e4c2a 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -7338,7 +7338,10 @@ }); $.on(d, '4chanXInitFinished', Unread.ready); $.on(d, 'ThreadUpdate', Unread.onUpdate); - return $.on(d, 'scroll visibilitychange', Unread.read); + $.on(d, 'scroll visibilitychange', Unread.read); + if (Conf['Unread Line']) { + return $.on(d, 'visibilitychange', Unread.setLine); + } }, ready: function() { var ID, post, posts, _ref; @@ -7353,12 +7356,7 @@ } } Unread.addPosts(posts); - if (Conf['Unread Line']) { - Unread.setLine(); - } - if (Conf['Scroll to Last Read Post']) { - return Unread.scroll(); - } + return Unread.scroll(); }, scroll: function() { var hash, post, posts, prevID, root; @@ -8347,7 +8345,7 @@ } board = g.BOARD.ID; if (board === 'g') { - $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML);\n}, false);"); + $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML.replace(/\\s/g, ' '));\n}, false);"); Post.prototype.callbacks.push({ name: 'Parse /g/ code', cb: this.code @@ -8370,7 +8368,9 @@ _ref = $$('.prettyprint', this.nodes.comment); for (_i = 0, _len = _ref.length; _i < _len; _i++) { pre = _ref[_i]; - $.event('prettyprint', pre, window); + if (!$('.pln', pre)) { + $.event('prettyprint', pre, window); + } } }, math: function() { diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index e1aa81e5e..167240639 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -7359,7 +7359,10 @@ }); $.on(d, '4chanXInitFinished', Unread.ready); $.on(d, 'ThreadUpdate', Unread.onUpdate); - return $.on(d, 'scroll visibilitychange', Unread.read); + $.on(d, 'scroll visibilitychange', Unread.read); + if (Conf['Unread Line']) { + return $.on(d, 'visibilitychange', Unread.setLine); + } }, ready: function() { var ID, post, posts, _ref; @@ -7374,12 +7377,7 @@ } } Unread.addPosts(posts); - if (Conf['Unread Line']) { - Unread.setLine(); - } - if (Conf['Scroll to Last Read Post']) { - return Unread.scroll(); - } + return Unread.scroll(); }, scroll: function() { var hash, post, posts, prevID, root; @@ -8368,7 +8366,7 @@ } board = g.BOARD.ID; if (board === 'g') { - $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML);\n}, false);"); + $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML.replace(/\\s/g, ' '));\n}, false);"); Post.prototype.callbacks.push({ name: 'Parse /g/ code', cb: this.code @@ -8391,7 +8389,9 @@ _ref = $$('.prettyprint', this.nodes.comment); for (_i = 0, _len = _ref.length; _i < _len; _i++) { pre = _ref[_i]; - $.event('prettyprint', pre, window); + if (!$('.pln', pre)) { + $.event('prettyprint', pre, window); + } } }, math: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index 7371964ef..3c8ff0f0c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7337,7 +7337,10 @@ }); $.on(d, '4chanXInitFinished', Unread.ready); $.on(d, 'ThreadUpdate', Unread.onUpdate); - return $.on(d, 'scroll visibilitychange', Unread.read); + $.on(d, 'scroll visibilitychange', Unread.read); + if (Conf['Unread Line']) { + return $.on(d, 'visibilitychange', Unread.setLine); + } }, ready: function() { var ID, post, posts, _ref; @@ -7352,12 +7355,7 @@ } } Unread.addPosts(posts); - if (Conf['Unread Line']) { - Unread.setLine(); - } - if (Conf['Scroll to Last Read Post']) { - return Unread.scroll(); - } + return Unread.scroll(); }, scroll: function() { var hash, post, posts, prevID, root; @@ -8351,7 +8349,7 @@ } board = g.BOARD.ID; if (board === 'g') { - $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML);\n}, false);"); + $.globalEval("window.addEventListener('prettyprint', function(e) {\n var pre = e.detail;\n pre.innerHTML = prettyPrintOne(pre.innerHTML.replace(/\\s/g, ' '));\n}, false);"); Post.prototype.callbacks.push({ name: 'Parse /g/ code', cb: this.code @@ -8374,7 +8372,9 @@ _ref = $$('.prettyprint', this.nodes.comment); for (_i = 0, _len = _ref.length; _i < _len; _i++) { pre = _ref[_i]; - $.event('prettyprint', pre, window); + if (!$('.pln', pre)) { + $.event('prettyprint', pre, window); + } } }, math: function() { diff --git a/package.json b/package.json index 9d8769671..c5d781aee 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "grunt-contrib-compress": "~0.5.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-watch": "~0.3.1", + "grunt-contrib-watch": "~0.4.0", "grunt-shell": "~0.2.2" }, "repository": { diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 2033adeeb..4e1073d72 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -7,7 +7,7 @@ Fourchan = $.globalEval """ window.addEventListener('prettyprint', function(e) { var pre = e.detail; - pre.innerHTML = prettyPrintOne(pre.innerHTML); + pre.innerHTML = prettyPrintOne(pre.innerHTML.replace(/\\s/g, ' ')); }, false); """ Post::callbacks.push @@ -33,7 +33,12 @@ Fourchan = code: -> return if @isClone for pre in $$ '.prettyprint', @nodes.comment - $.event 'prettyprint', pre, window + # Don't pretty print twice: + # Might need a better way to detect if a .prettyprint + # is already pretty-printed. We can't just look for spans + # since 4chan inserts its quotes and whatnot inside. + unless $ '.pln', pre + $.event 'prettyprint', pre, window return math: -> return if @isClone or !$ '.math', @nodes.comment @@ -44,4 +49,4 @@ Fourchan = $.event '4chanParsingDone', threadId: threadID offset: offset - limit: limit \ No newline at end of file + limit: limit diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 46a42a9d1..f81af4414 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -22,6 +22,7 @@ Unread = $.on d, '4chanXInitFinished', Unread.ready $.on d, 'ThreadUpdate', Unread.onUpdate $.on d, 'scroll visibilitychange', Unread.read + $.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line'] ready: -> $.off d, '4chanXInitFinished', Unread.ready @@ -29,8 +30,7 @@ Unread = for ID, post of Unread.thread.posts posts.push post if post.isReply Unread.addPosts posts - Unread.setLine() if Conf['Unread Line'] - Unread.scroll() if Conf['Scroll to Last Read Post'] + Unread.scroll() scroll: -> # Let the header's onload callback handle it.