Add thread refresh shortcut.
This commit is contained in:
parent
6dcf11db66
commit
4c00c6f9ae
@ -2,6 +2,13 @@ ThreadUpdater =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
||||||
|
|
||||||
|
@button = $.el 'a',
|
||||||
|
className: 'thread-refresh-shortcut fa fa-refresh'
|
||||||
|
title: 'Refresh Thread'
|
||||||
|
href: 'javascript:;'
|
||||||
|
$.on @button, 'click', @update
|
||||||
|
Header.addShortcut @button, 1
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
for name, conf of Config.updater.checkbox
|
for name, conf of Config.updater.checkbox
|
||||||
checked = if Conf[name] then 'checked' else ''
|
checked = if Conf[name] then 'checked' else ''
|
||||||
@ -79,6 +86,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.interval = @value = val
|
ThreadUpdater.interval = @value = val
|
||||||
$.cb.value.call @ if e
|
$.cb.value.call @ if e
|
||||||
load: (e) ->
|
load: (e) ->
|
||||||
|
$.rmClass ThreadUpdater.button, 'fa-spin'
|
||||||
{req} = ThreadUpdater
|
{req} = ThreadUpdater
|
||||||
delete ThreadUpdater.req
|
delete ThreadUpdater.req
|
||||||
if e.type isnt 'loadend' # timeout or abort
|
if e.type isnt 'loadend' # timeout or abort
|
||||||
@ -141,6 +149,7 @@ ThreadUpdater =
|
|||||||
|
|
||||||
update: ->
|
update: ->
|
||||||
return unless navigator.onLine
|
return unless navigator.onLine
|
||||||
|
$.addClass ThreadUpdater.button, 'fa-spin'
|
||||||
ThreadUpdater.count()
|
ThreadUpdater.count()
|
||||||
ThreadUpdater.set 'timer', '...'
|
ThreadUpdater.set 'timer', '...'
|
||||||
ThreadUpdater.req?.abort()
|
ThreadUpdater.req?.abort()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user