diff --git a/proxy/ui.coffee b/proxy/ui.coffee index 0146abc..4148ea8 100644 --- a/proxy/ui.coffee +++ b/proxy/ui.coffee @@ -51,13 +51,26 @@ class DebugUI extends UI class WebExtUI extends UI port: null + stats: null constructor: -> + @initStats() chrome.runtime.onConnect.addListener @onConnect + initStats: -> + @stats = [0] + setInterval (() => + @stats.unshift 0 + @stats.splice 24 + @postActive() + ), 60 * 60 * 1000 + postActive: -> @port?.postMessage active: @active + total: @stats.reduce ((t, c) -> + t + c + ), 0 onConnect: (port) => @port = port @@ -69,6 +82,7 @@ class WebExtUI extends UI setActive: (connected) -> super connected + if connected then @stats[0] += 1 @postActive() chrome.browserAction.setIcon path: diff --git a/proxy/webext/popup.css b/proxy/webext/popup.css index 8b3d5dc..dca805c 100644 --- a/proxy/webext/popup.css +++ b/proxy/webext/popup.css @@ -5,6 +5,7 @@ body { #active { padding: 2em; text-align: center; + min-width: 128px; } .learn { diff --git a/proxy/webext/popup.html b/proxy/webext/popup.html index 3619b6c..6795b2e 100644 --- a/proxy/webext/popup.html +++ b/proxy/webext/popup.html @@ -8,7 +8,8 @@
Offline
+ +