mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
Allow multiple alarms being set for countdown widget
This commit is contained in:
parent
4ca434f500
commit
ac25c9b2b8
@ -86,8 +86,11 @@ var et2_countdown = /** @class */ (function (_super) {
|
|||||||
var distance = this.time.getTime() - now.getTime();
|
var distance = this.time.getTime() - now.getTime();
|
||||||
if (distance < 0)
|
if (distance < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (this.options.alarm > 0 && this.options.alarm == distance / 1000 && typeof this.onAlarm == 'function') {
|
var alarms = Array.isArray(this.options.alarm) ? this.options.alarm : [this.options.alarm];
|
||||||
this.onAlarm();
|
for (var i = 0; i <= alarms.length; i++) {
|
||||||
|
if (alarms[i] > 0 && alarms[i] == distance / 1000 && typeof this.onAlarm == 'function') {
|
||||||
|
this.onAlarm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var values = {
|
var values = {
|
||||||
days: Math.floor(distance / (1000 * 60 * 60 * 24)),
|
days: Math.floor(distance / (1000 * 60 * 60 * 24)),
|
||||||
|
@ -120,10 +120,17 @@ export class et2_countdown extends et2_valueWidget {
|
|||||||
let distance = this.time.getTime() - now.getTime();
|
let distance = this.time.getTime() - now.getTime();
|
||||||
|
|
||||||
if (distance < 0) return 0;
|
if (distance < 0) return 0;
|
||||||
if (this.options.alarm > 0 && this.options.alarm == distance/1000 && typeof this.onAlarm == 'function')
|
|
||||||
|
let alarms = Array.isArray(this.options.alarm) ? this.options.alarm : [this.options.alarm];
|
||||||
|
|
||||||
|
for (let i=0;i<=alarms.length;i++)
|
||||||
{
|
{
|
||||||
this.onAlarm();
|
if (alarms[i] > 0 && alarms[i] == distance/1000 && typeof this.onAlarm == 'function')
|
||||||
|
{
|
||||||
|
this.onAlarm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let values = {
|
let values = {
|
||||||
days: Math.floor(distance / (1000 * 60 * 60 * 24)),
|
days: Math.floor(distance / (1000 * 60 * 60 * 24)),
|
||||||
hours: Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
|
hours: Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
|
||||||
|
Loading…
Reference in New Issue
Block a user