From b3e6a151423d3750f0f4894e80d68346d9f2d8d7 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 1 Dec 2017 10:58:07 -0500 Subject: [PATCH] Add map last updated date to page --- index.html | 6 ++++-- js/getMapUpdate.js | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 js/getMapUpdate.js diff --git a/index.html b/index.html index fbea989..02b2dde 100644 --- a/index.html +++ b/index.html @@ -75,7 +75,8 @@ View the server map

- Map is updated every day around 3 am EST. + Map is updated every day around 3 am EST. Last updated:  +

Server Log

@@ -90,9 +91,10 @@

Updated every 10 seconds.

- + + diff --git a/js/getMapUpdate.js b/js/getMapUpdate.js new file mode 100644 index 0000000..f5fe635 --- /dev/null +++ b/js/getMapUpdate.js @@ -0,0 +1,10 @@ +var mapUpdateTime = document.getElementById('map-last-updated'); + +function getHeaderTime () { + mapUpdateTime.textContent = moment(this.getResponseHeader("Last-Modified")).calendar(); +} + +var oReq = new XMLHttpRequest(); +oReq.open("HEAD", "/map/index.html"); +oReq.onload = getHeaderTime; +oReq.send();