Add map last updated date to page

This commit is contained in:
Tyler Hallada 2017-12-01 10:58:07 -05:00
parent 2e4faa70c6
commit b3e6a15142
2 changed files with 14 additions and 2 deletions

View File

@ -75,7 +75,8 @@
View the server map View the server map
</a> </a>
<p class="small-text"> <p class="small-text">
Map is updated every day around 3 am EST. Map is updated every day around 3 am EST. Last updated:&nbsp;
<span id="map-last-updated" class="small-text"></span>
</p> </p>
<h2>Server Log</h2> <h2>Server Log</h2>
@ -90,9 +91,10 @@
<p class="small-text">Updated every 10 seconds.</p> <p class="small-text">Updated every 10 seconds.</p>
</div> </div>
<script src="https://mcapi.us/scripts/minecraft.js"></script> <script src="https://mcapi.us/scripts/minecraft.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.2/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.2/moment.min.js"></script>
<script src="js/getStatus.js"></script> <script src="js/getStatus.js"></script>
<script src="js/getLog.js"></script> <script src="js/getLog.js"></script>
<script src="js/getMapUpdate.js"></script>
</body> </body>
</html> </html>

10
js/getMapUpdate.js Normal file
View File

@ -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();