make refresh button spin
This commit is contained in:
parent
e73410f48c
commit
688f7edf2d
@ -13,13 +13,14 @@ ThreadWatcher =
|
|||||||
@dialog = UI.dialog 'thread-watcher', 'top: 50px; left: 0px;', <%= importHTML('Monitoring/ThreadWatcher') %>
|
@dialog = UI.dialog 'thread-watcher', 'top: 50px; left: 0px;', <%= importHTML('Monitoring/ThreadWatcher') %>
|
||||||
@status = $ '#watcher-status', @dialog
|
@status = $ '#watcher-status', @dialog
|
||||||
@list = @dialog.lastElementChild
|
@list = @dialog.lastElementChild
|
||||||
|
@refreshButton = $ '.move > .refresh', @dialog
|
||||||
|
|
||||||
@unreaddb = new DataBoard 'lastReadPosts'
|
@unreaddb = new DataBoard 'lastReadPosts'
|
||||||
|
|
||||||
$.on d, 'QRPostSuccessful', @cb.post
|
$.on d, 'QRPostSuccessful', @cb.post
|
||||||
$.on sc, 'click', @toggleWatcher
|
$.on sc, 'click', @toggleWatcher
|
||||||
$.on $('.move > .refresh', ThreadWatcher.dialog), 'click', @fetchAllStatus
|
$.on @refreshButton, 'click', @fetchAllStatus
|
||||||
$.on $('.move > .close', ThreadWatcher.dialog), 'click', @toggleWatcher
|
$.on $('.move > .close', @dialog), 'click', @toggleWatcher
|
||||||
|
|
||||||
$.on d, '4chanXInitFinished', @ready
|
$.on d, '4chanXInitFinished', @ready
|
||||||
switch g.VIEW
|
switch g.VIEW
|
||||||
@ -124,7 +125,9 @@ ThreadWatcher =
|
|||||||
fetchStatus: ({boardID, threadID, data}) ->
|
fetchStatus: ({boardID, threadID, data}) ->
|
||||||
return if data.isDead
|
return if data.isDead
|
||||||
{fetchCount} = ThreadWatcher
|
{fetchCount} = ThreadWatcher
|
||||||
ThreadWatcher.status.textContent = '...' if fetchCount.fetching is 0
|
if fetchCount.fetching is 0
|
||||||
|
ThreadWatcher.status.textContent = '...'
|
||||||
|
$.addClass ThreadWatcher.refreshButton, 'fa-spin'
|
||||||
fetchCount.fetching++
|
fetchCount.fetching++
|
||||||
$.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
$.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
||||||
onloadend: ->
|
onloadend: ->
|
||||||
@ -133,6 +136,7 @@ ThreadWatcher =
|
|||||||
fetchCount.fetched = 0
|
fetchCount.fetched = 0
|
||||||
fetchCount.fetching = 0
|
fetchCount.fetching = 0
|
||||||
status = ''
|
status = ''
|
||||||
|
$.rmClass ThreadWatcher.refreshButton, 'fa-spin'
|
||||||
else
|
else
|
||||||
status = "#{Math.round fetchCount.fetched / fetchCount.fetching * 100}%"
|
status = "#{Math.round fetchCount.fetched / fetchCount.fetching * 100}%"
|
||||||
ThreadWatcher.status.textContent = status
|
ThreadWatcher.status.textContent = status
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user