github.com/jlowellwofford/u-root@v1.0.0/pkg/sos/html/time.html (about)

     1  <head>
     2    <title>Time</title>
     3    <link rel="stylesheet" href="css/stylesheet.css">
     4    <meta charset="utf-8">
     5    <script>
     6      function sendAutoSet() {
     7        fetch("http://localhost:{{.Port}}/auto", {
     8          method: 'Post'
     9        })
    10        .then(r => r.json())
    11        .then( s => {
    12          if (s !== null) {
    13            alert(s.Error);
    14            window.location.reload();
    15          }
    16          else {
    17            window.location.reload();
    18          }
    19        })
    20        .catch(err => alert(err))
    21      }
    22  
    23      function sendManSet() {
    24        d = document.getElementById("date_field").value
    25        t = document.getElementById("time_field").value
    26        fetch("http://localhost:{{.Port}}/manual", {
    27          method: 'Post',
    28          headers: {
    29            'Accept': 'application/json',
    30            'Content-Type': 'application/json'
    31          },
    32          body: JSON.stringify({
    33            Date: d,
    34            Time: t
    35          })
    36        })
    37        .then(r => r.json())
    38        .then( s => {
    39          if (s !== null) {
    40            alert(s.Error);
    41            window.location.reload();
    42          }
    43          else {
    44            window.location.reload();
    45          }
    46        })
    47        .catch(err => alert(err))
    48      }
    49      
    50      function setOnLoad(date, time) {
    51        document.getElementById("date_field").setAttribute("value", date)
    52        document.getElementById("time_field").setAttribute("value", time)
    53      }
    54    </script>
    55  </head>
    56  <body onload="setOnLoad({{.Date}}, {{.Time}})">
    57    <div class="banner">
    58        <h1><a href="http://localhost:8000" target="_blank" class="bannerbtn">Service of Services</a></h1>
    59    </div>
    60    <div class="content">
    61      <div class="center">
    62        <h2 class="centernarrow">System Time Settings</h2>
    63        <div class="card">
    64          <div class="center">
    65            <input type="date" id="date_field">
    66            <input type="time" id="time_field">
    67            <input type="submit" id="button" class="button" value="Auto-Set" onclick=sendAutoSet()>
    68          </div>
    69        </div>
    70        <input type="submit" id="button" class="button submitbtn" value="Save" onclick=sendManSet()>
    71      </div>
    72    </div>
    73  </body>