Compare commits

...

2 Commits

2 changed files with 6 additions and 6 deletions

View File

@ -1,15 +1,15 @@
var sndsrc; var sndsrc;
var click = new Audio(); var click = new Audio();
browser.webNavigation.onBeforeNavigate.addListener((details)=>{ chrome.webNavigation.onBeforeNavigate.addListener((details)=>{
if (!details.url.startsWith("moz-extension://") && !details.url.startsWith("about:")) { if (!details.url.startsWith("moz-extension://") && !details.url.startsWith("about:") && !details.url.startsWith("chrome://")) {
if (click.src) click.play(); if (click.src) click.play();
} }
}); });
browser.storage.local.get({sound: null}, function({sound}) { chrome.storage.local.get({sound: null}, function({sound}) {
click.src = sound; click.src = sound;
}); });
browser.storage.local.onChanged.addListener((changes)=>{ chrome.storage.local.onChanged.addListener((changes)=>{
click.src = changes.sound.newValue; click.src = changes.sound.newValue;
}); });

View File

@ -6,7 +6,7 @@ sndInput.onchange = function(event) {
reader.readAsDataURL(sndInput.files[0]); reader.readAsDataURL(sndInput.files[0]);
reader.onload = function () { reader.onload = function () {
sndTest.src = reader.result; sndTest.src = reader.result;
browser.storage.local.set({sound: reader.result}); chrome.storage.local.set({sound: reader.result});
}; };
reader.onerror = function() { reader.onerror = function() {
window.alert(reader.error); window.alert(reader.error);
@ -14,6 +14,6 @@ sndInput.onchange = function(event) {
sndInput.value = ""; sndInput.value = "";
} }
browser.storage.local.get({sound: null}, function({sound}) { chrome.storage.local.get({sound: null}, function({sound}) {
sndTest.src = sound; sndTest.src = sound;
}); });