1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-01-09 13:15:00 +01:00

Activated settings migration to 0.3

This commit is contained in:
kkapsner 2017-12-08 20:25:08 +01:00
parent 74863d3c98
commit d787b84b13
2 changed files with 37 additions and 26 deletions

View File

@ -149,7 +149,7 @@
}, },
{ {
name: "storageVersion", name: "storageVersion",
defaultValue: 0.2, defaultValue: 0.3,
fixed: true fixed: true
} }
]; ];

View File

@ -493,31 +493,42 @@
var urlSettings = {}; var urlSettings = {};
(oldStorage.blackList || "").split(",").forEach(function(url){ (oldStorage.blackList || "").split(",")
var entry = urlSettings[url]; .filter(function(url){return !!url.trim();})
if (!entry){ .forEach(function(url){
entry = {url, blockMode: "block"}; var entry = urlSettings[url];
urlSettings[url] = entry; if (!entry){
newStorage.urlSettings.push(entry); entry = {url, blockMode: "block"};
} urlSettings[url] = entry;
}); newStorage.urlSettings.push(entry);
(oldStorage.whiteList || "").split(",").forEach(function(url){ }
var entry = urlSettings[url]; });
if (!entry){ (oldStorage.whiteList || "").split(",")
entry = {url, blockMode: "allow"}; .filter(function(url){return !!url.trim();})
urlSettings[url] = entry; .forEach(function(url){
newStorage.urlSettings.push(entry); var entry = urlSettings[url];
} if (!entry){
}); entry = {url, blockMode: "allow"};
(oldStorage.ignoreList || "").split(",").forEach(function(url){ urlSettings[url] = entry;
var entry = urlSettings[url]; newStorage.urlSettings.push(entry);
if (!entry){ }
entry = {url, showNotifications: false}; });
urlSettings[url] = entry; (oldStorage.ignoreList || "").split(",")
newStorage.urlSettings.push(entry); .filter(function(url){return !!url.trim();})
} .forEach(function(url){
else { var entry = urlSettings[url];
entry.showNotifications = false; if (!entry){
entry = {url, showNotifications: false};
urlSettings[url] = entry;
newStorage.urlSettings.push(entry);
}
else {
entry.showNotifications = false;
}
});
["whiteList", "blackList", "ignoreList"].forEach(function(list){
if (oldStorage.hasOwnProperty(list)){
newStorage[list] = "";
} }
}); });