[tor-commits] [snowflake/master] Move more UI code to use specific sites
cohosh at torproject.org
cohosh at torproject.org
Sat Jul 27 16:03:34 UTC 2019
commit 03512bfa297331a66b63f789876c72c4be8ee221
Author: Arlo Breault <arlolra at gmail.com>
Date: Thu Jul 25 17:40:20 2019 -0400
Move more UI code to use specific sites
---
proxy/init-testing.js | 44 +++++++++++++++++++++++++++++++++++++++++++-
proxy/init-webext.js | 2 ++
proxy/ui.js | 41 -----------------------------------------
3 files changed, 45 insertions(+), 42 deletions(-)
diff --git a/proxy/init-testing.js b/proxy/init-testing.js
index 003f2b6..5b63099 100644
--- a/proxy/init-testing.js
+++ b/proxy/init-testing.js
@@ -1,4 +1,46 @@
-/* global TESTING, Util, Params, Config, DebugUI, UI, Broker, Snowflake */
+/* global TESTING, Util, Params, Config, UI, Broker, Snowflake */
+
+/*
+UI
+*/
+
+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;
/*
Entry point.
diff --git a/proxy/init-webext.js b/proxy/init-webext.js
index 0102385..c5caf67 100644
--- a/proxy/init-webext.js
+++ b/proxy/init-webext.js
@@ -105,6 +105,8 @@ WebExtUI.prototype.port = null;
WebExtUI.prototype.stats = null;
+WebExtUI.prototype.enabled = true;
+
/*
Entry point.
*/
diff --git a/proxy/ui.js b/proxy/ui.js
index 09d3d07..f667bef 100644
--- a/proxy/ui.js
+++ b/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;
More information about the tor-commits
mailing list