Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db0f1df790 | |||
| 64b0c4951e | |||
| 781b197f17 |
8
click.js
8
click.js
@@ -1,15 +1,15 @@
|
||||
var sndsrc;
|
||||
var click = new Audio();
|
||||
browser.webNavigation.onBeforeNavigate.addListener((details)=>{
|
||||
if (!details.url.startsWith("moz-extension://") && !details.url.startsWith("about:")) {
|
||||
chrome.webNavigation.onBeforeNavigate.addListener((details)=>{
|
||||
if (!details.url.startsWith("moz-extension://") && !details.url.startsWith("about:") && !details.url.startsWith("chrome://")) {
|
||||
if (click.src) click.play();
|
||||
}
|
||||
});
|
||||
|
||||
browser.storage.local.get({sound: null}, function({sound}) {
|
||||
chrome.storage.local.get({sound: null}, function({sound}) {
|
||||
click.src = sound;
|
||||
});
|
||||
|
||||
browser.storage.local.onChanged.addListener((changes)=>{
|
||||
chrome.storage.local.onChanged.addListener((changes)=>{
|
||||
click.src = changes.sound.newValue;
|
||||
});
|
||||
@@ -2,7 +2,7 @@
|
||||
"manifest_version": 2,
|
||||
"name": "ClickSnd",
|
||||
"version": "1.0",
|
||||
"description": "Plays a click sound when you click on a link.",
|
||||
"description": "Plays a custom sound on link click or page load.",
|
||||
"icons": {
|
||||
"48": "icon.png"
|
||||
},
|
||||
@@ -25,5 +25,10 @@
|
||||
"id": "clicksnd@wirlaburla.worlio.com",
|
||||
"update_url": "https://wirlaburla.worlio.com/software/browser-addons/updates.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"developer": {
|
||||
"name": "Nicholas G.",
|
||||
"url": "https://wirlaburla.worlio.com/"
|
||||
},
|
||||
"homepage_url": "https://wirlaburla.worlio.com/software/browser-addons/"
|
||||
}
|
||||
@@ -6,7 +6,7 @@ sndInput.onchange = function(event) {
|
||||
reader.readAsDataURL(sndInput.files[0]);
|
||||
reader.onload = function () {
|
||||
sndTest.src = reader.result;
|
||||
browser.storage.local.set({sound: reader.result});
|
||||
chrome.storage.local.set({sound: reader.result});
|
||||
};
|
||||
reader.onerror = function() {
|
||||
window.alert(reader.error);
|
||||
@@ -14,6 +14,6 @@ sndInput.onchange = function(event) {
|
||||
sndInput.value = "";
|
||||
}
|
||||
|
||||
browser.storage.local.get({sound: null}, function({sound}) {
|
||||
chrome.storage.local.get({sound: null}, function({sound}) {
|
||||
sndTest.src = sound;
|
||||
});
|
||||
Reference in New Issue
Block a user