Fix mascot and theme saving

This commit is contained in:
Zixaphir 2013-08-21 03:14:38 -07:00
parent c13b3731b7
commit 2f9e7a06d7
5 changed files with 29 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* /*
* appchan x - Version 2.3.5 - 2013-08-20 * appchan x - Version 2.3.5 - 2013-08-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -20,7 +20,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.3.5 - 2013-08-20 * appchan x - Version 2.3.5 - 2013-08-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12136,10 +12136,10 @@
} }
} }
Mascots[name] = imported; Mascots[name] = imported;
$.get("userMascots", {}, function(item) { $.get("userMascots", {}, function(_arg) {
var userMascots; var userMascots;
userMascots = item['userMascots']; userMascots = _arg.userMascots;
userMascots[name] = Mascots[name]; userMascots[name] = Mascots[name];
return $.set('userMascots', userMascots); return $.set('userMascots', userMascots);
}); });
@ -15374,17 +15374,23 @@
}; };
} }
$.extend(Conf, { $.extend(Conf, {
'userThemes': [],
'userMascots': [],
'Enabled Mascots': [], 'Enabled Mascots': [],
'Enabled Mascots sfw': [], 'Enabled Mascots sfw': [],
'Enabled Mascots nsfw': [], 'Enabled Mascots nsfw': [],
'Deleted Mascots': [], 'Deleted Mascots': [],
'Hidden Categories': ["Questionable"], 'Hidden Categories': ["Questionable"],
'userThemes': {},
'userMascots': {},
'selectedArchives': {}, 'selectedArchives': {},
'CachedTitles': {} 'CachedTitles': {}
}); });
return $.get(Conf, function(items) { return $.get(Conf, function(items) {
if (items.userMascots instanceof Array) {
$.set('userMascots', items.userMascots = {});
}
if (items.userThemes instanceof Array) {
$.set('userThemes', items.userThemes = {});
}
$.extend(Conf, items); $.extend(Conf, items);
return Main.initFeatures(); return Main.initFeatures();
}); });

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* appchan x - Version 2.3.5 - 2013-08-20 * appchan x - Version 2.3.5 - 2013-08-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12129,10 +12129,10 @@
} }
} }
Mascots[name] = imported; Mascots[name] = imported;
$.get("userMascots", {}, function(item) { $.get("userMascots", {}, function(_arg) {
var userMascots; var userMascots;
userMascots = item['userMascots']; userMascots = _arg.userMascots;
userMascots[name] = Mascots[name]; userMascots[name] = Mascots[name];
return $.set('userMascots', userMascots); return $.set('userMascots', userMascots);
}); });
@ -15359,17 +15359,23 @@
}; };
} }
$.extend(Conf, { $.extend(Conf, {
'userThemes': [],
'userMascots': [],
'Enabled Mascots': [], 'Enabled Mascots': [],
'Enabled Mascots sfw': [], 'Enabled Mascots sfw': [],
'Enabled Mascots nsfw': [], 'Enabled Mascots nsfw': [],
'Deleted Mascots': [], 'Deleted Mascots': [],
'Hidden Categories': ["Questionable"], 'Hidden Categories': ["Questionable"],
'userThemes': {},
'userMascots': {},
'selectedArchives': {}, 'selectedArchives': {},
'CachedTitles': {} 'CachedTitles': {}
}); });
return $.get(Conf, function(items) { return $.get(Conf, function(items) {
if (items.userMascots instanceof Array) {
$.set('userMascots', items.userMascots = {});
}
if (items.userThemes instanceof Array) {
$.set('userThemes', items.userThemes = {});
}
$.extend(Conf, items); $.extend(Conf, items);
if (!items) { if (!items) {
new Notice('error', $.el('span', { new Notice('error', $.el('span', {

View File

@ -18,17 +18,20 @@ Main =
Conf[db] = boards: {} Conf[db] = boards: {}
$.extend Conf, $.extend Conf,
'userThemes': []
'userMascots': []
'Enabled Mascots': [] 'Enabled Mascots': []
'Enabled Mascots sfw': [] 'Enabled Mascots sfw': []
'Enabled Mascots nsfw': [] 'Enabled Mascots nsfw': []
'Deleted Mascots': [] 'Deleted Mascots': []
'Hidden Categories': ["Questionable"] 'Hidden Categories': ["Questionable"]
'userThemes': {}
'userMascots': {}
'selectedArchives': {} 'selectedArchives': {}
'CachedTitles': {} 'CachedTitles': {}
$.get Conf, (items) -> $.get Conf, (items) ->
# TempFix for accidental declaration as an array. Remove by 2.4.?
$.set 'userMascots', items.userMascots = {} if items.userMascots instanceof Array
$.set 'userThemes', items.userThemes = {} if items.userThemes instanceof Array
$.extend Conf, items $.extend Conf, items
<% if (type === 'crx') { %> <% if (type === 'crx') { %>
unless items unless items

View File

@ -315,8 +315,7 @@ MascotTools =
Mascots[name] = imported Mascots[name] = imported
$.get "userMascots", {}, (item) -> $.get "userMascots", {}, ({userMascots}) ->
userMascots = item['userMascots']
userMascots[name] = Mascots[name] userMascots[name] = Mascots[name]
$.set 'userMascots', userMascots $.set 'userMascots', userMascots