settings: new option to postpone the activation of the given settings file
This commit is contained in:
parent
8e6b8829ea
commit
9be56fb9a2
5 changed files with 47 additions and 16 deletions
|
|
@ -84,11 +84,15 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
refreshSettingsInterval = $interval(refreshSettings, Math.floor(Math.random() * 24000) + 32000);
|
||||
|
||||
$http.get("/settings.json").then(function(response) {
|
||||
$rootScope.recvTime(response);
|
||||
var time = $rootScope.recvTime(response);
|
||||
response.data.start = new Date(response.data.start);
|
||||
response.data.end = new Date(response.data.end);
|
||||
response.data.generation = new Date(response.data.generation);
|
||||
$rootScope.settings = response.data;
|
||||
response.data.activateTime = new Date(response.data.activateTime);
|
||||
if (response.data.activateTime <= new Date(Date.now() + (time.cu - time.he)))
|
||||
$rootScope.settings = response.data;
|
||||
else
|
||||
$rootScope.settings.activateTime = response.data.activateTime;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -210,12 +214,15 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
actMenu();
|
||||
}
|
||||
|
||||
$rootScope.refresh = function(justMy) {
|
||||
$rootScope.refresh = function(justMy, justSettings) {
|
||||
if (!justMy) {
|
||||
refreshSettings();
|
||||
refreshThemes();
|
||||
$rootScope.refreshTeams();
|
||||
}
|
||||
else if (justSettings) {
|
||||
refreshSettings();
|
||||
}
|
||||
refreshMy();
|
||||
}
|
||||
$rootScope.refresh();
|
||||
|
|
|
|||
|
|
@ -144,15 +144,16 @@ angular.module("FICApp")
|
|||
"he": (new Date()).getTime(),
|
||||
};
|
||||
sessionStorage.userService = angular.toJson(time);
|
||||
return time;
|
||||
}
|
||||
|
||||
function updTime() {
|
||||
if (time && $rootScope.settings) {
|
||||
var srv_cur = new Date(Date.now() + (time.cu - time.he));
|
||||
|
||||
// Refresh on start time reached
|
||||
if (Math.floor($rootScope.settings.start / 1000) == Math.floor(srv_cur / 1000))
|
||||
$rootScope.refresh(true);
|
||||
// Refresh on start/activate time reached
|
||||
if (Math.floor($rootScope.settings.start / 1000) == Math.floor(srv_cur / 1000) ||Math.floor($rootScope.settings.activateTime / 1000) == Math.floor(srv_cur / 1000))
|
||||
$rootScope.refresh(true, true);
|
||||
|
||||
var remain = 0;
|
||||
if ($rootScope.settings.start == 0) {
|
||||
|
|
|
|||
Reference in a new issue