Auto Update This shouldn't be in Conf and shouldn't be saved.
This commit is contained in:
parent
8b5441cf65
commit
581fc802ab
@ -4091,11 +4091,10 @@ ThreadUpdater =
|
|||||||
checked = if Conf[name] then 'checked' else ''
|
checked = if Conf[name] then 'checked' else ''
|
||||||
html += "<div><label title='#{conf[1]}'><input name='#{name}' type=checkbox #{checked}> #{name}</label></div>"
|
html += "<div><label title='#{conf[1]}'><input name='#{name}' type=checkbox #{checked}> #{name}</label></div>"
|
||||||
|
|
||||||
checked = if Conf['Auto Update'] then 'checked' else ''
|
|
||||||
html = """
|
html = """
|
||||||
<div class=move><span id=update-status></span> <span id=update-timer></span></div>
|
<div class=move><span id=update-status></span> <span id=update-timer></span></div>
|
||||||
#{html}
|
#{html}
|
||||||
<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' #{checked}> Auto Update This</label></div>
|
<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' #{if Conf['Auto Update'] then 'checked' else ''}> Auto Update This</label></div>
|
||||||
<div><label><input type=number name=Interval class=field min=5 value=#{Conf['Interval']}> Refresh rate (s)</label></div>
|
<div><label><input type=number name=Interval class=field min=5 value=#{Conf['Interval']}> Refresh rate (s)</label></div>
|
||||||
<div><input value='Update' type=button name='Update'></div>
|
<div><input value='Update' type=button name='Update'></div>
|
||||||
"""
|
"""
|
||||||
@ -4103,6 +4102,7 @@ ThreadUpdater =
|
|||||||
@dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
|
@dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
|
||||||
@timer = $ '#update-timer', @dialog
|
@timer = $ '#update-timer', @dialog
|
||||||
@status = $ '#update-status', @dialog
|
@status = $ '#update-status', @dialog
|
||||||
|
@isUpdating = Conf['Auto Update']
|
||||||
|
|
||||||
Thread::callbacks.push
|
Thread::callbacks.push
|
||||||
name: 'Thread Updater'
|
name: 'Thread Updater'
|
||||||
@ -4123,7 +4123,8 @@ ThreadUpdater =
|
|||||||
$.on input, 'change', ThreadUpdater.cb.scrollBG
|
$.on input, 'change', ThreadUpdater.cb.scrollBG
|
||||||
ThreadUpdater.cb.scrollBG()
|
ThreadUpdater.cb.scrollBG()
|
||||||
when 'Auto Update This'
|
when 'Auto Update This'
|
||||||
$.on input, 'change', ThreadUpdater.cb.autoUpdate
|
$.off input, 'change', $.cb.checked
|
||||||
|
$.on input, 'change', ThreadUpdater.cb.autoUpdate
|
||||||
$.event 'change', null, input
|
$.event 'change', null, input
|
||||||
when 'Interval'
|
when 'Interval'
|
||||||
$.on input, 'change', ThreadUpdater.cb.interval
|
$.on input, 'change', ThreadUpdater.cb.interval
|
||||||
@ -4149,14 +4150,14 @@ ThreadUpdater =
|
|||||||
if ThreadUpdater.online = navigator.onLine
|
if ThreadUpdater.online = navigator.onLine
|
||||||
ThreadUpdater.outdateCount = 0
|
ThreadUpdater.outdateCount = 0
|
||||||
ThreadUpdater.set 'timer', ThreadUpdater.getInterval()
|
ThreadUpdater.set 'timer', ThreadUpdater.getInterval()
|
||||||
ThreadUpdater.update() if Conf['Auto Update This']
|
ThreadUpdater.update() if ThreadUpdater.isUpdating
|
||||||
ThreadUpdater.set 'status', null, null
|
ThreadUpdater.set 'status', null, null
|
||||||
else
|
else
|
||||||
ThreadUpdater.set 'timer', null
|
ThreadUpdater.set 'timer', null
|
||||||
ThreadUpdater.set 'status', 'Offline', 'warning'
|
ThreadUpdater.set 'status', 'Offline', 'warning'
|
||||||
ThreadUpdater.cb.autoUpdate()
|
ThreadUpdater.cb.autoUpdate()
|
||||||
post: (e) ->
|
post: (e) ->
|
||||||
return unless Conf['Auto Update This'] and e.detail.threadID is ThreadUpdater.thread.ID
|
return unless ThreadUpdater.isUpdating and e.detail.threadID is ThreadUpdater.thread.ID
|
||||||
ThreadUpdater.outdateCount = 0
|
ThreadUpdater.outdateCount = 0
|
||||||
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
||||||
visibility: ->
|
visibility: ->
|
||||||
@ -4170,8 +4171,9 @@ ThreadUpdater =
|
|||||||
-> true
|
-> true
|
||||||
else
|
else
|
||||||
-> not d.hidden
|
-> not d.hidden
|
||||||
autoUpdate: ->
|
autoUpdate: (e) ->
|
||||||
if Conf['Auto Update This'] and ThreadUpdater.online
|
ThreadUpdater.isUpdating = @checked if e
|
||||||
|
if ThreadUpdater.isUpdating and ThreadUpdater.online
|
||||||
ThreadUpdater.timeoutID = setTimeout ThreadUpdater.timeout, 1000
|
ThreadUpdater.timeoutID = setTimeout ThreadUpdater.timeout, 1000
|
||||||
else
|
else
|
||||||
clearTimeout ThreadUpdater.timeoutID
|
clearTimeout ThreadUpdater.timeoutID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user