diff --git a/js/plot.js b/js/plot.js index fa62adb..5c0a00c 100644 --- a/js/plot.js +++ b/js/plot.js @@ -3,13 +3,16 @@ window.onload = function() { var today = new Date(), year = 1900 + today.getYear(), month = today.getMonth() + 1, - urlBase = 'https://kasownik.hackerspace.pl/api/'; + urlBase = 'https://kasownik.hackerspace.pl/api/', + modified; for(i = 0; i < 12; ++i) { var xhr = new XMLHttpRequest(); xhr.open("GET", urlBase + 'month/'+ year + '/' + month + '.json', false); xhr.send(); - var res = JSON.parse(xhr.response).content, - date = new Date(year, month, 1); + var data = JSON.parse(xhr.response), + res = data.content, + date = new Date(year, month, 1); + modified = modified || data.modified; required.unshift({ x: date.getTime() / 1000, y: res.required }); paid.unshift({ x: date.getTime() / 1000, y: res.paid }); @@ -25,6 +28,8 @@ window.onload = function() { } } console.log(required, paid); + var lastmod = document.getElementById("lastmod"); + lastmod.innerHTML = modified; var palette = new Rickshaw.Color.Palette( { scheme: 'munin' } ); var graph = new Rickshaw.Graph({ element: document.getElementById("plot"), diff --git a/plot.html b/plot.html index 3274730..cbbcf54 100644 --- a/plot.html +++ b/plot.html @@ -11,7 +11,7 @@
- + Last modified: -