Unread Count actually requires the nodes to be on the page

Unfortunately
This commit is contained in:
Zixaphir 2014-01-10 18:55:33 -07:00
parent 743810647d
commit 6bd1d44b68
5 changed files with 34 additions and 33 deletions

View File

@ -1473,16 +1473,9 @@
};
DataBoard.prototype.disconnect = function() {
var key, _i, _len, _results;
$.desync(this.key);
_results = [];
for (_i = 0, _len = this.length; _i < _len; _i++) {
key = this[_i];
if (this.hasOwnKey(key)) {
_results.push(delete this[key]);
}
}
return _results;
delete this.sync;
return delete this.data;
};
return DataBoard;
@ -9680,13 +9673,13 @@
});
},
disconnect: function() {
var hr, name, parent, _i, _len, _ref;
var hr, name, _i, _len, _ref;
if (!Unread.db) {
return;
}
Unread.db.disconnect();
if (parent = (hr = Unread.hr).parentElement) {
$.rm(hr, parent);
if (hr = Unread.hr, Unread) {
$.rm(hr);
}
_ref = ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -9727,7 +9720,9 @@
posts.push(post);
}
}
Unread.addPosts(posts);
if (!Conf['Quote Threading']) {
Unread.addPosts(posts);
}
if (Conf['Quote Threading']) {
QuoteThreading.force();
}
@ -12132,7 +12127,11 @@
var board;
board = $('.board');
$.rmAll(board);
return $.add(board, Navigate.threadRoot);
$.add(board, Navigate.threadRoot);
if (Conf['Unread Count']) {
Unread.read();
return Unread.update();
}
},
popstate: function() {
var a;

View File

@ -1479,16 +1479,9 @@
};
DataBoard.prototype.disconnect = function() {
var key, _i, _len, _results;
$.desync(this.key);
_results = [];
for (_i = 0, _len = this.length; _i < _len; _i++) {
key = this[_i];
if (this.hasOwnKey(key)) {
_results.push(delete this[key]);
}
}
return _results;
delete this.sync;
return delete this.data;
};
return DataBoard;
@ -9663,13 +9656,13 @@
});
},
disconnect: function() {
var hr, name, parent, _i, _len, _ref;
var hr, name, _i, _len, _ref;
if (!Unread.db) {
return;
}
Unread.db.disconnect();
if (parent = (hr = Unread.hr).parentElement) {
$.rm(hr, parent);
if (hr = Unread.hr, Unread) {
$.rm(hr);
}
_ref = ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -9710,7 +9703,9 @@
posts.push(post);
}
}
Unread.addPosts(posts);
if (!Conf['Quote Threading']) {
Unread.addPosts(posts);
}
if (Conf['Quote Threading']) {
QuoteThreading.force();
}
@ -12121,7 +12116,11 @@
var board;
board = $('.board');
$.rmAll(board);
return $.add(board, Navigate.threadRoot);
$.add(board, Navigate.threadRoot);
if (Conf['Unread Count']) {
Unread.read();
return Unread.update();
}
},
popstate: function() {
return Navigate.popstate = function() {

View File

@ -280,6 +280,9 @@ Navigate =
board = $ '.board'
$.rmAll board
$.add board, Navigate.threadRoot
if Conf['Unread Count']
Unread.read()
Unread.update()
popstate: -> <% if (type === 'crx') { %> Navigate.popstate = -> <% } %> # blink/webkit throw a popstate on page load. Not what we want.
a = $.el 'a',

View File

@ -13,8 +13,7 @@ class DataBoard
@sync = sync
$.on d, '4chanXInitFinished', init
save: ->
$.set @key, @data
save: -> $.set @key, @data
delete: ({boardID, threadID, postID}) ->
if postID
@ -93,4 +92,5 @@ class DataBoard
disconnect: ->
$.desync @key
delete @[key] for key in @ when @hasOwnKey key
delete @sync
delete @data

View File

@ -16,7 +16,7 @@ Unread =
return unless Unread.db
Unread.db.disconnect()
$.rm hr, parent if parent = (hr = Unread.hr).parentElement
$.rm hr if {hr} = Unread
delete @[name] for name in ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost']
@ -43,7 +43,7 @@ Unread =
$.off d, '4chanXInitFinished', Unread.ready
posts = []
posts.push post for ID, post of Unread.thread.posts when post.isReply
Unread.addPosts posts
Unread.addPosts posts unless Conf['Quote Threading']
QuoteThreading.force() if Conf['Quote Threading']
Unread.scroll() if Conf['Scroll to Last Read Post']