Fix bug at first install.

This commit is contained in:
Nicolas Stepien 2013-03-30 01:57:43 +01:00
parent ee58a29d11
commit 415525ae1f

View File

@ -211,21 +211,22 @@ Settings =
open: -> Conf['Enable 4chan\'s Extension']
$.get 'previousversion', null, (item) ->
return if item['previousversion'] is g.VERSION
if previous = item['previousversion']
return if previous is g.VERSION
# Avoid conflicts between sync'd newer versions
# and out of date extension on this device.
prev = previous.match(/\d+/g).map Number
curr = g.VERSION.match(/\d+/g).map Number
return unless prev[0] <= curr[0] and prev[1] <= curr[1] and prev[2] <= curr[2]
# Avoid conflicts between sync'd newer versions
# and out of date extension on this device.
prev = item['previousversion'].match(/\d+/g).map Number
curr = g.VERSION.match(/\d+/g).map Number
return unless prev[0] <= curr[0] and prev[1] <= curr[1] and prev[2] <= curr[2]
changelog = "<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md##{g.VERSION.replace(/\./g, '')}"
el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
new Notification 'info', el, 60
changelog = "<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md##{g.VERSION.replace(/\./g, '')}"
el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
new Notification 'info', el, 60
else
$.on d, '4chanXInitFinished', Settings.open
$.set 'lastupdate', Date.now()
$.set 'previousversion', g.VERSION
$.on d, '4chanXInitFinished', Settings.open unless item['previousversion']
Settings.addSection 'Main', Settings.main
Settings.addSection 'Filter', Settings.filter