diff --git a/static/genmon.js b/static/genmon.js index 89b34b2a..c9a5f55b 100644 --- a/static/genmon.js +++ b/static/genmon.js @@ -253,6 +253,27 @@ function CreateSelectLists(){ option.onclick = SetTransferClick; myDiv.appendChild(option); document.getElementById("remotetransfer").innerHTML = "Start Generator and Transfer"; + + // Create Footer Links + var myFooter = document.getElementById("footer"); + var a = document.createElement('a'); + a.href = "https://github.com/jgyates/genmon"; + a.innerHTML = "GenMon Project on GitHub"; + myFooter.appendChild(a); + + var option = document.createElement("p"); + option.id = "linksep"; + myFooter.appendChild(option); + document.getElementById("linksep").innerHTML = " "; + + + var myFooter = document.getElementById("footer"); + var a = document.createElement('a'); + var PathName = window.location.href; + a.href = PathName.concat("internal"); + a.innerHTML = "Generator Registers"; + myFooter.appendChild(a); + } //***************************************************************************** @@ -521,7 +542,7 @@ function DisplaySettings(){ var url = baseurl.concat("settings"); $.getJSON(url,function(result){ - var outstr = "Settings:

"; + var outstr = "
Settings:

"; // var outstr = JSON.stringify(result, null, 4); // outstr = replaceAll(outstr,'\n','
') // outstr = replaceAll(outstr,' ',' ') diff --git a/static/index.html b/static/index.html index 610101f7..39bdb7c3 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@
- + @@ -20,6 +20,6 @@ - + diff --git a/static/internal.css b/static/internal.css new file mode 100644 index 00000000..94b81745 --- /dev/null +++ b/static/internal.css @@ -0,0 +1,86 @@ +/* BEGIN RESET*/ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +input { + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* END RESET*/ +body { + font-size: 18px; + font-weight: bold; + font-family: Arial; + background-color: white; + margin: 0; +} +header, +footer { + background-color: #f1f1f1; + clear: left; + text-align: center; + font-size: 20px +} +a { + font-style: italic; +} +h1 { + font-style: italic; + font-size: 20px +} +p { + font-size: 18px; +} +/* */ + + + +/* Hack for firefox*/ +:-moz-tree-row(hover),#days, #hours, #minutes, #quietmode, #daysep, #timesep, #modesep { + padding: 0px; +} + + + + diff --git a/static/internal.html b/static/internal.html new file mode 100644 index 00000000..46a3737d --- /dev/null +++ b/static/internal.html @@ -0,0 +1,22 @@ + + + + + Generator Registers + +
+ + + + + + + + +

+ + + + + \ No newline at end of file diff --git a/static/internal.js b/static/internal.js new file mode 100644 index 00000000..7d4194d6 --- /dev/null +++ b/static/internal.js @@ -0,0 +1,140 @@ +// internal.js - javascrip source for generator internals +// Define header +document.getElementById("myheader").innerHTML = + '
Generator Registers
'; + +window.onload = init; +var baseurl = "" +var GlobalBaseRegisters; +var InitOK = false; + +var BLACK = ''; +var RED = ''; +var ORANGE = ''; +var ColorInfo = []; + + + +//***************************************************************************** +// called on window.onload +// sets up listener events (click menu) and inits the default page +//***************************************************************************** +function init(){ + // the code to be called when the dom has loaded + + baseurl = window.location.protocol + "//" + window.location.host + "/" + "cmd/"; + setInterval(GetDisplayValues, 1000); // Called every 1 sec + setInterval(AgeEntries, (2000)); // Called every 2 sec + document.getElementById("mydisplay").innerHTML = GetDisplayValues(); + + // Create Footer Links + var myFooter = document.getElementById("footer"); + var a = document.createElement('a'); + a.href = "https://github.com/jgyates/genmon"; + a.innerHTML = "GenMon Project on GitHub"; + myFooter.appendChild(a); + + var option = document.createElement("p"); + option.id = "linksep"; + myFooter.appendChild(option); + document.getElementById("linksep").innerHTML = " "; + + + var myFooter = document.getElementById("footer"); + var a = document.createElement('a'); + a.href = window.location.protocol + "//" + window.location.host + a.innerHTML = "Generator Monitor"; + myFooter.appendChild(a); + +} + +//***************************************************************************** +// GetDisplayValues - updates display based on command sent to server +//***************************************************************************** +function GetDisplayValues() +{ + var url = baseurl.concat("registers_json"); + $.getJSON(url,function(result){ + + var RegData = result; + + var textOut = ""; + + var jsonStr = JSON.stringify(RegData.Registers["Base Registers"], null, 4); + //var jsonStr = JSON.stringify(RegData, null, 4); + //var RegData = JSON.parse(result); + document.getElementById("mydisplay").innerHTML = textOut; + + GlobalBaseRegisters = RegData; + if (InitOK == false) { + InitOK = true; + for (var i = 0; i < GlobalBaseRegisters.Registers["Base Registers"].length; i++) { + ColorInfo[i] = new Object; + ColorInfo[i].Time = new Date(); + ColorInfo[i].Color = BLACK; + } + } + }); +} +//***************************************************************************** +// AgeEntries - updates colors of output based on time elapsed +//***************************************************************************** +function AgeEntries() +{ + if (InitOK == false) { + return + } + + var CurrentTime = new Date(); + + for (var i = 0; i < GlobalBaseRegisters.Registers["Base Registers"].length; i++) { + + var difference = CurrentTime.getTime() - ColorInfo[i].Time.getTime(); + var secondsDifference = Math.floor(difference/1000); + + if (ColorInfo[i].Color == ORANGE) { + if (secondsDifference > 10) { + ColorInfo[i].Color = BLACK; + } + } + if (ColorInfo[i].Color == RED) { + if (secondsDifference > 5) { + ColorInfo[i].Color = ORANGE; + } + } + + + } + +} +