Add a button to update the archive list. Also display the last update time.
This commit is contained in:
parent
ebfa224fe3
commit
e9b8db87d8
@ -1,5 +1,6 @@
|
|||||||
<div class="warning" #{if Conf['404 Redirect'] then 'hidden' else ''}><code>404 Redirect</code> is disabled.</div>
|
<div class="warning" #{if Conf['404 Redirect'] then 'hidden' else ''}><code>404 Redirect</code> is disabled.</div>
|
||||||
<p>Disabled selections indicate that only one archive is available for that board and redirection type.</p>
|
<p>Disabled selections indicate that only one archive is available for that board and redirection type.</p>
|
||||||
|
<p><button>Update now</button> Last updated: <time></time></p>
|
||||||
<table>
|
<table>
|
||||||
<caption>Archived boards</caption>
|
<caption>Archived boards</caption>
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Redirect =
|
|||||||
Redirect.file[boardID] = archive
|
Redirect.file[boardID] = archive
|
||||||
return
|
return
|
||||||
|
|
||||||
update: ->
|
update: (cb) ->
|
||||||
$.get 'lastarchivecheck', 0, ({lastarchivecheck}) ->
|
$.get 'lastarchivecheck', 0, ({lastarchivecheck}) ->
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
# Update the list of archives every 4 days.
|
# Update the list of archives every 4 days.
|
||||||
@ -46,6 +46,7 @@ Redirect =
|
|||||||
$.set
|
$.set
|
||||||
lastarchivecheck: now
|
lastarchivecheck: now
|
||||||
archives: Conf['archives']
|
archives: Conf['archives']
|
||||||
|
cb now if cb
|
||||||
|
|
||||||
to: (dest, data) ->
|
to: (dest, data) ->
|
||||||
archive = (if dest is 'search' then Redirect.thread else Redirect[dest])[data.boardID]
|
archive = (if dest is 'search' then Redirect.thread else Redirect[dest])[data.boardID]
|
||||||
|
|||||||
@ -399,6 +399,20 @@ Settings =
|
|||||||
<%= grunt.file.read('html/General/Settings-section-Archives.html').replace(/>\s+</g, '><').trim() %>
|
<%= grunt.file.read('html/General/Settings-section-Archives.html').replace(/>\s+</g, '><').trim() %>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
showLastUpdateTime = (time) ->
|
||||||
|
$('time', section).textContent = new Date(time).toLocaleString()
|
||||||
|
|
||||||
|
button = $ 'button', section
|
||||||
|
$.on button, 'click', ->
|
||||||
|
$.delete 'lastarchivecheck'
|
||||||
|
button.textContent = '...'
|
||||||
|
button.disabled = true
|
||||||
|
Redirect.update (time) ->
|
||||||
|
button.textContent = 'Updated'
|
||||||
|
showLastUpdateTime time
|
||||||
|
|
||||||
|
$.get 'lastarchivecheck', 0, ({lastarchivecheck}) -> showLastUpdateTime lastarchivecheck
|
||||||
|
|
||||||
boards = {}
|
boards = {}
|
||||||
for archive in Conf['archives']
|
for archive in Conf['archives']
|
||||||
for boardID in archive.boards
|
for boardID in archive.boards
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user