add thread watcher refresh button
This commit is contained in:
parent
77a3d59ddf
commit
a24f62923b
@ -557,10 +557,16 @@ span.hide-announcement {
|
|||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
min-width: 136px;
|
min-width: 146px;
|
||||||
max-height: 92%;
|
max-height: 92%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
#thread-watcher .refresh {
|
||||||
|
padding: 0px 3px;
|
||||||
|
}
|
||||||
|
#watcher-check-threads {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
#thread-watcher .menu-button {
|
#thread-watcher .menu-button {
|
||||||
bottom: 1px;
|
bottom: 1px;
|
||||||
}
|
}
|
||||||
@ -598,7 +604,7 @@ span.hide-announcement {
|
|||||||
#thread-watcher a {
|
#thread-watcher a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
#thread-watcher .move>.close {
|
#thread-watcher .move > .close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
|
|||||||
@ -1,2 +1,7 @@
|
|||||||
<div class="move">Thread Watcher <span id="watcher-status"></span><a class="menu-button" href="javascript:;"><i class="fa fa-angle-down"></i></a><a class=close href=javascript:;>×</a></span></div>
|
<div class="move">
|
||||||
|
Thread Watcher <a class="refresh fa fa-refresh" title="Check threads" href="javascript:;"></a>
|
||||||
|
<span id="watcher-status"></span>
|
||||||
|
<a class="menu-button" href="javascript:;"><i class="fa fa-angle-down"></i></a>
|
||||||
|
<a class="close" href="javascript:;">×</a>
|
||||||
|
</div>
|
||||||
<div id="watched-threads"></div>
|
<div id="watched-threads"></div>
|
||||||
|
|||||||
@ -18,7 +18,8 @@ ThreadWatcher =
|
|||||||
|
|
||||||
$.on d, 'QRPostSuccessful', @cb.post
|
$.on d, 'QRPostSuccessful', @cb.post
|
||||||
$.on sc, 'click', @toggleWatcher
|
$.on sc, 'click', @toggleWatcher
|
||||||
$.on $('.move>.close', ThreadWatcher.dialog), 'click', @toggleWatcher
|
$.on $('.move > .refresh', ThreadWatcher.dialog), 'click', @fetchAllStatus
|
||||||
|
$.on $('.move > .close', ThreadWatcher.dialog), 'click', @toggleWatcher
|
||||||
|
|
||||||
$.on d, '4chanXInitFinished', @ready
|
$.on d, '4chanXInitFinished', @ready
|
||||||
switch g.VIEW
|
switch g.VIEW
|
||||||
@ -117,13 +118,13 @@ ThreadWatcher =
|
|||||||
fetching: 0
|
fetching: 0
|
||||||
fetchAllStatus: ->
|
fetchAllStatus: ->
|
||||||
return unless (threads = ThreadWatcher.getAll()).length
|
return unless (threads = ThreadWatcher.getAll()).length
|
||||||
ThreadWatcher.status.textContent = '...'
|
|
||||||
for thread in threads
|
for thread in threads
|
||||||
ThreadWatcher.fetchStatus thread
|
ThreadWatcher.fetchStatus thread
|
||||||
return
|
return
|
||||||
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
|
||||||
fetchCount.fetching++
|
fetchCount.fetching++
|
||||||
$.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
$.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
||||||
onloadend: ->
|
onloadend: ->
|
||||||
@ -298,6 +299,7 @@ ThreadWatcher =
|
|||||||
cb: ThreadWatcher.cb.checkThreads
|
cb: ThreadWatcher.cb.checkThreads
|
||||||
entry:
|
entry:
|
||||||
el: $.el 'a',
|
el: $.el 'a',
|
||||||
|
id: 'watcher-check-threads'
|
||||||
textContent: 'Check threads'
|
textContent: 'Check threads'
|
||||||
refresh: -> (if $('div:not(.dead-thread)', ThreadWatcher.list) then $.rmClass else $.addClass) @el, 'disabled'
|
refresh: -> (if $('div:not(.dead-thread)', ThreadWatcher.list) then $.rmClass else $.addClass) @el, 'disabled'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user