Source
this._canvas_context.font = `${font_weight} ${font_size}px ${getComputedStyle(this._contents).fontFamily}`;
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
class CWidgetClock extends CWidget {
static TYPE_ANALOG = 0;
static TYPE_DIGITAL = 1;
static HOUR_TWENTY_FOUR = 0;
static HOUR_TWELVE = 1;
static TIMEZONE_SHORT = 0;
static TIMEZONE_FULL = 1;
static TIMEZONE_LOCAL = 'local';
static SHOW_DATE = 1;
static SHOW_TIME = 2;
static SHOW_TIMEZONE = 3;
static DEFAULT_LOCALE = 'en-US';
static DEFAULT_RATIO = 1;
static MIN_FONT_SIZE = 12;
static MIN_FONT_SIZE_BIG = 24;
static LINE_HEIGHT = 1.14;
static PADDING = 10;
onInitialize() {
this._time_offset = 0;
this._interval_id = null;
this._clock_type = CWidgetClock.TYPE_ANALOG;
this._time_zone = null;
this._show_seconds = true;
this._time_format = 0;
this._tzone_format = 0;
this._show = [];
this._has_contents = false;
this._is_enabled = true;
this._canvas_context = document.createElement('canvas').getContext('2d');
this._styles = {};
this._classes = {};
}
onActivate() {
this._startClock();
}
onDeactivate() {