prevent period timer counting up
This commit is contained in:
parent
d57d632458
commit
71933c91de
|
@ -52,6 +52,7 @@ function update() {
|
||||||
function startTimer(element, tenths, callback) {
|
function startTimer(element, tenths, callback) {
|
||||||
var startTime;
|
var startTime;
|
||||||
var running = false;
|
var running = false;
|
||||||
|
var set_duration = 0;
|
||||||
var duration = 0;
|
var duration = 0;
|
||||||
var className;
|
var className;
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ function startTimer(element, tenths, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has the timer run out?
|
// Has the timer run out?
|
||||||
if ((duration > 0) && (remain <= 0)) {
|
if ((set_duration > 0) && (remain <= 0)) {
|
||||||
duration = 0;
|
duration = 0;
|
||||||
sec = 0;
|
sec = 0;
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -111,6 +112,7 @@ function startTimer(element, tenths, callback) {
|
||||||
// Put element into class [cn], if set.
|
// Put element into class [cn], if set.
|
||||||
element.set = function(t, cn) {
|
element.set = function(t, cn) {
|
||||||
startTime = (new Date()).getTime();
|
startTime = (new Date()).getTime();
|
||||||
|
set_duration = t;
|
||||||
duration = t;
|
duration = t;
|
||||||
className = cn;
|
className = cn;
|
||||||
refresh();
|
refresh();
|
||||||
|
|
Loading…
Reference in New Issue