diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index d9a6c4c67..43ba1eb41 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -12158,7 +12158,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; @@ -12265,7 +12265,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) { @@ -13651,7 +13651,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 + ")" @@ -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; @@ -14689,7 +14690,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 +14701,7 @@ $.prepend(link, count); } title = $.el('span', { - textContent: link.textContent, + textContent: data.excerpt, className: 'watcher-title' }); $.add(link, title); @@ -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 6f04360d4..2e4053f3a 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12181,7 +12181,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; @@ -12288,7 +12288,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) { @@ -13674,7 +13674,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 + ")" @@ -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; @@ -14712,7 +14713,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 +14724,7 @@ $.prepend(link, count); } title = $.el('span', { - textContent: link.textContent, + textContent: data.excerpt, className: 'watcher-title' }); $.add(link, title); @@ -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/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 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})" diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 51f8e1d80..07daaeab3 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 @@ -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 @@ -431,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