diff --git a/4chan_x.user.js b/4chan_x.user.js index 70fd78b6b..8e3c4f979 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3434,14 +3434,14 @@ replies: [], foresee: [], node: function(post) { - var index; + var count, index; if ((index = Unread.foresee.indexOf(post.id)) !== -1) { Unread.foresee.splice(index, 1); return; } if (post.root.hidden || post["class"]) return; - Unread.replies.push(post.root); - return Unread.update(); + count = Unread.replies.push(post.root); + return Unread.update(count === 1); }, scroll: function() { var bottom, height, i, reply, _len, _ref; @@ -3454,7 +3454,7 @@ } if (i === 0) return; Unread.replies = Unread.replies.slice(i); - return Unread.update(); + return Unread.update(Unread.replies.length === 0); }, setTitle: function(count) { if (this.scheduled) { @@ -3467,14 +3467,15 @@ return d.title = "(" + count + ") " + Unread.title; }), 5); }, - update: function(forceUpdate) { + update: function(updateFavicon) { var count; if (!g.REPLY) return; count = this.replies.length; if (Conf['Unread Count']) this.setTitle(count); - if (!(Conf['Unread Favicon'] && (count < 2 || forceUpdate))) return; + if (!(Conf['Unread Favicon'] && updateFavicon)) return; + if ($.engine === 'presto') $.rm(Favicon.el); Favicon.el.href = g.dead ? count ? Favicon.unreadDead : Favicon.dead : count ? Favicon.unread : Favicon["default"]; - return $.add(d.head, Favicon.el); + if ($.engine !== 'webkit') return $.add(d.head, Favicon.el); } }; diff --git a/script.coffee b/script.coffee index 7948976ed..783a56ac3 100644 --- a/script.coffee +++ b/script.coffee @@ -2879,8 +2879,8 @@ Unread = Unread.foresee.splice index, 1 return return if post.root.hidden or post.class - Unread.replies.push post.root - Unread.update() + count = Unread.replies.push post.root + Unread.update count is 1 scroll: -> height = d.body.clientHeight @@ -2891,7 +2891,7 @@ Unread = return if i is 0 Unread.replies = Unread.replies[i..] - Unread.update() + Unread.update Unread.replies.length is 0 setTitle: (count) -> if @scheduled @@ -2903,7 +2903,7 @@ Unread = d.title = "(#{count}) #{Unread.title}" ), 5 - update: (forceUpdate) -> + update: (updateFavicon) -> return unless g.REPLY count = @replies.length @@ -2911,9 +2911,12 @@ Unread = if Conf['Unread Count'] @setTitle count - unless Conf['Unread Favicon'] and (count < 2 or forceUpdate) + unless Conf['Unread Favicon'] and updateFavicon return + if $.engine is 'presto' + $.rm Favicon.el + Favicon.el.href = if g.dead if count @@ -2929,7 +2932,8 @@ Unread = #`favicon.href = href` doesn't work on Firefox #`favicon.href = href` isn't enough on Opera #Opera won't always update the favicon if the href didn't not change - $.add d.head, Favicon.el + unless $.engine is 'webkit' + $.add d.head, Favicon.el Favicon = init: ->