diff --git a/proxy/init.coffee b/proxy/init.coffee index 031f7c5..22d4315 100644 --- a/proxy/init.coffee +++ b/proxy/init.coffee @@ -58,6 +58,8 @@ init = () -> ui = new BadgeUI() else if (document.getElementById('status') != null) ui = new DebugUI() + else if (document.getElementById('webext') != null) + ui = new WebExtUI() else ui = new UI() diff --git a/proxy/shims.coffee b/proxy/shims.coffee index 1aeaf3d..5c4bae0 100644 --- a/proxy/shims.coffee +++ b/proxy/shims.coffee @@ -5,7 +5,8 @@ WebRTC shims for multiple browsers. if module?.exports window = {} document = - getElementById: () -> null, + getElementById: () -> null + chrome = {} location = '' if not TESTING? or not TESTING @@ -23,6 +24,7 @@ if module?.exports else window = this document = window.document + chrome = window.chrome location = window.location.search.substr(1) PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || diff --git a/proxy/ui.coffee b/proxy/ui.coffee index d887dbd..d4d647a 100644 --- a/proxy/ui.coffee +++ b/proxy/ui.coffee @@ -42,3 +42,12 @@ class DebugUI extends UI # Scroll to latest @$msglog.value += msg + '\n' @$msglog.scrollTop = @$msglog.scrollHeight + + +class WebExtUI extends UI + setActive: (connected) => + chrome.browserAction.setIcon { + "path": { + "32": "icons/status-" + (if connected then "on" else "off") + ".png" + } + } diff --git a/proxy/webext/manifest.json b/proxy/webext/manifest.json index 83a3358..f0f671d 100644 --- a/proxy/webext/manifest.json +++ b/proxy/webext/manifest.json @@ -9,8 +9,8 @@ }, "browser_action": { "default_icon": { - "16": "icons/status-off.png", - "32": "icons/status-off@2x.png" - } + "32": "icons/status-off.png" + }, + "default_title": "Snowflake" } } diff --git a/proxy/webext/snowflake.html b/proxy/webext/snowflake.html index 6a5eca0..6d28fe6 100644 --- a/proxy/webext/snowflake.html +++ b/proxy/webext/snowflake.html @@ -8,9 +8,6 @@
-