From 71405eb0b0c4e051858bf57ef1c972488f13949d Mon Sep 17 00:00:00 2001 From: Wirlaburla Date: Fri, 11 Oct 2024 13:23:03 -0500 Subject: [PATCH] 1.0 commit --- README.md | 1 - click.js | 15 +++++++++++++++ icon.png | Bin 0 -> 1113 bytes manifest.json | 29 +++++++++++++++++++++++++++++ options.css | 12 ++++++++++++ options.html | 26 ++++++++++++++++++++++++++ options.js | 19 +++++++++++++++++++ 7 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 click.js create mode 100644 icon.png create mode 100644 manifest.json create mode 100644 options.css create mode 100644 options.html create mode 100644 options.js diff --git a/README.md b/README.md index dadd10b..df48f2c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ # ClickSnd - Firefox add-on that plays a custom sound on link click or page load \ No newline at end of file diff --git a/click.js b/click.js new file mode 100644 index 0000000..29271a8 --- /dev/null +++ b/click.js @@ -0,0 +1,15 @@ +var sndsrc; +var click = new Audio(); +browser.webNavigation.onBeforeNavigate.addListener((details)=>{ + if (!details.url.startsWith("moz-extension://") && !details.url.startsWith("about:")) { + if (click.src) click.play(); + } +}); + +browser.storage.local.get({sound: null}, function({sound}) { + click.src = sound; +}); + +browser.storage.local.onChanged.addListener((changes)=>{ + click.src = changes.sound.newValue; +}); \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..82d9f248fdf46721c5378799adda1456ead789aa GIT binary patch literal 1113 zcmV-f1g86mP)EX>4Tx04R}tkv&MmKpe$i(~43n4t5Z6h)^BGE-K;vxAeOiqYdvy3@OO2Tt|-NVP%yC~1{KKJM7Q*#yrd?Im-8D^DugLr1M zYH;2s4zr@H5}y-Km~=tnN3JU_zi}=&Ebz>*nNH0Uhl#~P2P+-Sil#<9O&n1*o$`f@ z%PQwB&RV&~TKD8H4CVBdWvu?YAB(MDx$RNq*zGNe%!-95AEQ9`F3_yo_V=-EH%|cnGjOH1{gnnV`$>Ae ztwoN2{%zpmx~(aDz~v4w_+-eY>_~o^LOu_?pV2pEfq`2fxaRiO+Q;bwkfyGZH^9Lm zFjk=Kb&q%VboTb|nO1*4mvwTrT&XpM00006VoOIv0RI600RN!9r;`8x010qNS#tmY zE+YT{E+YYWr9XB6000McNliru=n4x2FgRO3ie3N!02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00J>dL_t(&-tCz|Qo}F|MI{d>;Q(w1hv;-`H%EbPSg^qy z#W>rRLjW5Nz)>O=j5i!HX;35F+q8IfY+M1->z zz~IK1=y~sbF%egi;ImF4M5HO;rJ|tD0bkP8e}*3wFn9Q*fd2qLScS&mz4wRXON&%f z;Jx?Yy@$4KPX@P@rD9cx;f*oioCEJYIOo6^(}~78L9+ymrHhV~9w$vV@4V-@hJuBBK5Nm271@pO5LYMR3aj58?SDF?d8g z34W4@R0SC-kFkr{%8J5sWJO9R!-eo+3nL;0FCv1W!zjhz`M94>Qfopi5}}8O;JJlq zRdg-ni0H$|T6kU}jl_0}oKjrpWA^p<4L48Mow2d|K&n?t$-?(5*O2G?Z59zoy-OX6 z$T5)!=PRY4$aCwMkYnMA2#dYPpBj-=q!@nE+vzz7;azOWKTxu^DLM6ia1S;YA*u7T f@%UnkEhcY2#H@YFtLWHb00000NkvXXu0mjfHt+v0 literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..3e438ae --- /dev/null +++ b/manifest.json @@ -0,0 +1,29 @@ +{ + "manifest_version": 2, + "name": "ClickSnd", + "version": "1.0", + "description": "Plays a click sound when you click on a link.", + "icons": { + "48": "icon.png" + }, + "background": { + "scripts": [ + "click.js" + ] + }, + "permissions": [ + "webNavigation", + "storage" + ], + "options_ui": { + "browser_style": false, + "open_in_tab": true, + "page": "options.html" + }, + "browser_specific_settings": { + "gecko": { + "id": "clicksnd@wirlaburla.worlio.com", + "update_url": "https://wirlaburla.worlio.com/software/browser-addons/updates.json" + } + } +} \ No newline at end of file diff --git a/options.css b/options.css new file mode 100644 index 0000000..a86e28f --- /dev/null +++ b/options.css @@ -0,0 +1,12 @@ +body { + display: flex; + justify-content: center; +} +#group > div { + display: flex; + gap: 4px; + margin: 4px; +} +#test_results, #exeinput { + flex-grow: 1; +} \ No newline at end of file diff --git a/options.html b/options.html new file mode 100644 index 0000000..ea34b2e --- /dev/null +++ b/options.html @@ -0,0 +1,26 @@ + + + + +ClickSnd Options + + + + + + + + + + + +
ClickSnd
Options
+
+
+
+
+
+ + + + diff --git a/options.js b/options.js new file mode 100644 index 0000000..2499554 --- /dev/null +++ b/options.js @@ -0,0 +1,19 @@ +let sndInput = document.querySelector('input[name="sndfile"]'); +let sndTest = document.querySelector('audio[name="sndtest"]'); + +sndInput.onchange = function(event) { + var reader = new FileReader(); + reader.readAsDataURL(sndInput.files[0]); + reader.onload = function () { + sndTest.src = reader.result; + browser.storage.local.set({sound: reader.result}); + }; + reader.onerror = function() { + window.alert(reader.error); + } + sndInput.value = ""; +} + +browser.storage.local.get({sound: null}, function({sound}) { + sndTest.src = sound; +}); \ No newline at end of file