ソースを参照

adding larger time to ui_main

abram 5 年 前
コミット
7642579470

+ 4 - 1
busunit/DIUv2/html/css/diustyles.css

@@ -136,7 +136,10 @@ body { letter-spacing: 0.25em; }
 
 .bkey       { width: 18vh; height: 22vh; }
 .bkeyFull   { width: 96vw; height: 96vh; }
-.bkeyNarrow { width: 12vw; height: 40vh; }
+/* .bkeyNarrow { width: 12vw; height: 40vh; } */
+.bkeyNarrow { width: 12vw; height: 25vh; }
+.bkeyTime { width:16vw; height:10vh; }
+
 .bkeyw      { width: 25vw; height: 17vh; }
 .bkeym      { width: 20vw; height: 17vh; }
 .bkeyHuge   { width: 80vw; height: 80vh; }

+ 15 - 1
busunit/DIUv2/html/index-ORG.html

@@ -554,7 +554,21 @@
       <div class='pure-g row4'>
 
         <div class='pure-u-1-6 col'>
-          <button class='bdropinp bkeyNarrow' onmousedown='_beep();' id='ui_main_dim'>DIM</button>
+
+          <div class='pure-g row'>
+
+            <div class='pure-u col'>
+              <button class='bdropinp bkeyNarrow' onmousedown='_beep();' id='ui_main_dim'>DIM</button>
+            </div>
+
+            <br>
+
+            <div class='pure-u col'>
+              <button class='bdisp bkeyTime' id='ui_main_time' style='color:#773333; font-family: monospace; font-size: 6.5vh;' >02:34</button>
+            </div>
+
+          </div>
+
         </div>
 
         <div class='pure-u-1-2 col'>

+ 33 - 1
busunit/DIUv2/html/js/diu_ui-ORG.js

@@ -18,7 +18,8 @@
  *
  */
 
-var _ADDRESS = "localhost";
+//var _ADDRESS = "localhost";
+var _ADDRESS = "192.168.0.32";
 var _URL = "http://" + _ADDRESS;
 var _PORT = 60535;
 
@@ -267,6 +268,35 @@ function _show_ui_element(to) {
 
 //------------
 
+function _update_display_time() {
+  var ele = document.getElementById("ui_main_time");
+  if (typeof ele === "undefined") { return; }
+
+  var _dt = new Date();
+
+  var _sep = ":";
+
+  if ( (_dt.getSeconds() % 2) == 0) {
+    _sep = " ";
+  }
+
+  var _hr = _dt.getHours();
+  var _min = _dt.getMinutes();
+
+  var _hr_str = _hr.toString();
+  var _min_str = _min.toString();
+
+  if (_hr < 10) { _hr_str = "0" + _hr_str; }
+  if (_min < 10) { _min_str = "0" + _min_str; }
+
+  var _time_str = _hr_str + _sep + _min_str;
+
+  //ele.innerText = _time_str;
+  ele.innerHTML = "<span style='white-space:nowrap;'>" + _time_str + "</span>";
+}
+
+//------------
+
 // volume is from [0,1]
 //
 function _process_volume(vol) {
@@ -1179,6 +1209,8 @@ function init() {
 
   _init_websocket();
 
+  window.setInterval(_update_display_time, 200);
+
   // watchdog
   //
   document.getElementById('ui_watchdog_btn').onclick = _watchdog_tripped;