mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Add toggle functionality to web extension
This commit is contained in:
parent
ead579a6e9
commit
799a13d385
5 changed files with 37 additions and 3 deletions
|
@ -11,4 +11,17 @@ port.onMessage.addListener((m) => {
|
|||
const clients = active ? 1 : 0;
|
||||
ps[0].innerText = `${clients} client${(clients !== 1) ? 's' : ''} connected.`;
|
||||
ps[1].innerText = `Your snowflake has helped ${m.total} user${(m.total !== 1) ? 's' : ''} circumvent censorship in the last 24 hours.`;
|
||||
const enabled = m.enabled
|
||||
const enabledText = document.getElementById('toggle');
|
||||
if (enabled) {
|
||||
document.getElementById('enabled').checked = true;
|
||||
enabledText.innerText = 'Turn Off';
|
||||
} else {
|
||||
document.getElementById('enabled').checked = false;
|
||||
enabledText.innerText = 'Turn On';
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('change', (event) => {
|
||||
port.postMessage({enabled: event.target.checked});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue