mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Set an "error" class instead of hardcoding a text color.
This commit is contained in:
parent
8a56baa8e1
commit
8f885c7557
4 changed files with 19 additions and 5 deletions
|
@ -1,5 +1,14 @@
|
|||
/* exported Popup */
|
||||
|
||||
// Add or remove a class from elem.classList, depending on cond.
|
||||
function setClass(elem, className, cond) {
|
||||
if (cond) {
|
||||
elem.classList.add(className);
|
||||
} else {
|
||||
elem.classList.remove(className);
|
||||
}
|
||||
}
|
||||
|
||||
class Popup {
|
||||
constructor() {
|
||||
this.div = document.getElementById('active');
|
||||
|
@ -13,9 +22,9 @@ class Popup {
|
|||
setStatusText(txt) {
|
||||
this.statustext.innerText = txt;
|
||||
}
|
||||
setStatusDesc(desc, color) {
|
||||
setStatusDesc(desc, error) {
|
||||
this.statusdesc.innerText = desc;
|
||||
this.statusdesc.style.color = color || 'black';
|
||||
setClass(this.statusdesc, 'error', error);
|
||||
}
|
||||
hideButton() {
|
||||
document.querySelector('.button').style.display = 'none';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue