From 526389b2d380177490605037fdc3a24ebc688fac Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 20:56:30 +0300 Subject: update notify_* calls to use Notify --- js/common.js | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'js/common.js') diff --git a/js/common.js b/js/common.js index 4b5165979..ec6381e31 100755 --- a/js/common.js +++ b/js/common.js @@ -217,6 +217,8 @@ const Notify = { }, msg: function(msg, keep, kind) { kind = kind || this.KIND_GENERIC; + keep = keep || false; + const notify = $("notify"); window.clearTimeout(this.timeout); @@ -232,7 +234,7 @@ const Notify = { notify.className = "notify"; - console.log('notify', msg, kind); + console.warn('notify', msg, kind); switch (kind) { case this.KIND_INFO: @@ -252,7 +254,7 @@ const Notify = { if (icon) msgfmt = "".replace("%s", icon) + msgfmt; msgfmt += (" ") + __("Click to close") + "\" onclick=\"Notify.close()\">") .replace("%s", getInitParam("icon_cross")); notify.innerHTML = msgfmt; @@ -265,33 +267,19 @@ const Notify = { }, info: function(msg, keep) { + keep = keep || false; this.msg(msg, keep, this.KIND_INFO); }, progress: function(msg, keep) { + keep = keep || true; this.msg(msg, keep, this.KIND_PROGRESS); }, - error: function(msg) { - this.msg(msg, true, this.KIND_ERROR); + error: function(msg, keep) { + keep = keep || true; + this.msg(msg, keep, this.KIND_ERROR); } }; -function notify(msg, no_hide) { - notify_real(msg, no_hide, 1); -} - -function notify_progress(msg, no_hide) { - notify_real(msg, no_hide, 2); -} - -function notify_error(msg, no_hide) { - notify_real(msg, no_hide, 3); - -} - -function notify_info(msg, no_hide) { - notify_real(msg, no_hide, 4); -} - // noinspection JSUnusedGlobalSymbols function displayIfChecked(checkbox, elemId) { if (checkbox.checked) { @@ -359,7 +347,7 @@ function fatalError(code, msg, ext_info) { function uploadIconHandler(rc) { switch (rc) { case 0: - notify_info("Upload complete."); + Notify.info("Upload complete."); if (App.isPrefs()) { Feeds.reload(); } else { @@ -367,10 +355,10 @@ function uploadIconHandler(rc) { } break; case 1: - notify_error("Upload failed: icon is too big."); + Notify.error("Upload failed: icon is too big."); break; case 2: - notify_error("Upload failed."); + Notify.error("Upload failed."); break; } } -- cgit v1.2.3