More Unread work outside of the Unread code.

This commit is contained in:
Nicolas Stepien 2013-02-17 01:12:32 +01:00
parent 5e03439960
commit 6eac5ca3b2
2 changed files with 13 additions and 12 deletions

View File

@ -2906,7 +2906,7 @@
} }
}, },
add: function(quotelink, board, threadID, postID, context) { add: function(quotelink, board, threadID, postID, context) {
var inline, isBacklink, post; var i, inline, isBacklink, post;
isBacklink = $.hasClass(quotelink, 'backlink'); isBacklink = $.hasClass(quotelink, 'backlink');
inline = $.el('div', { inline = $.el('div', {
id: "i" + postID, id: "i" + postID,
@ -2919,7 +2919,11 @@
} }
if (isBacklink && Conf['Forward Hiding']) { if (isBacklink && Conf['Forward Hiding']) {
$.addClass(post.nodes.root, 'forwarded'); $.addClass(post.nodes.root, 'forwarded');
return post.forwarded++ || (post.forwarded = 1); post.forwarded++ || (post.forwarded = 1);
}
if (Unread.posts && (i = Unread.posts.indexOf(post)) !== -1) {
Unread.posts.splice(i, 1);
return Unread.update();
} }
}, },
rm: function(quotelink, board, threadID, postID, context) { rm: function(quotelink, board, threadID, postID, context) {
@ -4533,7 +4537,7 @@
} else { } else {
ThreadUpdater.set('status', "+" + count, 'new'); ThreadUpdater.set('status', "+" + count, 'new');
ThreadUpdater.outdateCount = 0; ThreadUpdater.outdateCount = 0;
if (Conf['Beep'] && d.hidden) { if (Conf['Beep'] && d.hidden && Unread.posts && !Unread.posts.length) {
if (!ThreadUpdater.audio) { if (!ThreadUpdater.audio) {
ThreadUpdater.audio = $.el('audio', { ThreadUpdater.audio = $.el('audio', {
src: ThreadUpdater.beep src: ThreadUpdater.beep

View File

@ -1024,7 +1024,6 @@ ArchiveLink =
Redirect = Redirect =
image: (board, filename) -> image: (board, filename) ->
# XXX need to differentiate between thumbnail only and full_image for img src=
# Do not use g.BOARD, the image url can originate from a cross-quote. # Do not use g.BOARD, the image url can originate from a cross-quote.
switch "#{board}" switch "#{board}"
when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg' when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg'
@ -1709,11 +1708,10 @@ QuoteInline =
$.addClass post.nodes.root, 'forwarded' $.addClass post.nodes.root, 'forwarded'
post.forwarded++ or post.forwarded = 1 post.forwarded++ or post.forwarded = 1
# Decrease the unread count if this post is in the array of unread reply. # Decrease the unread count if this post is in the array of unread posts.
# XXX if Unread.posts and (i = Unread.posts.indexOf post) isnt -1
# if (i = Unread.replies.indexOf el) isnt -1 Unread.posts.splice i, 1
# Unread.replies.splice i, 1 Unread.update()
# Unread.update true
rm: (quotelink, board, threadID, postID, context) -> rm: (quotelink, board, threadID, postID, context) ->
isBacklink = $.hasClass quotelink, 'backlink' isBacklink = $.hasClass quotelink, 'backlink'
@ -2170,7 +2168,6 @@ Sauce =
links = [] links = []
for link in Conf['sauces'].split '\n' for link in Conf['sauces'].split '\n'
continue if link[0] is '#' continue if link[0] is '#'
# XXX .trim() is there to fix Opera reading two different line breaks.
links.push @createSauceLink link.trim() links.push @createSauceLink link.trim()
return unless links.length return unless links.length
@links = links @links = links
@ -2688,7 +2685,7 @@ ThreadStats =
@postCount = @fileCount = 0 @postCount = @fileCount = 0
@postCountEl = $ '#post-count', @dialog @postCountEl = $ '#post-count', @dialog
@fileCountEl = $ '#file-count', @dialog @fileCountEl = $ '#file-count', @dialog
@fileLimit = # XXX need up to date data on this, check browser @fileLimit = # XXX boards config, need up to date data on this, check browser
switch g.BOARD switch g.BOARD
when 'a', 'b', 'v', 'co', 'mlp' when 'a', 'b', 'v', 'co', 'mlp'
251 251
@ -2933,7 +2930,7 @@ ThreadUpdater =
else else
ThreadUpdater.set 'status', "+#{count}", 'new' ThreadUpdater.set 'status', "+#{count}", 'new'
ThreadUpdater.outdateCount = 0 ThreadUpdater.outdateCount = 0
if Conf['Beep'] and d.hidden # XXX and !Unread.replies.length if Conf['Beep'] and d.hidden and Unread.posts and !Unread.posts.length
unless ThreadUpdater.audio unless ThreadUpdater.audio
ThreadUpdater.audio = $.el 'audio', src: ThreadUpdater.beep ThreadUpdater.audio = $.el 'audio', src: ThreadUpdater.beep
ThreadUpdater.audio.play() ThreadUpdater.audio.play()