Fix race condition causing unread posts tracking to malfunction.
This commit is contained in:
parent
0308b7ace8
commit
36a3e7cdcc
@ -1,13 +1,22 @@
|
|||||||
Favicon =
|
Favicon =
|
||||||
init: ->
|
init: ->
|
||||||
$.asap (-> d.head and (Favicon.el = $ 'link[rel="shortcut icon"]', d.head)), Favicon.initAsap
|
$.asap (-> d.head and (Favicon.el = $ 'link[rel="shortcut icon"]', d.head)), Favicon.initAsap
|
||||||
|
|
||||||
|
set: (status) ->
|
||||||
|
Favicon.status = status
|
||||||
|
if Favicon.el
|
||||||
|
Favicon.el.href = Favicon[status]
|
||||||
|
# `favicon.href = href` doesn't work on Firefox.
|
||||||
|
$.add d.head, Favicon.el
|
||||||
|
|
||||||
initAsap: ->
|
initAsap: ->
|
||||||
Favicon.el.type = 'image/x-icon'
|
Favicon.el.type = 'image/x-icon'
|
||||||
{href} = Favicon.el
|
{href} = Favicon.el
|
||||||
Favicon.isSFW = /ws\.ico$/.test href
|
Favicon.isSFW = /ws\.ico$/.test href
|
||||||
Favicon.default = href
|
Favicon.default = href
|
||||||
Favicon.switch()
|
Favicon.switch()
|
||||||
|
if Favicon.status
|
||||||
|
Favicon.set Favicon.status
|
||||||
|
|
||||||
switch: ->
|
switch: ->
|
||||||
items = {
|
items = {
|
||||||
|
|||||||
@ -236,15 +236,14 @@ Unread =
|
|||||||
|
|
||||||
if Conf['Unread Favicon'] and g.SITE.software is 'yotsuba'
|
if Conf['Unread Favicon'] and g.SITE.software is 'yotsuba'
|
||||||
{isDead} = Unread.thread
|
{isDead} = Unread.thread
|
||||||
Favicon.el.href =
|
Favicon.set (
|
||||||
if countQuotingYou
|
if countQuotingYou
|
||||||
Favicon[if isDead then 'unreadDeadY' else 'unreadY']
|
(if isDead then 'unreadDeadY' else 'unreadY')
|
||||||
else if count
|
else if count
|
||||||
Favicon[if isDead then 'unreadDead' else 'unread']
|
(if isDead then 'unreadDead' else 'unread')
|
||||||
else
|
else
|
||||||
Favicon[if isDead then 'dead' else 'default']
|
(if isDead then 'dead' else 'default')
|
||||||
# `favicon.href = href` doesn't work on Firefox.
|
)
|
||||||
$.add d.head, Favicon.el
|
|
||||||
|
|
||||||
saveThreadWatcherCount: $.debounce 2 * $.SECOND, ->
|
saveThreadWatcherCount: $.debounce 2 * $.SECOND, ->
|
||||||
$.forceSync 'Remember Last Read Post'
|
$.forceSync 'Remember Last Read Post'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user