issue 24: Global and website styles show up twice

This commit is contained in:
Jason Barnabe 2012-04-27 19:17:46 -05:00
parent 1600c5235a
commit 03819cec0a

View File

@ -82,7 +82,7 @@ function getStyles(options, callback) {
} }
// now add in global ones // now add in global ones
getGlobalStyleIds(function(ids) { getGlobalStyleIds(function(ids) {
style_ids = style_ids.concat(ids); style_ids = uniqueArray(style_ids.concat(ids));
loadStyles(style_ids, options.enabled, options.url, callback); loadStyles(style_ids, options.enabled, options.url, callback);
}); });
}); });
@ -93,6 +93,12 @@ function getStyles(options, callback) {
}, reportError); }, reportError);
} }
function uniqueArray(ar) {
return ar.filter(function(s, i, a){
return i === a.lastIndexOf(s);
});
}
function getCache(callback) { function getCache(callback) {
if (isBackground()) { if (isBackground()) {
callback(cachedStyles); callback(cachedStyles);