mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Move more UI code to use specific sites
This commit is contained in:
parent
a164d61f16
commit
03512bfa29
3 changed files with 45 additions and 42 deletions
41
proxy/ui.js
41
proxy/ui.js
|
@ -15,44 +15,3 @@ class UI {
|
|||
}
|
||||
|
||||
UI.prototype.active = false;
|
||||
|
||||
UI.prototype.enabled = true;
|
||||
|
||||
|
||||
class DebugUI extends UI {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
// Setup other DOM handlers if it's debug mode.
|
||||
this.$status = document.getElementById('status');
|
||||
this.$msglog = document.getElementById('msglog');
|
||||
this.$msglog.value = '';
|
||||
}
|
||||
|
||||
// Status bar
|
||||
setStatus(msg) {
|
||||
var txt;
|
||||
txt = document.createTextNode('Status: ' + msg);
|
||||
while (this.$status.firstChild) {
|
||||
this.$status.removeChild(this.$status.firstChild);
|
||||
}
|
||||
return this.$status.appendChild(txt);
|
||||
}
|
||||
|
||||
setActive(connected) {
|
||||
super.setActive(connected);
|
||||
return this.$msglog.className = connected ? 'active' : '';
|
||||
}
|
||||
|
||||
log(msg) {
|
||||
// Scroll to latest
|
||||
this.$msglog.value += msg + '\n';
|
||||
return this.$msglog.scrollTop = this.$msglog.scrollHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// DOM elements references.
|
||||
DebugUI.prototype.$msglog = null;
|
||||
|
||||
DebugUI.prototype.$status = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue