From 6d2a3dfefb696e10f84130fc39875979ce77b47b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 24 Jan 2015 10:32:06 -0800 Subject: [PATCH 1/5] ImageLoader.quotePreviews -> playVideos --- builds/appchan-x.user.js | 4 ++-- builds/crx/script.js | 4 ++-- src/Images/ImageLoader.coffee | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 4bbc4c9d3..9d20c0163 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -12162,7 +12162,7 @@ return g.posts.forEach(ImageLoader.prefetch); }); if (Conf['Replace WEBM']) { - $.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.quotePreviews); + $.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.playVideos); } if (!Conf['Image Prefetching']) { return; @@ -12269,7 +12269,7 @@ g.BOARD.posts.forEach(ImageLoader.prefetch); } }, - quotePreviews: function() { + playVideos: function() { var qpClone, _ref; qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0; return g.posts.forEach(function(post) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 4fa438f67..c87581b20 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12185,7 +12185,7 @@ return g.posts.forEach(ImageLoader.prefetch); }); if (Conf['Replace WEBM']) { - $.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.quotePreviews); + $.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.playVideos); } if (!Conf['Image Prefetching']) { return; @@ -12292,7 +12292,7 @@ g.BOARD.posts.forEach(ImageLoader.prefetch); } }, - quotePreviews: function() { + playVideos: function() { var qpClone, _ref; qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0; return g.posts.forEach(function(post) { diff --git a/src/Images/ImageLoader.coffee b/src/Images/ImageLoader.coffee index 2d3701741..9e6b0fdc7 100755 --- a/src/Images/ImageLoader.coffee +++ b/src/Images/ImageLoader.coffee @@ -12,7 +12,7 @@ ImageLoader = g.posts.forEach ImageLoader.prefetch if Conf['Replace WEBM'] - $.on d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', @quotePreviews + $.on d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', @playVideos return unless Conf['Image Prefetching'] @@ -85,11 +85,11 @@ ImageLoader = g.BOARD.posts.forEach ImageLoader.prefetch return - quotePreviews: -> + playVideos: -> # Special case: Quote previews are off screen when inserted into document, but quickly moved on screen. qpClone = $.id('qp')?.firstElementChild g.posts.forEach (post) -> for post in [post, post.clones...] when post.file?.videoThumb {thumb} = post.file if Header.isNodeVisible(thumb) or post.nodes.root is qpClone then thumb.play() else thumb.pause() - return \ No newline at end of file + return From fb0a4c51f590b3738a684b7af439da86c2cd0b36 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 24 Jan 2015 11:08:26 -0800 Subject: [PATCH 2/5] Fix suffixes. --- builds/appchan-x.user.js | 2 +- builds/crx/script.js | 2 +- src/Monitoring/MarkNewIPs.coffee | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 9d20c0163..e1ae6fe30 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -13655,7 +13655,7 @@ }, markNew: function(post, ipCount) { var counter, suffix; - suffix = ['st', 'nd', 'rd'][ipCount % 10] || 'th'; + suffix = (Math.floor(ipCount / 10)) % 10 === 1 ? 'th' : ['st', 'nd', 'rd'][ipCount % 10 - 1] || 'th'; counter = $.el('span', { className: 'ip-counter', textContent: "(" + ipCount + ")" diff --git a/builds/crx/script.js b/builds/crx/script.js index c87581b20..d8b45181b 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -13678,7 +13678,7 @@ }, markNew: function(post, ipCount) { var counter, suffix; - suffix = ['st', 'nd', 'rd'][ipCount % 10] || 'th'; + suffix = (Math.floor(ipCount / 10)) % 10 === 1 ? 'th' : ['st', 'nd', 'rd'][ipCount % 10 - 1] || 'th'; counter = $.el('span', { className: 'ip-counter', textContent: "(" + ipCount + ")" diff --git a/src/Monitoring/MarkNewIPs.coffee b/src/Monitoring/MarkNewIPs.coffee index 81c6ed4a9..263d7e53a 100644 --- a/src/Monitoring/MarkNewIPs.coffee +++ b/src/Monitoring/MarkNewIPs.coffee @@ -32,7 +32,10 @@ MarkNewIPs = MarkNewIPs.postIDs = postIDs markNew: (post, ipCount) -> - suffix = ['st', 'nd', 'rd'][ipCount % 10] or 'th' # fuck switches + suffix = if (ipCount // 10) % 10 is 1 + 'th' + else + ['st', 'nd', 'rd'][ipCount % 10 - 1] or 'th' # fuck switches counter = $.el 'span', className: 'ip-counter' textContent: "(#{ipCount})" From 510aa71e814ee306a876c2f5aa24afc9f58ba8d5 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 24 Jan 2015 17:05:28 -0800 Subject: [PATCH 3/5] Fix duplicated text in thread watcher. --- builds/appchan-x.user.js | 3 +-- builds/crx/script.js | 3 +-- src/Monitoring/ThreadWatcher.coffee | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 86ebe6905..3ff84f973 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -14689,7 +14689,6 @@ $.on(x, 'click', ThreadWatcher.cb.rm); link = $.el('a', { href: "/" + boardID + "/thread/" + threadID, - textContent: data.excerpt, title: data.excerpt, className: 'watcher-link' }); @@ -14701,7 +14700,7 @@ $.prepend(link, count); } title = $.el('span', { - textContent: link.textContent, + textContent: data.excerpt, className: 'watcher-title' }); $.add(link, title); diff --git a/builds/crx/script.js b/builds/crx/script.js index ab01f12c0..904d942b2 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -14712,7 +14712,6 @@ $.on(x, 'click', ThreadWatcher.cb.rm); link = $.el('a', { href: "/" + boardID + "/thread/" + threadID, - textContent: data.excerpt, title: data.excerpt, className: 'watcher-link' }); @@ -14724,7 +14723,7 @@ $.prepend(link, count); } title = $.el('span', { - textContent: link.textContent, + textContent: data.excerpt, className: 'watcher-title' }); $.add(link, title); diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 51f8e1d80..ffca89f21 100755 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -253,7 +253,6 @@ ThreadWatcher = link = $.el 'a', href: "/#{boardID}/thread/#{threadID}" - textContent: data.excerpt title: data.excerpt className: 'watcher-link' @@ -264,7 +263,7 @@ ThreadWatcher = $.prepend link, count title = $.el 'span', - textContent: link.textContent + textContent: data.excerpt className: 'watcher-title' $.add link, title From af6e9bd6ef5723929e6fc2c9bcbd33afebc2f841 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 24 Jan 2015 20:45:34 -0800 Subject: [PATCH 4/5] Get.threadFromNode selects the wrong thread for inlined quotes. --- builds/appchan-x.user.js | 3 ++- builds/crx/script.js | 3 ++- src/Monitoring/ThreadWatcher.coffee | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 3ff84f973..b18b5b48e 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -14460,7 +14460,8 @@ return $.event('CloseMenu'); }, toggle: function() { - ThreadWatcher.toggle(Get.threadFromNode(this)); + var thread; + thread = Get.postFromNode(this).thread; Index.followedThreadID = thread.ID; ThreadWatcher.toggle(thread); return delete Index.followedThreadID; diff --git a/builds/crx/script.js b/builds/crx/script.js index 904d942b2..74765820c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -14483,7 +14483,8 @@ return $.event('CloseMenu'); }, toggle: function() { - ThreadWatcher.toggle(Get.threadFromNode(this)); + var thread; + thread = Get.postFromNode(this).thread; Index.followedThreadID = thread.ID; ThreadWatcher.toggle(thread); return delete Index.followedThreadID; diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index ffca89f21..57f4f75f6 100755 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -108,7 +108,7 @@ ThreadWatcher = ThreadWatcher.refresh() $.event 'CloseMenu' toggle: -> - ThreadWatcher.toggle Get.threadFromNode @ + {thread} = Get.postFromNode @ Index.followedThreadID = thread.ID ThreadWatcher.toggle thread delete Index.followedThreadID From 5501d422469331f889b4ec5639278d44f9cc19a7 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 24 Jan 2015 21:16:59 -0800 Subject: [PATCH 5/5] Thread watcher menu fixes. - fix setting saving - restore tooltip description - update UI.checkbox call --- builds/appchan-x.user.js | 4 +++- builds/crx/script.js | 4 +++- src/Monitoring/ThreadWatcher.coffee | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index b18b5b48e..43ba1eb41 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -14980,9 +14980,11 @@ var entry, input; entry = { type: 'thread watcher', - el: UI.checkbox(name, " " + (name.replace(' Thread Watcher', ''))) + el: UI.checkbox(name, name.replace(' Thread Watcher', '')) }; + entry.el.title = desc; input = entry.el.firstElementChild; + $.on(input, 'change', $.cb.checked); if (name === 'Current Board' || name === 'Show Unread Count') { $.on(input, 'change', ThreadWatcher.refresh); } diff --git a/builds/crx/script.js b/builds/crx/script.js index 74765820c..2e4053f3a 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -15003,9 +15003,11 @@ var entry, input; entry = { type: 'thread watcher', - el: UI.checkbox(name, " " + (name.replace(' Thread Watcher', ''))) + el: UI.checkbox(name, name.replace(' Thread Watcher', '')) }; + entry.el.title = desc; input = entry.el.firstElementChild; + $.on(input, 'change', $.cb.checked); if (name === 'Current Board' || name === 'Show Unread Count') { $.on(input, 'change', ThreadWatcher.refresh); } diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 57f4f75f6..07daaeab3 100755 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -430,8 +430,10 @@ ThreadWatcher = createSubEntry: (name, desc) -> entry = type: 'thread watcher' - el: UI.checkbox name, " #{name.replace ' Thread Watcher', ''}" + el: UI.checkbox name, name.replace(' Thread Watcher', '') + entry.el.title = desc input = entry.el.firstElementChild + $.on input, 'change', $.cb.checked $.on input, 'change', ThreadWatcher.refresh if name in ['Current Board', 'Show Unread Count'] $.on input, 'change', ThreadWatcher.fetchAuto if name in ['Show Unread Count', 'Auto Update Thread Watcher'] entry