commit 36eb07a6fc1026b8b96471b72a17f578a2caff35 Author: Arlo Breault arlolra@gmail.com Date: Fri Sep 27 18:50:24 2019 -0400
Use a static label for the button
Trac: 31685 --- proxy/init-badge.js | 2 -- proxy/static/_locales/en_US/messages.json | 7 ++----- proxy/static/embed.html | 2 +- proxy/static/popup.js | 3 --- proxy/webext/embed.js | 2 -- 5 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/proxy/init-badge.js b/proxy/init-badge.js index d8d9113..7684e68 100644 --- a/proxy/init-badge.js +++ b/proxy/init-badge.js @@ -38,7 +38,6 @@ class BadgeUI extends UI { turnOn() { const clients = this.active ? 1 : 0; this.popup.setChecked(true); - this.popup.setToggleText(messages.getMessage('popupTurnOff')); if (clients > 0) { this.popup.setStatusText(messages.getMessage('popupStatusOn', String(clients))); } else { @@ -52,7 +51,6 @@ class BadgeUI extends UI {
turnOff() { this.popup.setChecked(false); - this.popup.setToggleText(messages.getMessage('popupTurnOn')); this.popup.setStatusText(messages.getMessage('popupStatusOff')); this.popup.setStatusDesc(''); this.popup.setEnabled(false); diff --git a/proxy/static/_locales/en_US/messages.json b/proxy/static/_locales/en_US/messages.json index 1ac15d9..e83a0fd 100644 --- a/proxy/static/_locales/en_US/messages.json +++ b/proxy/static/_locales/en_US/messages.json @@ -2,11 +2,8 @@ "appDesc": { "message": "Snowflake is a WebRTC pluggable transport for Tor." }, - "popupTurnOn": { - "message": "Turn On" - }, - "popupTurnOff": { - "message": "Turn Off" + "popupEnabled": { + "message": "Enabled" }, "popupLearnMore": { "message": "Learn more" diff --git a/proxy/static/embed.html b/proxy/static/embed.html index eb75c30..96bf90c 100644 --- a/proxy/static/embed.html +++ b/proxy/static/embed.html @@ -15,7 +15,7 @@ <p id="statusdesc"></p> </div> <div class="b button"> - <label id="toggle" for="enabled">__MSG_popupTurnOn__</label> + <label id="toggle" for="enabled">__MSG_popupEnabled__</label> <label class="switch"> <input id="enabled" type="checkbox" /> <span class="slider round"></span> diff --git a/proxy/static/popup.js b/proxy/static/popup.js index c59f842..80cbcc6 100644 --- a/proxy/static/popup.js +++ b/proxy/static/popup.js @@ -35,9 +35,6 @@ class Popup { setChecked(checked) { document.getElementById('enabled').checked = checked; } - setToggleText(txt) { - document.getElementById('toggle').innerText = txt; - } static fill(n, func) { switch(n.nodeType) { case 3: { // Node.TEXT_NODE diff --git a/proxy/webext/embed.js b/proxy/webext/embed.js index 85a3465..eae482f 100644 --- a/proxy/webext/embed.js +++ b/proxy/webext/embed.js @@ -28,7 +28,6 @@ port.onMessage.addListener((m) => {
if (enabled) { popup.setChecked(true); - popup.setToggleText(chrome.i18n.getMessage('popupTurnOff')); if (clients > 0) { popup.setStatusText(chrome.i18n.getMessage('popupStatusOn', String(clients))); } else { @@ -37,7 +36,6 @@ port.onMessage.addListener((m) => { popup.setStatusDesc((total > 0) ? chrome.i18n.getMessage('popupDescOn', String(total)) : ''); } else { popup.setChecked(false); - popup.setToggleText(chrome.i18n.getMessage('popupTurnOn')); popup.setStatusText(chrome.i18n.getMessage('popupStatusOff')); popup.setStatusDesc(""); }