diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | CHANGELOG.md (renamed from CHANGELOG) | 4 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | extension/icons/action-16.png | bin | 0 -> 2189 bytes | |||
| -rw-r--r-- | extension/icons/action-32.png | bin | 0 -> 2620 bytes | |||
| -rw-r--r-- | extension/icons/hang_up-16.png | bin | 0 -> 2293 bytes | |||
| -rw-r--r-- | extension/icons/hang_up-32.png | bin | 0 -> 2850 bytes | |||
| -rw-r--r-- | extension/icons/junction.png | bin | 0 -> 3153 bytes | |||
| -rw-r--r-- | extension/junction.js | 64 | ||||
| -rw-r--r-- | extension/manifest.json | 25 | ||||
| -rw-r--r-- | extension/sounds/tada.wav | bin | 0 -> 27804 bytes |
11 files changed, 105 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9daa824 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +node_modules @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - This changelog +- Firefox extension configuration +- Rudimentary state control in the extension [Unreleased]: https://gitlab.com/rbdr/junction/compare/v1.0.0...HEAD -[1.0.0]: https://gitlab.com/rbdr/junction/releases/tag/v1.0.0
\ No newline at end of file +[1.0.0]: https://gitlab.com/rbdr/junction/releases/tag/v1.0.0 @@ -1,3 +1,13 @@ # Junction -Connect people through any URL
\ No newline at end of file +Connect people through any URL + +## Extension + +### Testing on Firefox + +In order to test on firefox, first go to `about:debugging`, then click +on the `This Firefox` option. Then click on `Load Temporary Add-On` and +point the browser to the `extension/manifest.json` file. + +This will enable the extension and will allow you to use the inspector to debug. diff --git a/extension/icons/action-16.png b/extension/icons/action-16.png Binary files differnew file mode 100644 index 0000000..eb855e2 --- /dev/null +++ b/extension/icons/action-16.png diff --git a/extension/icons/action-32.png b/extension/icons/action-32.png Binary files differnew file mode 100644 index 0000000..c2da8b5 --- /dev/null +++ b/extension/icons/action-32.png diff --git a/extension/icons/hang_up-16.png b/extension/icons/hang_up-16.png Binary files differnew file mode 100644 index 0000000..b9d7515 --- /dev/null +++ b/extension/icons/hang_up-16.png diff --git a/extension/icons/hang_up-32.png b/extension/icons/hang_up-32.png Binary files differnew file mode 100644 index 0000000..08970a7 --- /dev/null +++ b/extension/icons/hang_up-32.png diff --git a/extension/icons/junction.png b/extension/icons/junction.png Binary files differnew file mode 100644 index 0000000..acdf012 --- /dev/null +++ b/extension/icons/junction.png diff --git a/extension/junction.js b/extension/junction.js new file mode 100644 index 0000000..7de7c28 --- /dev/null +++ b/extension/junction.js @@ -0,0 +1,64 @@ +const internals = { + + isInCallState: false, + + icons: { + call: { + 16: 'icons/action-16.png', + 32: 'icons/action-32.png' + }, + + hangUp: { + 16: 'icons/hang_up-16.png', + 32: 'icons/hang_up-32.png' + } + }, + + onClick() { + if (internals.isInCall()) { + return internals.hangUp(); + } + + return internals.joinAudioCall(); + }, + + async joinAudioCall() { + + internals.isInCallState = true; + internals.setIcon('hangUp'); + const tabs = await browser.tabs.query({ + currentWindow: true, + active: true + }); + + internals.createAudioElement(browser.runtime.getURL('sounds/tada.wav')); + }, + + hangUp() { + + document.querySelectorAll('audio').forEach((audioElement) => audioElement.remove()); + internals.setIcon('call'); + internals.isInCallState = false; + }, + + createAudioElement(source) { + + const audioElement = document.createElement('audio'); + audioElement.src = source; + audioElement.autoplay = 'autoplay'; + document.querySelector('body').appendChild(audioElement); + }, + + isInCall() { + return internals.isInCallState; // this should be replaced with actually checking the built stuff + }, + + setIcon(iconSet) { + + browser.browserAction.setIcon({ + path: internals.icons[iconSet] + }); + } +}; + +browser.browserAction.onClicked.addListener(internals.onClick); diff --git a/extension/manifest.json b/extension/manifest.json new file mode 100644 index 0000000..df3ecc4 --- /dev/null +++ b/extension/manifest.json @@ -0,0 +1,25 @@ +{ + "manifest_version": 2, + "name": "Junction", + "version": "1.0.0", + "description": "Jump into an audio call on any URL", + + "permissions": [ + "activeTab" + ], + + "icons": { + "48": "icons/junction.png" + }, + + "background": { + "scripts": ["junction.js"] + }, + + "browser_action": { + "default_icon": { + "16": "icons/action-16.png", + "32": "icons/action-32.png" + } + } +} diff --git a/extension/sounds/tada.wav b/extension/sounds/tada.wav Binary files differnew file mode 100644 index 0000000..b3127d1 --- /dev/null +++ b/extension/sounds/tada.wav |