clock_status.htm 906 B

123456789101112131415161718192021222324252627282930313233343536
  1. <%+cbi/valueheader%>
  2. <script type="text/javascript">//<![CDATA[
  3. XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>', null,
  4. function(x, rv)
  5. {
  6. var s = document.getElementById('<%=self.option%>-clock-status');
  7. if (s)
  8. {
  9. s.innerHTML = rv.timestring || '?';
  10. }
  11. }
  12. );
  13. function sync_clock(btn)
  14. {
  15. btn.disabled = true;
  16. btn.value = '<%:Synchronizing...%>';
  17. XHR.get('<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>',
  18. { set: Math.floor((new Date()).getTime() / 1000) },
  19. function()
  20. {
  21. btn.disabled = false;
  22. btn.value = '<%:Sync with browser%>';
  23. }
  24. );
  25. return false;
  26. }
  27. //]]></script>
  28. <span id="<%=self.option%>-clock-status"><em><%:Collecting data...%></em></span>
  29. <input type="button" class="cbi-button cbi-button-apply" value="<%:Sync with browser%>" onclick="return sync_clock(this)" />
  30. <%+cbi/valuefooter%>