From 41b840139985b5489414840be832a652f0940ba3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 27 May 2013 20:13:29 +0200 Subject: [PATCH 1/4] Better, simpler visibility API. No need to polyfill for Gecko anymore. --- lib/polyfill.coffee | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/polyfill.coffee b/lib/polyfill.coffee index 0c098b212..5d9ddc124 100644 --- a/lib/polyfill.coffee +++ b/lib/polyfill.coffee @@ -3,20 +3,10 @@ Polyfill = Polyfill.visibility() visibility: -> # page visibility API - return if 'visibilityState' of document - if 'webkitVisibilityState' of document - prefix = 'webkit' - else if 'mozVisibilityState' of document - prefix = 'moz' - else - return - - property = prefix + 'VisibilityState' - event = prefix + 'visibilitychange' - - d.visibilityState = d[property] - d.hidden = d.visibilityState is 'hidden' - $.on d, event, -> - d.visibilityState = d[property] - d.hidden = d.visibilityState is 'hidden' - $.event 'visibilitychange' + return unless 'webkitHidden' of document + Object.defineProperties HTMLDocument.prototype, + visibilityState: + get: -> @webkitVisibilityState + hidden: + get: -> @webkitHidden + $.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange' From acd2f100c969ff68bd0902342858c17a960f0b0d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 27 May 2013 20:26:37 +0200 Subject: [PATCH 2/4] Fix #1129. --- src/Miscellaneous/Keybinds.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index e731a8a5f..e264120d6 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -176,8 +176,11 @@ Keybinds = rect = postEl.getBoundingClientRect() if rect.bottom >= topMargin and rect.top <= doc.clientHeight # We're at least partially visible root = postEl.parentNode - next = $.x 'child::div[contains(@class,"post reply")]', - if delta is +1 then root.nextElementSibling else root.previousElementSibling + axe = if delta is +1 + 'following' + else + 'preceding' + next = $.x "#{axe}-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root unless next @focus postEl return From 7270c8060a5760651438e2011c8d14d1ee0b20ac Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Mon, 27 May 2013 14:20:07 -0700 Subject: [PATCH 3/4] hasInline --- builds/4chan-X.js | 7 +++++-- builds/4chan-X.user.js | 7 +++++-- builds/crx/script.js | 7 +++++-- src/Quotelinks/QuoteInline.coffee | 7 ++++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 6cfcb0d1f..37613c19c 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -3796,14 +3796,17 @@ } }, add: function(quotelink, boardID, threadID, postID, context) { - var inline, isBacklink, post; + var inline, isBacklink, post, qroot, root; isBacklink = $.hasClass(quotelink, 'backlink'); inline = $.el('div', { id: "i" + postID, className: 'inline' }); - $.after(QuoteInline.findRoot(quotelink, isBacklink), inline); + root = QuoteInline.findRoot(quotelink, isBacklink); + $.after(root, inline); + qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root); + $.addClass(qroot, 'hasInline'); Get.postClone(boardID, threadID, postID, inline, context); if (!((post = g.posts["" + boardID + "." + postID]) && context.thread === post.thread)) { return; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 33dd09687..9ad124789 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -3792,14 +3792,17 @@ } }, add: function(quotelink, boardID, threadID, postID, context) { - var inline, isBacklink, post; + var inline, isBacklink, post, qroot, root; isBacklink = $.hasClass(quotelink, 'backlink'); inline = $.el('div', { id: "i" + postID, className: 'inline' }); - $.after(QuoteInline.findRoot(quotelink, isBacklink), inline); + root = QuoteInline.findRoot(quotelink, isBacklink); + $.after(root, inline); + qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root); + $.addClass(qroot, 'hasInline'); Get.postClone(boardID, threadID, postID, inline, context); if (!((post = g.posts["" + boardID + "." + postID]) && context.thread === post.thread)) { return; diff --git a/builds/crx/script.js b/builds/crx/script.js index d83e65bdb..d10370c99 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -3794,14 +3794,17 @@ } }, add: function(quotelink, boardID, threadID, postID, context) { - var inline, isBacklink, post; + var inline, isBacklink, post, qroot, root; isBacklink = $.hasClass(quotelink, 'backlink'); inline = $.el('div', { id: "i" + postID, className: 'inline' }); - $.after(QuoteInline.findRoot(quotelink, isBacklink), inline); + root = QuoteInline.findRoot(quotelink, isBacklink); + $.after(root, inline); + qroot = $.x('ancestor::*[contains(@class,"postContainer")][1]', root); + $.addClass(qroot, 'hasInline'); Get.postClone(boardID, threadID, postID, inline, context); if (!((post = g.posts["" + boardID + "." + postID]) && context.thread === post.thread)) { return; diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index adcba610e..cb63f4780 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -54,7 +54,12 @@ QuoteInline = inline = $.el 'div', id: "i#{postID}" className: 'inline' - $.after QuoteInline.findRoot(quotelink, isBacklink), inline + root = QuoteInline.findRoot(quotelink, isBacklink) + $.after root, inline + + qroot = $.x 'ancestor::*[contains(@class,"postContainer")][1]', root + + $.addClass qroot, 'hasInline' Get.postClone boardID, threadID, postID, inline, context return unless (post = g.posts["#{boardID}.#{postID}"]) and From 7e5b9eb3d96e4e6f747fa84d8ad000a9b7d20da4 Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Mon, 27 May 2013 16:20:19 -0700 Subject: [PATCH 4/4] Release 4chan X v1.2.12. --- CHANGELOG.md | 9 +++++++++ LICENSE | 2 +- builds/4chan-X.js | 6 +++--- builds/4chan-X.meta.js | 2 +- builds/4chan-X.user.js | 6 +++--- builds/crx/manifest.json | 2 +- builds/crx/script.js | 4 ++-- latest.js | 2 +- package.json | 2 +- 9 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee0b5a1cf..127d8e928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### v1.2.12 +*2013-05-27* + +**MayhemYDG**: +- Fix `Jump to Next Reply` keybind not accounting for posts after unread line + +**seaweedchan**: +- Added `.hasInline` (if replyContainer contains .inline) for userstyle/script maintainers + ### v1.2.11 *2013-05-27* diff --git a/LICENSE b/LICENSE index 06d3570b7..235153176 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.2.11 - 2013-05-27 +* 4chan X - Version 1.2.12 - 2013-05-27 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 7fbabbc3a..d810fa624 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.2.11 +// @version 1.2.12 // @namespace 4chan-X // @description Cross-browser userscript for maximum lurking on 4chan. // @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -19,7 +19,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.2.11 - 2013-05-27 +* 4chan X - Version 1.2.12 - 2013-05-27 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -321,7 +321,7 @@ doc = d.documentElement; g = { - VERSION: '1.2.11', + VERSION: '1.2.12', NAMESPACE: '4chan X.', boards: {}, threads: {}, diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 56359d137..e569d27a3 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.2.11 +// @version 1.2.12 // @namespace 4chan-X // @description Cross-browser userscript for maximum lurking on 4chan. // @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 0a0ab69cd..0cd01dfa2 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.2.11 +// @version 1.2.12 // @namespace 4chan-X // @description Cross-browser userscript for maximum lurking on 4chan. // @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -19,7 +19,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.2.11 - 2013-05-27 +* 4chan X - Version 1.2.12 - 2013-05-27 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -318,7 +318,7 @@ doc = d.documentElement; g = { - VERSION: '1.2.11', + VERSION: '1.2.12', NAMESPACE: '4chan X.', boards: {}, threads: {}, diff --git a/builds/crx/manifest.json b/builds/crx/manifest.json index a9bb0abc1..5b6b2bea8 100644 --- a/builds/crx/manifest.json +++ b/builds/crx/manifest.json @@ -1,6 +1,6 @@ { "name": "4chan X", - "version": "1.2.11", + "version": "1.2.12", "manifest_version": 2, "description": "Cross-browser userscript for maximum lurking on 4chan.", "icons": { diff --git a/builds/crx/script.js b/builds/crx/script.js index cb4ce5c72..74e1c01ca 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.2.11 - 2013-05-27 +* 4chan X - Version 1.2.12 - 2013-05-27 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -299,7 +299,7 @@ doc = d.documentElement; g = { - VERSION: '1.2.11', + VERSION: '1.2.12', NAMESPACE: '4chan X.', boards: {}, threads: {}, diff --git a/latest.js b/latest.js index a3c1e9535..54ce9189b 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'1.2.11'},'*') +postMessage({version:'1.2.12'},'*') diff --git a/package.json b/package.json index 64b48a0e0..90f6be183 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "1.2.11", + "version": "1.2.12", "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X",