2015-10-19 01:22:00 -04:00
|
|
|
var version = {
|
2015-10-19 01:30:24 -04:00
|
|
|
updateInterval: 600000,
|
2015-10-19 01:22:00 -04:00
|
|
|
intervalId: null
|
|
|
|
}
|
|
|
|
|
2015-10-23 17:02:15 -04:00
|
|
|
/**
|
|
|
|
* Checks the version and refreshes the page if a new version has been pulled
|
|
|
|
*/
|
2015-10-19 01:22:00 -04:00
|
|
|
version.checkVersion = function () {
|
|
|
|
|
2016-02-14 17:11:48 -05:00
|
|
|
$.getJSON('controllers/hash.php')
|
|
|
|
.success(function(data) {
|
2015-10-19 01:22:00 -04:00
|
|
|
// The githash variable is located in index.php
|
|
|
|
if (data && data.gitHash !== gitHash) {
|
|
|
|
window.location.reload();
|
|
|
|
window.location.href = window.location.href;
|
2016-02-14 17:11:48 -05:00
|
|
|
}
|
|
|
|
});
|
2015-10-19 01:22:00 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
version.init = function () {
|
|
|
|
|
|
|
|
this.intervalId = setInterval(function () {
|
|
|
|
this.checkVersion();
|
|
|
|
}.bind(this), this.updateInterval);
|
|
|
|
|
2016-01-07 15:34:45 -05:00
|
|
|
}
|