Improve public screen page

This commit is contained in:
nemunaire 2017-12-17 20:44:23 +01:00
commit 11a3fc9a49
7 changed files with 220 additions and 99 deletions

View file

@ -29,6 +29,7 @@ angular.module("FICApp")
})
.filter("time", function() {
return function(input) {
input = Math.floor(input);
if (input == undefined) {
return "--";
} else if (input >= 10) {

View file

@ -38,7 +38,7 @@ angular.module("FICApp")
if (time.st > 0 && time.st <= srv_cur) {
remain = time.st + time.du - srv_cur;
} else if (time.st > 0) {
$rootScope.startIn = Math.floor(time.st - srv_cur);
$rootScope.startAt = time.st;
}
if (remain < 0) {
remain = 0;
@ -109,6 +109,26 @@ angular.module("FICApp")
refreshEvents()
$interval(refreshEvents, 2100);
})
.controller("CountdownController", function($scope, $interval) {
$scope.duration = 0;
$scope.init = function(end) {
console.log(end);
console.log(Date.parse(end)/1000);
$scope.initT(Date.parse(end)/1000);
}
$scope.initT = function(end) {
var time = angular.fromJson(sessionStorage.userService);
var srv_cur = (Date.now() + (time.cu * 1000 - time.he)) / 1000;
$scope.duration += Math.floor(end - srv_cur);
}
var stop = $interval(function() {
$scope.duration -= 1;
if ($scope.duration < -10)
$interval.cancel(stop);
}, 1000);
})
.controller("DataController", function($scope, $http, $rootScope, $interval) {
var refreshScene = function() {
$http.get("/public.json").then(function(response) {