Move previous version check out of Setting and into Main.

Also halve the notice timeout.
This commit is contained in:
Mayhem 2014-01-19 01:05:48 +01:00
parent da203ae76a
commit c47c3ddafe
2 changed files with 11 additions and 18 deletions

View File

@ -205,6 +205,17 @@ Main =
$.event '4chanXInitFinished'
$.get 'previousversion', null, ({previousversion}) ->
return if previousversion is g.VERSION
if previousversion
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
new Notice 'info', el, 15
else
Settings.open()
$.set previousversion, g.VERSION
callbackNodes: (klass, nodes) ->
# get the nodes' length only once
len = nodes.length

View File

@ -23,23 +23,6 @@ Settings =
order: 110
open: -> Conf['Enable 4chan\'s Extension']
$.get 'previousversion', null, (item) ->
if previous = item['previousversion']
return if previous is g.VERSION
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
new Notice 'info', el, 30
else
$.on d, '4chanXInitFinished', Settings.open
# The archive list will always be updated with 4chan X updates.
Conf['archives'] = Redirect.archives
now = Date.now()
$.set
archives: Conf['archives']
lastarchivecheck: now
previousversion: g.VERSION
Settings.addSection 'Main', Settings.main
Settings.addSection 'Filter', Settings.filter
Settings.addSection 'QR', Settings.qr
@ -57,7 +40,6 @@ Settings =
localStorage.setItem '4chan-settings', JSON.stringify settings
open: (openSection) ->
$.off d, '4chanXInitFinished', Settings.open
return if Settings.dialog
$.event 'CloseMenu'