Slightly better consistency between "reload"/"refresh"/"update" usage.

This commit is contained in:
Mayhem 2013-10-31 05:21:31 +01:00
parent 22c561b796
commit 0038f1f011
4 changed files with 8 additions and 9 deletions

View File

@ -13,5 +13,5 @@
</label> </label>
</div> </div>
<div> <div>
<input value="Update" type="button" name="Update"> <input value="Refresh thread" type="button" name="Update">
</div> </div>

View File

@ -142,7 +142,7 @@ Settings =
return return
div = $.el 'div', div = $.el 'div',
innerHTML: "<button></button><span class=description>: Clear manually-hidden threads and posts on all boards. Refresh the page to apply." innerHTML: "<button></button><span class=description>: Clear manually-hidden threads and posts on all boards. Reload the page to apply."
button = $ 'button', div button = $ 'button', div
hiddenNum = 0 hiddenNum = 0
$.get 'hiddenThreads', boards: {}, (item) -> $.get 'hiddenThreads', boards: {}, (item) ->
@ -205,7 +205,7 @@ Settings =
try try
data = JSON.parse e.target.result data = JSON.parse e.target.result
Settings.loadSettings data Settings.loadSettings data
if confirm 'Import successful. Refresh now?' if confirm 'Import successful. Reload now?'
window.location.reload() window.location.reload()
catch err catch err
output.textContent = 'Import failed due to an error.' output.textContent = 'Import failed due to an error.'

View File

@ -13,10 +13,9 @@ ThreadWatcher =
$.on d, '4chanXInitFinished', @ready $.on d, '4chanXInitFinished', @ready
switch g.VIEW switch g.VIEW
when 'index' when 'index'
$.on d, 'IndexRefresh', @cb.indexUpdate $.on d, 'IndexRefresh', @cb.onIndexRefresh
$.on d, 'IndexRefresh', @refresh
when 'thread' when 'thread'
$.on d, 'ThreadUpdate', @cb.threadUpdate $.on d, 'ThreadUpdate', @cb.onThreadRefresh
now = Date.now() now = Date.now()
if (@db.data.lastChecked or 0) < now - 2 * $.HOUR if (@db.data.lastChecked or 0) < now - 2 * $.HOUR
@ -74,7 +73,7 @@ ThreadWatcher =
$.set 'AutoWatch', threadID $.set 'AutoWatch', threadID
else if Conf['Auto Watch Reply'] else if Conf['Auto Watch Reply']
ThreadWatcher.add board.threads[threadID] ThreadWatcher.add board.threads[threadID]
indexUpdate: -> onIndexRefresh: ->
{db} = ThreadWatcher {db} = ThreadWatcher
for threadID, data of db.data.boards[g.BOARD.ID] when threadID not in g.BOARD.threads for threadID, data of db.data.boards[g.BOARD.ID] when threadID not in g.BOARD.threads
if Conf['Auto Prune'] if Conf['Auto Prune']
@ -84,7 +83,7 @@ ThreadWatcher =
db.data.lastChecked = Date.now() db.data.lastChecked = Date.now()
db.save() db.save()
ThreadWatcher.refresh() ThreadWatcher.refresh()
threadUpdate: (e) -> onThreadRefresh: (e) ->
{thread} = e.detail {thread} = e.detail
return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID} return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID}
# Update 404 status. # Update 404 status.

View File

@ -701,7 +701,7 @@ QR =
imgContainer = $.el 'div', imgContainer = $.el 'div',
className: 'captcha-img' className: 'captcha-img'
title: 'Reload' title: 'Reload reCAPTCHA'
innerHTML: '<img>' innerHTML: '<img>'
input = $.el 'input', input = $.el 'input',
className: 'captcha-input field' className: 'captcha-input field'