mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Use a static label for the button
Trac: 31685
This commit is contained in:
parent
a5071ec1d6
commit
36eb07a6fc
5 changed files with 3 additions and 13 deletions
|
@ -38,7 +38,6 @@ class BadgeUI extends UI {
|
||||||
turnOn() {
|
turnOn() {
|
||||||
const clients = this.active ? 1 : 0;
|
const clients = this.active ? 1 : 0;
|
||||||
this.popup.setChecked(true);
|
this.popup.setChecked(true);
|
||||||
this.popup.setToggleText(messages.getMessage('popupTurnOff'));
|
|
||||||
if (clients > 0) {
|
if (clients > 0) {
|
||||||
this.popup.setStatusText(messages.getMessage('popupStatusOn', String(clients)));
|
this.popup.setStatusText(messages.getMessage('popupStatusOn', String(clients)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,7 +51,6 @@ class BadgeUI extends UI {
|
||||||
|
|
||||||
turnOff() {
|
turnOff() {
|
||||||
this.popup.setChecked(false);
|
this.popup.setChecked(false);
|
||||||
this.popup.setToggleText(messages.getMessage('popupTurnOn'));
|
|
||||||
this.popup.setStatusText(messages.getMessage('popupStatusOff'));
|
this.popup.setStatusText(messages.getMessage('popupStatusOff'));
|
||||||
this.popup.setStatusDesc('');
|
this.popup.setStatusDesc('');
|
||||||
this.popup.setEnabled(false);
|
this.popup.setEnabled(false);
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
"appDesc": {
|
"appDesc": {
|
||||||
"message": "Snowflake is a WebRTC pluggable transport for Tor."
|
"message": "Snowflake is a WebRTC pluggable transport for Tor."
|
||||||
},
|
},
|
||||||
"popupTurnOn": {
|
"popupEnabled": {
|
||||||
"message": "Turn On"
|
"message": "Enabled"
|
||||||
},
|
|
||||||
"popupTurnOff": {
|
|
||||||
"message": "Turn Off"
|
|
||||||
},
|
},
|
||||||
"popupLearnMore": {
|
"popupLearnMore": {
|
||||||
"message": "Learn more"
|
"message": "Learn more"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<p id="statusdesc"></p>
|
<p id="statusdesc"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="b button">
|
<div class="b button">
|
||||||
<label id="toggle" for="enabled">__MSG_popupTurnOn__</label>
|
<label id="toggle" for="enabled">__MSG_popupEnabled__</label>
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
<input id="enabled" type="checkbox" />
|
<input id="enabled" type="checkbox" />
|
||||||
<span class="slider round"></span>
|
<span class="slider round"></span>
|
||||||
|
|
|
@ -35,9 +35,6 @@ class Popup {
|
||||||
setChecked(checked) {
|
setChecked(checked) {
|
||||||
document.getElementById('enabled').checked = checked;
|
document.getElementById('enabled').checked = checked;
|
||||||
}
|
}
|
||||||
setToggleText(txt) {
|
|
||||||
document.getElementById('toggle').innerText = txt;
|
|
||||||
}
|
|
||||||
static fill(n, func) {
|
static fill(n, func) {
|
||||||
switch(n.nodeType) {
|
switch(n.nodeType) {
|
||||||
case 3: { // Node.TEXT_NODE
|
case 3: { // Node.TEXT_NODE
|
||||||
|
|
|
@ -28,7 +28,6 @@ port.onMessage.addListener((m) => {
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
popup.setChecked(true);
|
popup.setChecked(true);
|
||||||
popup.setToggleText(chrome.i18n.getMessage('popupTurnOff'));
|
|
||||||
if (clients > 0) {
|
if (clients > 0) {
|
||||||
popup.setStatusText(chrome.i18n.getMessage('popupStatusOn', String(clients)));
|
popup.setStatusText(chrome.i18n.getMessage('popupStatusOn', String(clients)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -37,7 +36,6 @@ port.onMessage.addListener((m) => {
|
||||||
popup.setStatusDesc((total > 0) ? chrome.i18n.getMessage('popupDescOn', String(total)) : '');
|
popup.setStatusDesc((total > 0) ? chrome.i18n.getMessage('popupDescOn', String(total)) : '');
|
||||||
} else {
|
} else {
|
||||||
popup.setChecked(false);
|
popup.setChecked(false);
|
||||||
popup.setToggleText(chrome.i18n.getMessage('popupTurnOn'));
|
|
||||||
popup.setStatusText(chrome.i18n.getMessage('popupStatusOff'));
|
popup.setStatusText(chrome.i18n.getMessage('popupStatusOff'));
|
||||||
popup.setStatusDesc("");
|
popup.setStatusDesc("");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue