Gonna revert this for now, was causing weird issues.
This commit is contained in:
parent
43751a00b8
commit
3d87a9cfb6
8
LICENSE
8
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.2.44 - 2013-12-27
|
||||
* 4chan X - Version 1.2.44 - 2014-01-04
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -8,11 +8,11 @@
|
||||
* http://zixaphir.github.io/appchan-x/
|
||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||
* https://github.com/aeosynth/4chan-x
|
||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* 4chan x Copyright © 2012-2014 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* https://4chan-x.just-believe.in/
|
||||
* 4chan x Copyright © 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* 4chan x Copyright © 2013-2014 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* http://seaweedchan.github.io/4chan-x/
|
||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||
* 4chan x Copyright © 2012-2014 ihavenoface
|
||||
* http://ihavenoface.github.io/4chan-x/
|
||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.2.44 - 2013-12-27
|
||||
* 4chan X - Version 1.2.44 - 2014-01-04
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -31,11 +31,11 @@
|
||||
* http://zixaphir.github.io/appchan-x/
|
||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||
* https://github.com/aeosynth/4chan-x
|
||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* 4chan x Copyright © 2012-2014 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* https://4chan-x.just-believe.in/
|
||||
* 4chan x Copyright © 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* 4chan x Copyright © 2013-2014 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* http://seaweedchan.github.io/4chan-x/
|
||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||
* 4chan x Copyright © 2012-2014 ihavenoface
|
||||
* http://ihavenoface.github.io/4chan-x/
|
||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* 4chan X - Version 1.2.44 - 2013-12-27
|
||||
* 4chan X - Version 1.2.44 - 2014-01-04
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -9,11 +9,11 @@
|
||||
* http://zixaphir.github.io/appchan-x/
|
||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||
* https://github.com/aeosynth/4chan-x
|
||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* 4chan x Copyright © 2012-2014 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||
* https://4chan-x.just-believe.in/
|
||||
* 4chan x Copyright © 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* 4chan x Copyright © 2013-2014 Jordan Bates <saudrapsmann@gmail.com>
|
||||
* http://seaweedchan.github.io/4chan-x/
|
||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||
* 4chan x Copyright © 2012-2014 ihavenoface
|
||||
* http://ihavenoface.github.io/4chan-x/
|
||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
||||
@ -772,39 +772,24 @@
|
||||
};
|
||||
|
||||
$.set = (function() {
|
||||
var items, setAll, setArea, timeout;
|
||||
items = {
|
||||
sync: {},
|
||||
local: {}
|
||||
};
|
||||
timeout = {};
|
||||
setArea = function(area) {
|
||||
if (timeout[area]) {
|
||||
return;
|
||||
}
|
||||
return chrome.storage[area].set(items[area], function() {
|
||||
if (chrome.runtime.lastError) {
|
||||
c.error(chrome.runtime.lastError.message);
|
||||
timeout[area] = setTimeout(setArea, $.MINUTE, area);
|
||||
return;
|
||||
}
|
||||
items[area] = {};
|
||||
return delete timeout[area];
|
||||
});
|
||||
};
|
||||
setAll = $.debounce($.SECOND, function() {
|
||||
var items, localItems, set;
|
||||
items = {};
|
||||
localItems = {};
|
||||
set = $.debounce($.SECOND, function() {
|
||||
var err, key, _i, _len, _ref;
|
||||
_ref = $.localKeys;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
key = _ref[_i];
|
||||
if (key in items.sync) {
|
||||
items.local[key] = items.sync[key];
|
||||
delete items.sync[key];
|
||||
if (key in items) {
|
||||
(localItems || (localItems = {}))[key] = items[key];
|
||||
delete items[key];
|
||||
}
|
||||
}
|
||||
try {
|
||||
setArea('local');
|
||||
return setArea('sync');
|
||||
chrome.storage.local.set(localItems);
|
||||
chrome.storage.sync.set(items);
|
||||
items = {};
|
||||
return localItems = {};
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
return c.error(err.stack);
|
||||
@ -812,11 +797,11 @@
|
||||
});
|
||||
return function(key, val) {
|
||||
if (typeof key === 'string') {
|
||||
items.sync[key] = val;
|
||||
items[key] = val;
|
||||
} else {
|
||||
$.extend(items.sync, key);
|
||||
$.extend(items, key);
|
||||
}
|
||||
return setAll();
|
||||
return set();
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
@ -329,38 +329,28 @@ $.get = (key, val, cb) ->
|
||||
chrome.storage.sync.get syncItems, done
|
||||
|
||||
$.set = do ->
|
||||
items =
|
||||
sync: {}
|
||||
local: {}
|
||||
timeout = {}
|
||||
items = {}
|
||||
localItems = {}
|
||||
|
||||
setArea = (area) ->
|
||||
return if timeout[area]
|
||||
chrome.storage[area].set items[area], ->
|
||||
if chrome.runtime.lastError
|
||||
c.error chrome.runtime.lastError.message
|
||||
timeout[area] = setTimeout setArea, $.MINUTE, area
|
||||
return
|
||||
items[area] = {}
|
||||
delete timeout[area]
|
||||
|
||||
setAll = $.debounce $.SECOND, ->
|
||||
set = $.debounce $.SECOND, ->
|
||||
for key in $.localKeys
|
||||
if key of items.sync
|
||||
items.local[key] = items.sync[key]
|
||||
delete items.sync[key]
|
||||
if key of items
|
||||
(localItems or= {})[key] = items[key]
|
||||
delete items[key]
|
||||
try
|
||||
setArea 'local'
|
||||
setArea 'sync'
|
||||
chrome.storage.local.set localItems
|
||||
chrome.storage.sync.set items
|
||||
items = {}
|
||||
localItems = {}
|
||||
catch err
|
||||
c.error err.stack
|
||||
|
||||
(key, val) ->
|
||||
if typeof key is 'string'
|
||||
items.sync[key] = val
|
||||
items[key] = val
|
||||
else
|
||||
$.extend items.sync, key
|
||||
setAll()
|
||||
$.extend items, key
|
||||
set()
|
||||
|
||||
<% } else { %>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user