diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 908afe4e1..dcf86e06d 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -14932,7 +14932,7 @@ Unread = { init: function() { - if (!(g.VIEW === 'thread' && Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading'])) { + if (!(g.VIEW === 'thread' && (Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading']))) { return; } this.db = new DataBoard('lastReadPosts', this.sync); @@ -14954,7 +14954,7 @@ }, disconnect: function() { var hr, name, _i, _len, _ref; - if (!(g.VIEW === 'thread' && Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading'])) { + if (!(g.VIEW === 'thread' && (Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading']))) { return; } Unread.db.disconnect(); @@ -14968,13 +14968,13 @@ delete this[name]; } this.lastReadPost = 0; - $.off(d, '4chanXInitFinished', this.ready); $.off(d, 'ThreadUpdate', this.onUpdate); $.off(d, 'scroll visibilitychange', this.read); if (Conf['Unread Line']) { $.off(d, 'visibilitychange', this.setLine); } - return Thread.callbacks.disconnect('Unread'); + Thread.callbacks.disconnect('Unread'); + return Post.callbacks.disconnect('Unread'); }, node: function() { var ID, _i, _len, _ref; @@ -18868,9 +18868,6 @@ board = $('.board'); $.rmAll(board); $.add(board, [threadRoot, $.el('hr')]); - if (Conf['Unread Count']) { - Unread.ready(); - } QR.generatePostableThreadsList(); Header.hashScroll.call(window); if (errors) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 0cad5e719..68517b7ca 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -14948,7 +14948,7 @@ Unread = { init: function() { - if (!(g.VIEW === 'thread' && Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading'])) { + if (!(g.VIEW === 'thread' && (Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading']))) { return; } this.db = new DataBoard('lastReadPosts', this.sync); @@ -14970,7 +14970,7 @@ }, disconnect: function() { var hr, name, _i, _len, _ref; - if (!(g.VIEW === 'thread' && Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading'])) { + if (!(g.VIEW === 'thread' && (Conf['Unread Count'] || Conf['Unread Favicon'] || Conf['Unread Line'] || Conf['Scroll to Last Read Post'] || Conf['Thread Watcher'] || Conf['Desktop Notifications'] || Conf['Quote Threading']))) { return; } Unread.db.disconnect(); @@ -14984,13 +14984,13 @@ delete this[name]; } this.lastReadPost = 0; - $.off(d, '4chanXInitFinished', this.ready); $.off(d, 'ThreadUpdate', this.onUpdate); $.off(d, 'scroll visibilitychange', this.read); if (Conf['Unread Line']) { $.off(d, 'visibilitychange', this.setLine); } - return Thread.callbacks.disconnect('Unread'); + Thread.callbacks.disconnect('Unread'); + return Post.callbacks.disconnect('Unread'); }, node: function() { var ID, _i, _len, _ref; @@ -18894,9 +18894,6 @@ board = $('.board'); $.rmAll(board); $.add(board, [threadRoot, $.el('hr')]); - if (Conf['Unread Count']) { - Unread.ready(); - } QR.generatePostableThreadsList(); Header.hashScroll.call(window); if (errors) { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 379ba6252..58c8d4f9a 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -360,8 +360,6 @@ Navigate = $.rmAll board $.add board, [threadRoot, $.el 'hr'] - Unread.ready() if Conf['Unread Count'] - QR.generatePostableThreadsList() Header.hashScroll.call window diff --git a/src/General/lib/callbacks.class b/src/General/lib/callbacks.class index b36187957..b8511a118 100644 --- a/src/General/lib/callbacks.class +++ b/src/General/lib/callbacks.class @@ -17,7 +17,7 @@ class Callbacks feature = @[name] for node in nodes when not feature.disconnected try - feature.call node + feature.call node catch err errors = [] unless errors errors.push diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index e1b26ddd1..e3e2bf5b2 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -1,6 +1,6 @@ Unread = init: -> - return unless g.VIEW is 'thread' and + return unless g.VIEW is 'thread' and ( Conf['Unread Count'] or Conf['Unread Favicon'] or Conf['Unread Line'] or @@ -8,6 +8,7 @@ Unread = Conf['Thread Watcher'] or Conf['Desktop Notifications'] or Conf['Quote Threading'] + ) @db = new DataBoard 'lastReadPosts', @sync @hr = $.el 'hr', @@ -46,9 +47,8 @@ Unread = el: testLink <% } %> - disconnect: -> - return unless g.VIEW is 'thread' and + return unless g.VIEW is 'thread' and ( Conf['Unread Count'] or Conf['Unread Favicon'] or Conf['Unread Line'] or @@ -56,6 +56,7 @@ Unread = Conf['Thread Watcher'] or Conf['Desktop Notifications'] or Conf['Quote Threading'] + ) Unread.db.disconnect() {hr} = Unread @@ -64,12 +65,12 @@ Unread = delete @[name] for name in ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title'] @lastReadPost = 0 - $.off d, '4chanXInitFinished', @ready $.off d, 'ThreadUpdate', @onUpdate $.off d, 'scroll visibilitychange', @read $.off d, 'visibilitychange', @setLine if Conf['Unread Line'] Thread.callbacks.disconnect 'Unread' + Post.callbacks.disconnect 'Unread' node: -> Unread.thread = @