mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -04:00
Start on popup
This commit is contained in:
parent
11efa42e4c
commit
91255463c6
6 changed files with 87 additions and 16 deletions
|
@ -11,6 +11,7 @@
|
|||
"default_icon": {
|
||||
"32": "icons/status-off.png"
|
||||
},
|
||||
"default_title": "Snowflake"
|
||||
"default_title": "Snowflake",
|
||||
"default_popup": "popup.html"
|
||||
}
|
||||
}
|
||||
|
|
19
proxy/webext/popup.css
Normal file
19
proxy/webext/popup.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
body {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
#active {
|
||||
padding: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.learn {
|
||||
padding-top: 1em;
|
||||
border-top: 1px solid grey;
|
||||
}
|
||||
|
||||
.learn a {
|
||||
display: block;
|
||||
color: grey;
|
||||
text-decoration: none;
|
||||
}
|
17
proxy/webext/popup.html
Normal file
17
proxy/webext/popup.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<script src="popup.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="active">
|
||||
<img src="icons/status-off.png" />
|
||||
<p>Offline</p>
|
||||
</div>
|
||||
<div class="learn">
|
||||
<a target="_blank" href="https://snowflake.torproject.org/">Learn more</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
12
proxy/webext/popup.js
Normal file
12
proxy/webext/popup.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const port = chrome.runtime.connect({
|
||||
name: "popup"
|
||||
});
|
||||
|
||||
port.onMessage.addListener((m) => {
|
||||
const active = m.active;
|
||||
const div = document.getElementById('active');
|
||||
const img = div.querySelector('img');
|
||||
img.src = `icons/status-${active ? "on" : "off"}.png`;
|
||||
const p = div.querySelector('p');
|
||||
p.innerText = active ? "Connected" : "Offline";
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue