Unbreak Unread and JSON Navigation

This commit is contained in:
Zixaphir 2015-01-13 11:46:46 -07:00
parent 7e6720ee4d
commit f6ac531b16
5 changed files with 14 additions and 21 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -360,8 +360,6 @@ Navigate =
$.rmAll board
$.add board, [threadRoot, $.el 'hr']
Unread.ready() if Conf['Unread Count']
QR.generatePostableThreadsList()
Header.hashScroll.call window

View File

@ -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

View File

@ -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 = @