[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pluggable-transports/snowflake-webext] 07/08: refactor: get "enabled" button wrapper by id, not class name



This is an automated email from the git hooks/post-receive script.

shelikhoo pushed a commit to branch main
in repository pluggable-transports/snowflake-webext.

commit 512ccde626a316335be0027550fbe0702da596e0
Author: WofWca <wofwca@xxxxxxxxxxxxxx>
AuthorDate: Fri Jul 15 14:54:31 2022 +0300

    refactor: get "enabled" button wrapper by id, not class name
    
    As there are now two element with class "button"
---
 static/embed.html |  2 +-
 static/popup.js   | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/static/embed.html b/static/embed.html
index b0c4a95..be0e420 100644
--- a/static/embed.html
+++ b/static/embed.html
@@ -17,7 +17,7 @@
       <p id="statusdesc"></p>
       <button type="button" id="retry">__MSG_popupRetry__</button>
     </div>
-    <div class="b button">
+    <div id="enabled-wrapper" class="b button">
       <label id="toggle" for="enabled">__MSG_popupEnabled__</label>
       <label class="switch">
         <input id="enabled" type="checkbox" />
diff --git a/static/popup.js b/static/popup.js
index fa7b8ed..05bf4f8 100644
--- a/static/popup.js
+++ b/static/popup.js
@@ -28,7 +28,7 @@ class Popup {
     this.statustext = document.getElementById('statustext');
     this.statusdesc = document.getElementById('statusdesc');
     this.img = document.getElementById('statusimg');
-    this.button = document.querySelector('.button');
+    this.enabledWrapper = document.getElementById('enabled-wrapper');
     if (
       typeof SUPPORTS_WEBEXT_OPTIONAL_BACKGROUND_PERMISSION !== 'undefined'
       // eslint-disable-next-line no-undef
@@ -76,8 +76,8 @@ class Popup {
     this.statusdesc.innerText = desc;
     setClass(this.statusdesc, 'error', error);
   }
-  setButton(hide) {
-    this.button.style.display = hide ? 'none' : 'block';
+  setEnabledWrapper(hide) {
+    this.enabledWrapper.style.display = hide ? 'none' : 'block';
   }
   setRetry(display) {
     this.retry.style.display = display ? 'inline-block' : 'none';
@@ -109,7 +109,7 @@ class Popup {
     this.setStatusDesc((total > 0) ? this.getMsgFunc('popupDescOn', String(total)) : '');
     this.setEnabled(true);
     this.setActive(this.active);
-    this.setButton(false);
+    this.setEnabledWrapper(false);
     this.setRetry(false);
   }
   turnOff(desc, error, retry) {
@@ -118,7 +118,7 @@ class Popup {
     this.setStatusDesc(desc ? this.getMsgFunc(desc) : '', error);
     this.setEnabled(false);
     this.setActive(false);
-    this.setButton(error);
+    this.setEnabledWrapper(error);
     this.setRetry(retry);
   }
   missingFeature(desc) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits