## [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
# 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.
--- /dev/null
+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);
--- /dev/null
+{
+ "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"
+ }
+ }
+}