mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Identify popup elements by id.
This commit is contained in:
parent
e6f7633961
commit
8a56baa8e1
2 changed files with 9 additions and 8 deletions
|
@ -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>
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue