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

[tor-commits] [snowflake/master] Identify popup elements by id.



commit 8a56baa8e1b0481867bcbfbe817941c0d76d5ebb
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Mon Jul 22 16:51:33 2019 -0600

    Identify popup elements by id.
---
 proxy/static/embed.html |  6 +++---
 proxy/static/popup.js   | 11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/proxy/static/embed.html b/proxy/static/embed.html
index 176f4c3..b0820fa 100644
--- a/proxy/static/embed.html
+++ b/proxy/static/embed.html
@@ -10,9 +10,9 @@
   </head>
   <body>
     <div id="active">
-      <img src="assets/status-off.png" />
-      <p>Snowflake is off</p>
-      <p></p>
+      <img id="statusimg" src="assets/status-off.png" />
+      <p id="statustext">Snowflake is off</p>
+      <p id="statusdesc"></p>
     </div>
     <div class="b button">
       <label id="toggle" for="enabled">Turn On</label>
diff --git a/proxy/static/popup.js b/proxy/static/popup.js
index 5fd2142..7060054 100644
--- a/proxy/static/popup.js
+++ b/proxy/static/popup.js
@@ -3,18 +3,19 @@
 class Popup {
   constructor() {
     this.div = document.getElementById('active');
-    this.ps = this.div.querySelectorAll('p');
-    this.img = this.div.querySelector('img');
+    this.statustext = document.getElementById('statustext');
+    this.statusdesc = document.getElementById('statusdesc');
+    this.img = document.getElementById('statusimg');
   }
   setImgSrc(src) {
     this.img.src = `assets/status-${src}.png`;
   }
   setStatusText(txt) {
-    this.ps[0].innerText = txt;
+    this.statustext.innerText = txt;
   }
   setStatusDesc(desc, color) {
-    this.ps[1].innerText = desc;
-    this.ps[1].style.color = color || 'black';
+    this.statusdesc.innerText = desc;
+    this.statusdesc.style.color = color || 'black';
   }
   hideButton() {
     document.querySelector('.button').style.display = 'none';



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits