1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-11-11 07:38:58 +01:00

Fixed logging in options.js

This commit is contained in:
kkapsner 2017-08-07 08:50:09 +02:00
parent 921c7dbd5f
commit 2cdf364334

View File

@ -16,7 +16,7 @@ browser.storage.local.get().then(function(data){
} }
// getting the translation of all the messages // getting the translation of all the messages
message("transate all messages"); logging.message("transate all messages");
traverse(document.body, function(node){ traverse(document.body, function(node){
if (node.nodeType == 3){ if (node.nodeType == 3){
var lines = node.nodeValue.replace(/\b__MSG_(.+)__\b/g, function(m, key){ var lines = node.nodeValue.replace(/\b__MSG_(.+)__\b/g, function(m, key){
@ -35,14 +35,14 @@ browser.storage.local.get().then(function(data){
} }
}); });
message("register events to store changes in local storage"); logging.message("register events to store changes in local storage");
Array.from(document.querySelectorAll("input.setting, select.setting")).forEach(function(input){ Array.from(document.querySelectorAll("input.setting, select.setting")).forEach(function(input){
var storageName = input.dataset.storageName; var storageName = input.dataset.storageName;
if (input.type === "checkbox"){ if (input.type === "checkbox"){
input.checked = settings[storageName]; input.checked = settings[storageName];
input.addEventListener("click", function(){ input.addEventListener("click", function(){
message("changed setting", storageName, ":", this.checked); logging.message("changed setting", storageName, ":", this.checked);
var value = this.checked; var value = this.checked;
var obj = {}; var obj = {};
obj[storageName] = value; obj[storageName] = value;
@ -56,7 +56,7 @@ browser.storage.local.get().then(function(data){
if (this.type === "number" || this.dataset.type === "number"){ if (this.type === "number" || this.dataset.type === "number"){
value = parseFloat(value); value = parseFloat(value);
} }
message("changed setting", storageName, ":", value); logging.message("changed setting", storageName, ":", value);
var obj = {}; var obj = {};
obj[storageName] = value; obj[storageName] = value;
browser.storage.local.set(obj); browser.storage.local.set(obj);
@ -66,7 +66,7 @@ browser.storage.local.get().then(function(data){
var callbacks = { var callbacks = {
showReleaseNotes: function(){ showReleaseNotes: function(){
verbose("open release notes"); logging.verbose("open release notes");
window.open("../releaseNotes.txt", "_blank"); window.open("../releaseNotes.txt", "_blank");
// would be nicer but is not supported in fennec // would be nicer but is not supported in fennec
// browser.windows.create({ // browser.windows.create({
@ -75,10 +75,10 @@ browser.storage.local.get().then(function(data){
// }); // });
}, },
clearPersistentRnd: function(){ clearPersistentRnd: function(){
message("clear persistent rnd storage"); logging.message("clear persistent rnd storage");
notice("empty storage"); logging.notice("empty storage");
browser.storage.local.set({persistentRndStorage: ""}); browser.storage.local.set({persistentRndStorage: ""});
notice("send message to main script"); logging.notice("send message to main script");
browser.runtime.sendMessage({"canvasBlocker-clear-domain-rnd": true}); browser.runtime.sendMessage({"canvasBlocker-clear-domain-rnd": true});
} }
}; };
@ -92,9 +92,9 @@ browser.storage.local.get().then(function(data){
}); });
function updateDisplay(){ function updateDisplay(){
notice("update display"); logging.notice("update display");
document.querySelectorAll("tr.settingRow").forEach(function(row){ document.querySelectorAll("tr.settingRow").forEach(function(row){
verbose("evaluate display dependencies for", row.setting); logging.verbose("evaluate display dependencies for", row.setting);
var displayDependencies = row.setting.displayDependencies; var displayDependencies = row.setting.displayDependencies;
if (displayDependencies){ if (displayDependencies){
row.classList[( row.classList[(