lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/info.js
Xavier Guimard 5a37df0a01 Fix #1125
2017-01-03 17:50:13 +00:00

35 lines
497 B
JavaScript

/* Timer for information page */
var i = 30;
var _go = 1;
function stop() {
_go = 0;
$('#timer').html("...");
}
function go() {
if (_go) {
$("#form").submit();
}
}
function timer() {
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout(timer, 1000);
}
$(document).ready(function() {
if (activeTimer) {
window.setTimeout(go, 10000);
window.setTimeout(timer, 1000);
} else {
stop();
}
});