summaryrefslogtreecommitdiffhomepage
path: root/static/js/main.js
diff options
context:
space:
mode:
authorPrivate Island Networks Inc <opensource@privateisland.tech>2026-03-03 15:56:53 -0500
committerPrivate Island Networks Inc <opensource@privateisland.tech>2026-03-03 15:56:53 -0500
commitab6ca080771b706a310ebfd8a4192841cdfef05c (patch)
treef9da21650402f17330d68bb7d6f86b031191ddb9 /static/js/main.js
initial commit of experimental code base for PI Explorer (PI-EXP)HEADmain
Diffstat (limited to 'static/js/main.js')
-rw-r--r--static/js/main.js118
1 files changed, 118 insertions, 0 deletions
diff --git a/static/js/main.js b/static/js/main.js
new file mode 100644
index 0000000..3caa3a7
--- /dev/null
+++ b/static/js/main.js
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright (C) 2026 Private Island Networks Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * file: main.js
+ *
+ */
+
+
+"use strict";
+
+let selected_mode = MODE_LIVE;
+
+window.addEventListener("load", function(e) {
+ // re-initialize controls, as needed
+ /*
+ $('#mc-mode-live').checked=true;
+ $('#mc-filename').value = null; // clear any file that was previously selected
+
+ // set up event listeners
+ $('#mc-mode-live').addEventListener('change',wl_changeMode);
+ $('#mc-mode-file').addEventListener('change',wl_changeMode);
+ $('#mc-filename').addEventListener('change',wl_filename);
+ $('#mc-start').addEventListener('click', wl_start);
+ $('#mc-stop').addEventListener('click', wl_stop);
+ $('#mc-help').addEventListener('click', wl_help);
+ $('#mc-clear').addEventListener('click', wl_clear);
+ */
+ console.log("strict mode test: ",isStrictMode());
+});
+
+
+function wl_changeMode(event) {
+ event.preventDefault();
+ console.log('change mode: ',event.target.id);
+ if (event.target.id == "mc-mode-file") {
+ selected_mode = MODE_FILE;
+ }
+ else {
+ selected_mode = MODE_LIVE;
+ }
+}
+
+function wl_filename(event) {
+ event.preventDefault();
+ $.loading('block');
+
+ let data = { 'filename': event.target.files[0].name };
+
+ $.post("/filename", data, function(resp) {
+ console.log("filename");
+ });
+
+ $.loading('none');
+}
+
+function wl_start(event) {
+ event.preventDefault();
+ let data = { 'mode': selected_mode }
+ $.loading('block');
+
+ $.post("/start", data, function(resp) {
+ $('#mc-mode').innerText = "Running";
+ });
+ // await new Promise(r => setTimeout(r, 1000));
+ $.loading('none');
+}
+
+function wl_stop(event) {
+ event.preventDefault();
+ let data = { 'mode': MODE_IDLE }
+ $('#mc-mode').innerText = "Idle";
+ $.loading('block');
+ $.post("/stop", data, function(resp) {
+ $('#mc-mode').innerText = "Idle";
+ });
+ $.loading('none');
+}
+
+function wl_help(event) {
+ event.preventDefault();
+ m = modal('large');
+ /* jshint multistr: true */
+ m.display('<h2>GEODSS WebLogger Help:</h2> \
+ <img width=800px src="/static/fiber_tap.svg">');
+}
+
+function wl_clear(event) {
+ event.preventDefault();
+ let log = $('#mc-log');
+ while (log.firstChild) {
+ log.removeChild(log.firstChild);
+ }
+}
+
+function update_fw_version(fw_version) {
+ $('#mc-fw-version').innerText = fw_version.substring(2,4);
+}
+
+function update_fw_increment(fw_increment) {
+ $('#mc-fw-increment').innerText = fw_increment.substring(2,4);
+}
+
+function update_temperature(temperature) {
+ $('#mc-temperature').innerText = parseInt(temperature,16) + " \xB0F";
+}

Highly Recommended Verilog Books