Too much things

This commit is contained in:
nemunaire 2016-01-25 03:09:22 +01:00
parent d35bdca3b1
commit f3a15b00e9
15 changed files with 640 additions and 17 deletions

View file

@ -32,7 +32,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
$rootScope.time = {};
function updTime() {
$timeout(updTime, 1000);
$timeout.cancel($rootScope.cbm);
$rootScope.cbm = $timeout(updTime, 1000);
if (sessionStorage.userService) {
var time = angular.fromJson(sessionStorage.userService);
var srv_cur = (Date.now() + (time.cu * 1000 - time.he)) / 1000;
@ -110,7 +111,8 @@ angular.module("FICApp")
}
$rootScope.refresh = function(justMy) {
if (!justMy) {
$timeout($rootScope.refresh, 42000);
$timeout.cancel($scope.cbr);
$scope.cbr = $timeout($rootScope.refresh, 42000);
$http.get("/time.json").success(function(time) {
time.he = (new Date()).getTime();
sessionStorage.userService = angular.toJson(time);
@ -177,7 +179,8 @@ angular.module("FICApp")
var waitMy = function() {
if (!$scope.my || !$scope.my.exercices || !$scope.my.exercices[$rootScope.current_exercice]) {
$timeout(waitMy, 420);
$timeout.cancel($scope.cbs);
$scope.cbs = $timeout(waitMy, 420);
} else {
angular.forEach($scope.my.exercices[$rootScope.current_exercice].keys, function(key,kid) {
this.push({
@ -228,7 +231,8 @@ angular.module("FICApp")
if ($scope.my.exercices[$rootScope.current_exercice].solved_time != my.exercices[$rootScope.current_exercice].solved_time) {
$rootScope.refresh();
} else {
$timeout(checkDiff, 750);
$timeout.cancel($scope.cbd);
$scope.cbd = $timeout(checkDiff, 750);
}
});
};
@ -293,7 +297,8 @@ angular.module("FICApp")
$rootScope.message = "";
$rootScope.refresh();
} else {
$timeout(checkDiff, 750);
$timeout.cancel($scope.cbt);
$scope.cbt = $timeout(checkDiff, 750);
}
});
};