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",
defaultValue: 0.2,
defaultValue: 0.3,
fixed: true
}
];

View File

@ -493,7 +493,9 @@
var urlSettings = {};
(oldStorage.blackList || "").split(",").forEach(function(url){
(oldStorage.blackList || "").split(",")
.filter(function(url){return !!url.trim();})
.forEach(function(url){
var entry = urlSettings[url];
if (!entry){
entry = {url, blockMode: "block"};
@ -501,7 +503,9 @@
newStorage.urlSettings.push(entry);
}
});
(oldStorage.whiteList || "").split(",").forEach(function(url){
(oldStorage.whiteList || "").split(",")
.filter(function(url){return !!url.trim();})
.forEach(function(url){
var entry = urlSettings[url];
if (!entry){
entry = {url, blockMode: "allow"};
@ -509,7 +513,9 @@
newStorage.urlSettings.push(entry);
}
});
(oldStorage.ignoreList || "").split(",").forEach(function(url){
(oldStorage.ignoreList || "").split(",")
.filter(function(url){return !!url.trim();})
.forEach(function(url){
var entry = urlSettings[url];
if (!entry){
entry = {url, showNotifications: false};
@ -520,6 +526,11 @@
entry.showNotifications = false;
}
});
["whiteList", "blackList", "ignoreList"].forEach(function(list){
if (oldStorage.hasOwnProperty(list)){
newStorage[list] = "";
}
});
return newStorage;
}