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*
|
## 3.2.0 - *2013-04-23*
|
||||||
|
|
||||||
- The top and bottom original board lists are now optional, disabled by default.
|
- 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[key] = val
|
||||||
item
|
item
|
||||||
<% if (type === 'crx') { %>
|
<% 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
|
# https://developer.chrome.com/extensions/storage.html
|
||||||
$.delete = (keys) ->
|
$.delete = (keys) ->
|
||||||
chrome.storage.sync.remove keys
|
chrome.storage.sync.remove keys
|
||||||
@ -229,14 +246,41 @@ $.get = (key, val, cb) ->
|
|||||||
else
|
else
|
||||||
items = key
|
items = key
|
||||||
cb = val
|
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 ->
|
$.set = do ->
|
||||||
items = {}
|
items = {}
|
||||||
|
localItems = {}
|
||||||
|
|
||||||
set = $.debounce $.SECOND, ->
|
set = $.debounce $.SECOND, ->
|
||||||
|
for key in $.localKeys
|
||||||
|
if key of items
|
||||||
|
(localItems or= {})[key] = items[key]
|
||||||
|
delete items[key]
|
||||||
try
|
try
|
||||||
|
chrome.storage.local.set localItems
|
||||||
chrome.storage.sync.set items
|
chrome.storage.sync.set items
|
||||||
items = {}
|
items = {}
|
||||||
|
localItems = {}
|
||||||
catch err
|
catch err
|
||||||
c.error err
|
c.error err
|
||||||
|
|
||||||
|
|||||||
@ -331,11 +331,10 @@ Settings =
|
|||||||
$.get 'previousversion', null, (item) ->
|
$.get 'previousversion', null, (item) ->
|
||||||
if previous = item['previousversion']
|
if previous = item['previousversion']
|
||||||
return if previous is g.VERSION
|
return if previous is g.VERSION
|
||||||
# Avoid conflicts between sync'd newer versions
|
<% if (type === 'crx') { %>
|
||||||
# and out of date extension on this device.
|
# XXX tmp conversion: move some settings from sync to local
|
||||||
prev = previous.match(/\d+/g).map Number
|
Settings['3.2.1-update'] previous
|
||||||
curr = g.VERSION.match(/\d+/g).map Number
|
<% } %>
|
||||||
|
|
||||||
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
|
changelog = '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
|
||||||
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>."
|
||||||
@ -606,6 +605,18 @@ Settings =
|
|||||||
data.Conf[newKey] = data.Conf[prevKey] if newKey
|
data.Conf[newKey] = data.Conf[prevKey] if newKey
|
||||||
delete data.Conf[prevKey]
|
delete data.Conf[prevKey]
|
||||||
data
|
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) ->
|
filter: (section) ->
|
||||||
section.innerHTML = """
|
section.innerHTML = """
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user