Ignore:
Timestamp:
Nov 4, 2018, 1:09:48 PM (6 years ago)
Author:
g7moreau
Message:
  • Date in javascript
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nagios-velvice/velvice.cgi

    r376 r377  
    1717use strict;
    1818use warnings;
    19 use version; our $VERSION = version->declare('0.10.4');
     19use version; our $VERSION = version->declare('0.10.5');
    2020
    2121use CGI;
     
    165165$year += 1900;
    166166$mon++;
    167 my $date_sec = sprintf '%04i-%02i-%02i %02i:%02i:%02i', $year, $mon, $mday, $hour, $min, $sec;
     167# my $date_sec = sprintf '%04i-%02i-%02i %02i:%02i:%02i', $year, $mon, $mday, $hour, $min, $sec;
    168168my $date_min = nosbreak(sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min);
    169169
     
    196196   function refresh() {
    197197      var req = new XMLHttpRequest();
     198      var datenow = new Date();
    198199      console.log("Grabbing Value");
    199200      req.open("GET", '$cgi_script_name?only=body', true); // Grabs whatever you've written in this file
     
    201202         if (req.status == 200) {
    202203            document.getElementById('master-body').innerHTML = req.responseXML.getElementById('master-body').innerHTML;
    203             console.log("Update Page: $date_sec");
     204            console.log("Update Page at ", datenow.toLocaleTimeString());
    204205
    205206            refresh_next = req.responseXML.getElementById('master-body').getAttribute("refresh");
     
    211212               clearInterval(refresh_interval);
    212213               refresh_interval = setInterval(refresh, refresh_sec * 1000);
    213                console.log("Refresh Interval at $date_sec - ", refresh_sec);
     214               console.log("Update at ", datenow.toLocaleTimeString(), " Refresh Interval: ", refresh_sec);
    214215               document.getElementById('master-body').setAttribute("refresh", refresh_sec);
    215216               }
     
    226227      // Set the refresh() function to run every 900 seconds. 1 second would be 1000
    227228      refresh_interval = setInterval(refresh, refresh_sec * 1000);
    228       console.log("Refresh Interval at $date_sec - ", refresh_sec);
     229      console.log("Start Refresh Interval: ", refresh_sec);
    229230      }
    230231</script>
Note: See TracChangeset for help on using the changeset viewer.