/*! noticer - v0.1.1 - 2023-06-02 * https://git.zhirov.kz/alexander/noticer * Copyright Alexander Zhirov; Licensed GPL-2.0 */ class Noticer { constructor() { this.div = $('
'); this.div.css({ "position": "absolute", "top": "10px", "right": "20px", "z-index": "1000" }); $('body').append(this.div); } success(message, delay = 6000) { this.print(message, delay, '#52b818', '#bffdc0'); } warning(message, delay = 6000) { this.print(message, delay, '#b8ae18', '#f8fdbf'); } error(message, delay = 6000) { this.print(message, delay, '#b96161', '#fddede'); } print = function(message, delay, border, background) { if (delay < 6000) delay = 6000; let Timer = function(callback, delay) { let timerId, start, remaining = delay; this.pause = function() { clearTimeout(timerId); remaining -= new Date() - start; }; this.resume = function() { start = new Date(); clearTimeout(timerId); timerId = setTimeout(callback, remaining); }; this.dead = function() { clearTimeout(timerId); }; this.resume(); } let newNotice = $(`