summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-02 20:56:30 +0300
committerAndrew Dolgov <[email protected]>2018-12-02 20:56:30 +0300
commit526389b2d380177490605037fdc3a24ebc688fac (patch)
tree65d79cebf0811e8927efeffac9f1e11b4552a63f /js/common.js
parent495248dd9783985750591c050d055ac4c2cf1712 (diff)
update notify_* calls to use Notify
Diffstat (limited to 'js/common.js')
-rwxr-xr-xjs/common.js36
1 files changed, 12 insertions, 24 deletions
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 = "<span><img src=\"%s\"></span>".replace("%s", icon) + msgfmt;
msgfmt += (" <span><img src=\"%s\" class='close' title=\"" +
- __("Click to close") + "\" onclick=\"notify('')\"></span>")
+ __("Click to close") + "\" onclick=\"Notify.close()\"></span>")
.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;
}
}