Fix #1066.
This commit is contained in:
parent
df33758a81
commit
03ec22aa92
@ -1,3 +1,6 @@
|
||||
- Minor fixes.
|
||||
- Chrome only: Due to technical limitations, Filter lists and Custom CSS will not by synchronized across devices anymore.
|
||||
|
||||
## 3.2.0 - *2013-04-23*
|
||||
|
||||
- The top and bottom original board lists are now optional, disabled by default.
|
||||
|
||||
46
lib/$.coffee
46
lib/$.coffee
@ -220,6 +220,23 @@ $.item = (key, val) ->
|
||||
item[key] = val
|
||||
item
|
||||
<% if (type === 'crx') { %>
|
||||
$.localKeys = [
|
||||
# filters
|
||||
'name',
|
||||
'uniqueID',
|
||||
'tripcode',
|
||||
'capcode',
|
||||
'email',
|
||||
'subject',
|
||||
'comment',
|
||||
'flag',
|
||||
'filename',
|
||||
'dimensions',
|
||||
'filesize',
|
||||
'MD5',
|
||||
# custom css
|
||||
'usercss'
|
||||
]
|
||||
# https://developer.chrome.com/extensions/storage.html
|
||||
$.delete = (keys) ->
|
||||
chrome.storage.sync.remove keys
|
||||
@ -229,14 +246,41 @@ $.get = (key, val, cb) ->
|
||||
else
|
||||
items = key
|
||||
cb = val
|
||||
chrome.storage.sync.get items, cb
|
||||
|
||||
localItems = null
|
||||
syncItems = null
|
||||
for key, val of items
|
||||
if key in $.localKeys
|
||||
(localItems or= {})[key] = val
|
||||
else
|
||||
(syncItems or= {})[key] = val
|
||||
|
||||
items = {}
|
||||
count = 0
|
||||
done = (item) ->
|
||||
$.extend items, item
|
||||
cb items unless --count
|
||||
|
||||
if localItems
|
||||
count++
|
||||
chrome.storage.local.get localItems, done
|
||||
if syncItems
|
||||
count++
|
||||
chrome.storage.sync.get syncItems, done
|
||||
$.set = do ->
|
||||
items = {}
|
||||
localItems = {}
|
||||
|
||||
set = $.debounce $.SECOND, ->
|
||||
for key in $.localKeys
|
||||
if key of items
|
||||
(localItems or= {})[key] = items[key]
|
||||
delete items[key]
|
||||
try
|
||||
chrome.storage.local.set localItems
|
||||
chrome.storage.sync.set items
|
||||
items = {}
|
||||
localItems = {}
|
||||
catch err
|
||||
c.error err
|
||||
|
||||
|
||||
@ -331,11 +331,10 @@ Settings =
|
||||
$.get 'previousversion', null, (item) ->
|
||||
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
|
||||
|
||||
<% if (type === 'crx') { %>
|
||||
# XXX tmp conversion: move some settings from sync to local
|
||||
Settings['3.2.1-update'] previous
|
||||
<% } %>
|
||||
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>."
|
||||
@ -606,6 +605,18 @@ Settings =
|
||||
data.Conf[newKey] = data.Conf[prevKey] if newKey
|
||||
delete data.Conf[prevKey]
|
||||
data
|
||||
<% if (type === 'crx') { %>
|
||||
'3.2.1-update': (previous) ->
|
||||
return unless /^3\.[10]\.|^3\.2\.0$/.test previous
|
||||
items = {}
|
||||
for key in $.localKeys
|
||||
items[key] = null
|
||||
chrome.storage.sync.get items, (items) ->
|
||||
chrome.storage.sync.remove $.localKeys
|
||||
for key, val of items
|
||||
delete items[key] if val is null
|
||||
chrome.storage.local.set items
|
||||
<% } %>
|
||||
|
||||
filter: (section) ->
|
||||
section.innerHTML = """
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user