mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add a WebExtUI the makes use of the new assests
The browser icon shows the on/off state.
This commit is contained in:
parent
2b1852c1a5
commit
e7f3ade068
5 changed files with 18 additions and 8 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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 ||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<!-- FIXME: Refactor snowflake.js to eliminate the need for this -->
|
||||
<div>
|
||||
<div id="status"></div>
|
||||
<textarea id="msglog" readonly></textarea>
|
||||
</div>
|
||||
<div id="webext" />
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue