mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Formatting changes & proxy delete support
This commit is contained in:
11
SB.js
11
SB.js
@@ -99,18 +99,23 @@ function configProxy() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var handler = {
|
var handler = {
|
||||||
set: function(obj, prop, value) {
|
set(obj, prop, value) {
|
||||||
SB.localConfig[prop] = value;
|
SB.localConfig[prop] = value;
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[prop]: encodeStoredItem(value)
|
[prop]: encodeStoredItem(value)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
get: function(obj, prop) {
|
|
||||||
|
get(obj, prop) {
|
||||||
let data = SB.localConfig[prop];
|
let data = SB.localConfig[prop];
|
||||||
if(data instanceof Map) data = new MapIO(prop);
|
if(data instanceof Map) data = new MapIO(prop);
|
||||||
|
|
||||||
return obj[prop] || data;
|
return obj[prop] || data;
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteProperty(obj, prop) {
|
||||||
|
chrome.storage.sync.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -131,7 +136,7 @@ function migrateOldFormats() { // Convert sponsorTimes format
|
|||||||
for (key in SB.localConfig) {
|
for (key in SB.localConfig) {
|
||||||
if (key.startsWith("sponsorTimes") && key !== "sponsorTimes" && key !== "sponsorTimesContributed") {
|
if (key.startsWith("sponsorTimes") && key !== "sponsorTimes" && key !== "sponsorTimesContributed") {
|
||||||
SB.config.sponsorTimes.set(key.substr(12), SB.config[key]);
|
SB.config.sponsorTimes.set(key.substr(12), SB.config[key]);
|
||||||
chrome.storage.sync.remove(key);
|
delete SB.config[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user