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