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/Article.js | 6 +++--- js/CommonDialogs.js | 34 +++++++++++++++++----------------- js/CommonFilters.js | 2 +- js/Feeds.js | 10 +++++----- js/Headlines.js | 4 ++-- js/PrefFeedTree.js | 36 ++++++++++++++++++------------------ js/PrefFilterTree.js | 14 +++++++------- js/PrefHelpers.js | 26 +++++++++++++------------- js/PrefLabelTree.js | 4 ++-- js/PrefUsers.js | 12 ++++++------ js/Utils.js | 12 ++++++------ js/common.js | 36 ++++++++++++------------------------ js/prefs.js | 12 ++++++------ js/tt-rss.js | 4 ++-- 14 files changed, 100 insertions(+), 112 deletions(-) (limited to 'js') diff --git a/js/Article.js b/js/Article.js index 7e5241fa5..b48d82489 100644 --- a/js/Article.js +++ b/js/Article.js @@ -165,7 +165,7 @@ define(["dojo/_base/declare"], function (declare) { //const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length; //request_counters(unread_in_buffer == 0); - notify(""); + Notify.close(); } catch (e) { exception_error(e); @@ -187,11 +187,11 @@ define(["dojo/_base/declare"], function (declare) { style: "width: 600px", execute: function () { if (this.validate()) { - notify_progress("Saving article tags...", true); + Notify.progress("Saving article tags...", true); xhrPost("backend.php", this.attr('value'), (transport) => { try { - notify(''); + Notify.close(); dialog.hide(); const data = JSON.parse(transport.responseText); diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index efdc4e503..cac4f9be1 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -8,12 +8,12 @@ define(["dojo/_base/declare"], function (declare) { }, removeFeedIcon: function(id) { if (confirm(__("Remove stored feed icon?"))) { - notify_progress("Removing feed icon...", true); + Notify.progress("Removing feed icon...", true); const query = {op: "pref-feeds", method: "removeicon", feed_id: id}; xhrPost("backend.php", query, () => { - notify_info("Feed icon removed."); + Notify.info("Feed icon removed."); if (App.isPrefs()) { Feeds.reload(); } else { @@ -30,7 +30,7 @@ define(["dojo/_base/declare"], function (declare) { if (file.value.length == 0) { alert(__("Please select an image file to upload.")); } else if (confirm(__("Upload new icon for this feed?"))) { - notify_progress("Uploading, please wait...", true); + Notify.progress("Uploading, please wait...", true); return true; } @@ -79,7 +79,7 @@ define(["dojo/_base/declare"], function (declare) { const rc = reply['result']; - notify(''); + Notify.close(); Element.hide("feed_add_spinner"); console.log(rc); @@ -87,7 +87,7 @@ define(["dojo/_base/declare"], function (declare) { switch (parseInt(rc['code'])) { case 1: dialog.hide(); - notify_info(__("Subscribed to %s").replace("%s", feed_url)); + Notify.info(__("Subscribed to %s").replace("%s", feed_url)); Feeds.reload(); break; @@ -161,7 +161,7 @@ define(["dojo/_base/declare"], function (declare) { if (sel_rows.length > 0) { if (confirm(__("Remove selected feeds?"))) { - notify_progress("Removing selected feeds...", true); + Notify.progress("Removing selected feeds...", true); const query = { op: "pref-feeds", method: "remove", @@ -169,7 +169,7 @@ define(["dojo/_base/declare"], function (declare) { }; xhrPost("backend.php", query, () => { - notify(''); + Notify.close(); dialog.hide(); Feeds.reload(); }); @@ -244,7 +244,7 @@ define(["dojo/_base/declare"], function (declare) { if (selected.length > 0) { dijit.byId("feedBrowserDlg").hide(); - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); const query = { op: "rpc", method: "massSubscribe", @@ -252,7 +252,7 @@ define(["dojo/_base/declare"], function (declare) { }; xhrPost("backend.php", query, () => { - notify(''); + Notify.close(); Feeds.reload(); }); @@ -265,7 +265,7 @@ define(["dojo/_base/declare"], function (declare) { Element.show('feed_browser_spinner'); xhrPost("backend.php", dialog.attr("value"), (transport) => { - notify(''); + Notify.close(); Element.hide('feed_browser_spinner'); @@ -320,7 +320,7 @@ define(["dojo/_base/declare"], function (declare) { if (select) Object.extend(query, {output: "select"}); - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); xhrPost("backend.php", query, (transport) => { if (callback) { @@ -338,7 +338,7 @@ define(["dojo/_base/declare"], function (declare) { const msg = __("Unsubscribe from %s?").replace("%s", title); if (title == undefined || confirm(msg)) { - notify_progress("Removing feed..."); + Notify.progress("Removing feed..."); const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id}; @@ -381,11 +381,11 @@ define(["dojo/_base/declare"], function (declare) { style: "width: 600px", execute: function () { if (this.validate()) { - notify_progress("Saving data...", true); + Notify.progress("Saving data...", true); xhrPost("backend.php", dialog.attr('value'), () => { dialog.hide(); - notify(''); + Notify.close(); Feeds.reload(); }); } @@ -398,7 +398,7 @@ define(["dojo/_base/declare"], function (declare) { genUrlChangeKey: function(feed, is_cat) { if (confirm(__("Generate new syndication address for this feed?"))) { - notify_progress("Trying to change address...", true); + Notify.progress("Trying to change address...", true); const query = {op: "pref-feeds", method: "regenFeedKey", id: feed, is_cat: is_cat}; @@ -415,10 +415,10 @@ define(["dojo/_base/declare"], function (declare) { new Effect.Highlight(e); - notify(''); + Notify.close(); } else { - notify_error("Could not change feed URL."); + Notify.error("Could not change feed URL."); } }); } diff --git a/js/CommonFilters.js b/js/CommonFilters.js index ef087b50c..2c9c7b5a4 100644 --- a/js/CommonFilters.js +++ b/js/CommonFilters.js @@ -232,7 +232,7 @@ define(["dojo/_base/declare"], function (declare) { Element.hide("prefFilterLoadingIndicator"); - notify_error("Error while trying to get filter test results."); + Notify.error("Error while trying to get filter test results."); } else { console.log("getTestResults: dialog closed, bailing out."); diff --git a/js/Feeds.js b/js/Feeds.js index 678b42f9d..8b6f6a707 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -357,7 +357,7 @@ define(["dojo/_base/declare"], function (declare) { if (!delayed) if (!this.setExpando(feed, is_cat, (is_cat) ? 'images/indicator_tiny.gif' : 'images/indicator_white.gif')) - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); query.cat = is_cat; @@ -391,7 +391,7 @@ define(["dojo/_base/declare"], function (declare) { if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { - notify_progress("Marking all feeds as read..."); + Notify.progress("Marking all feeds as read..."); xhrPost("backend.php", {op: "feeds", method: "catchupAll"}, () => { this.requestCounters(true); @@ -458,7 +458,7 @@ define(["dojo/_base/declare"], function (declare) { search_lang: this.last_search_query[1] }; - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); xhrPost("backend.php", catchup_query, (transport) => { Utils.handleRpcJson(transport); @@ -475,7 +475,7 @@ define(["dojo/_base/declare"], function (declare) { this.reloadCurrent(); } - notify(""); + Notify.close(); }); }, catchupCurrent: function(mode) { @@ -517,7 +517,7 @@ define(["dojo/_base/declare"], function (declare) { Headlines.updateFloatingTitle(true); } - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); xhrPost("backend.php", {op: "rpc", method: "catchupFeed", feed_id: id, is_cat: false}, (transport) => { Utils.handleRpcJson(transport); diff --git a/js/Headlines.js b/js/Headlines.js index d5f680f85..68dda8d3e 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -381,7 +381,7 @@ define(["dojo/_base/declare"], function (declare) { // unpack visible articles, fill buffer more, etc this.scrollHandler(); - notify(""); + Notify.close(); }, reverse: function() { const toolbar = document.forms["main_toolbar_form"]; @@ -435,7 +435,7 @@ define(["dojo/_base/declare"], function (declare) { cmode: cmode, ids: ids.toString() }; - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", query, (transport) => { Utils.handleRpcJson(transport); diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index 7beeadd38..accc4f0e5 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -88,7 +88,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio xhrPost("backend.php", { op: "pref-feeds", search: search }, (transport) => { dijit.byId('feedConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); }, checkItemAcceptance: function(target, source, position) { @@ -119,14 +119,14 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio } }, resetFeedOrder: function() { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "pref-feeds", method: "feedsortreset"}, () => { this.reload(); }); }, resetCatOrder: function() { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "pref-feeds", method: "catsortreset"}, () => { this.reload(); @@ -134,10 +134,10 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio }, removeCategory: function(id, item) { if (confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name))) { - notify_progress("Removing category..."); + Notify.progress("Removing category..."); xhrPost("backend.php", {op: "pref-feeds", method: "removeCat", ids: id}, () => { - notify(''); + Notify.close(); this.reload(); }); } @@ -148,7 +148,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (sel_rows.length > 0) { if (confirm(__("Unsubscribe from selected feeds?"))) { - notify_progress("Unsubscribing from selected feeds...", true); + Notify.progress("Unsubscribing from selected feeds...", true); const query = { op: "pref-feeds", method: "remove", @@ -190,7 +190,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (sel_rows.length > 0) { if (confirm(__("Remove selected categories?"))) { - notify_progress("Removing selected categories..."); + Notify.progress("Removing selected categories..."); const query = { op: "pref-feeds", method: "removeCat", @@ -227,7 +227,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return; } - notify(""); + Notify.close(); if (rows.length > 1) { return this.editMultiple(); @@ -243,13 +243,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return; } - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").destroyRecursive(); xhrPost("backend.php", {op: "pref-feeds", method: "editfeeds", ids: rows.toString()}, (transport) => { - notify(""); + Notify.close(); const dialog = new dijit.Dialog({ id: "feedEditDlg", @@ -289,7 +289,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio query[key] = ["off"]; }); - notify_progress("Saving data...", true); + Notify.progress("Saving data...", true); xhrPost("backend.php", query, () => { dialog.hide(); @@ -312,7 +312,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (new_name && new_name != item.name) { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", { op: 'pref-feeds', method: 'renamecat', id: id, title: new_name }, () => { this.reload(); @@ -323,10 +323,10 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio const title = prompt(__("Category title:")); if (title) { - notify_progress("Creating category..."); + Notify.progress("Creating category..."); xhrPost("backend.php", {op: "pref-feeds", method: "addCat", cat: title}, () => { - notify(''); + Notify.close(); this.reload(); }); } @@ -344,10 +344,10 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio style: "width: 600px", execute: function () { if (this.validate()) { - notify_progress(__("Subscribing to feeds..."), true); + Notify.progress(__("Subscribing to feeds..."), true); xhrPost("backend.php", this.attr('value'), () => { - notify(""); + Notify.close(); dijit.byId("feedTree").reload(); dialog.hide(); }); @@ -376,7 +376,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (sel_rows.length > 0) { if (confirm(__("Remove selected feeds?"))) { - notify_progress("Removing selected feeds...", true); + Notify.progress("Removing selected feeds...", true); const query = { op: "pref-feeds", method: "remove", @@ -384,7 +384,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio }; xhrPost("backend.php", query, () => { - notify(''); + Notify.close(); dijit.byId("feedTree").reload(); dialog.hide(); }); diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index 6823fa8ad..4f4e02d95 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -93,11 +93,11 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio xhrPost("backend.php", { op: "pref-filters", search: search }, (transport) => { dijit.byId('filterConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); }, resetFilterOrder: function() { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "pref-filters", method: "filtersortreset"}, () => { this.reload(); @@ -112,7 +112,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio } if (confirm(__("Combine selected filters?"))) { - notify_progress("Joining filters..."); + Notify.progress("Joining filters..."); xhrPost("backend.php", {op: "pref-filters", method: "join", ids: rows.toString()}, () => { this.reload(); @@ -132,7 +132,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return; } - notify(""); + Notify.close(); this.editFilter(rows[0]); }, @@ -192,7 +192,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (confirm(msg)) { this.hide(); - notify_progress("Removing filter..."); + Notify.progress("Removing filter..."); const query = {op: "pref-filters", method: "remove", ids: this.attr('value').id}; @@ -220,7 +220,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio execute: function () { if (this.validate()) { - notify_progress("Saving data...", true); + Notify.progress("Saving data...", true); xhrPost("backend.php", dojo.formToObject("filter_edit_form"), () => { dialog.hide(); @@ -238,7 +238,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio if (sel_rows.length > 0) { if (confirm(__("Remove selected filters?"))) { - notify_progress("Removing selected filters..."); + Notify.progress("Removing selected filters..."); const query = { op: "pref-filters", method: "remove", diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index a2451f478..343253c9d 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -2,10 +2,10 @@ define(["dojo/_base/declare"], function (declare) { return declare("fox.PrefHelpers", null, { clearFeedAccessKeys: function() { if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) { - notify_progress("Clearing URLs..."); + Notify.progress("Clearing URLs..."); xhrPost("backend.php", {op: "pref-feeds", method: "clearKeys"}, () => { - notify_info("Generated URLs cleared."); + Notify.info("Generated URLs cleared."); }); } @@ -14,13 +14,13 @@ define(["dojo/_base/declare"], function (declare) { updateEventLog: function() { xhrPost("backend.php", { op: "pref-system" }, (transport) => { dijit.byId('systemConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); }, clearEventLog: function() { if (confirm(__("Clear event log?"))) { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => { this.updateEventLog(); @@ -47,7 +47,7 @@ define(["dojo/_base/declare"], function (declare) { if (sel_rows.length > 0) { if (confirm(__("Remove selected profiles? Active and default profiles will not be removed."))) { - notify_progress("Removing selected profiles...", true); + Notify.progress("Removing selected profiles...", true); const query = { op: "rpc", method: "remprofiles", @@ -55,7 +55,7 @@ define(["dojo/_base/declare"], function (declare) { }; xhrPost("backend.php", query, () => { - notify(''); + Notify.close(); Prefs.editProfiles(); }); } @@ -69,7 +69,7 @@ define(["dojo/_base/declare"], function (declare) { if (sel_rows.length == 1) { if (confirm(__("Activate selected profile?"))) { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { window.location.reload(); @@ -82,12 +82,12 @@ define(["dojo/_base/declare"], function (declare) { }, addProfile: function () { if (this.validate()) { - notify_progress("Creating profile...", true); + Notify.progress("Creating profile...", true); const query = {op: "rpc", method: "addprofile", title: dialog.attr('value').newprofile}; xhrPost("backend.php", query, () => { - notify(''); + Notify.close(); Prefs.editProfiles(); }); @@ -113,7 +113,7 @@ define(["dojo/_base/declare"], function (declare) { title: __("Customize stylesheet"), style: "width: 600px", execute: function () { - notify_progress('Saving data...', true); + Notify.progress('Saving data...', true); xhrPost("backend.php", this.attr('value'), () => { window.location.reload(); @@ -129,13 +129,13 @@ define(["dojo/_base/declare"], function (declare) { if (confirm(__("Reset to defaults?"))) { xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => { Prefs.refresh(); - notify_info(transport.responseText); + Notify.info(transport.responseText); }); } }, clearPluginData: function(name) { if (confirm(__("Clear stored data for this plugin?"))) { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => { Prefs.refresh(); @@ -145,7 +145,7 @@ define(["dojo/_base/declare"], function (declare) { refresh: function() { xhrPost("backend.php", { op: "pref-prefs" }, (transport) => { dijit.byId('genConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); } }); diff --git a/js/PrefLabelTree.js b/js/PrefLabelTree.js index abe79a114..f808e987b 100644 --- a/js/PrefLabelTree.js +++ b/js/PrefLabelTree.js @@ -51,7 +51,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f reload: function() { xhrPost("backend.php", { op: "pref-labels" }, (transport) => { dijit.byId('labelConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); }, editLabel: function(id) { @@ -142,7 +142,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f if (sel_rows.length > 0) { if (confirm(__("Remove selected labels?"))) { - notify_progress("Removing selected labels..."); + Notify.progress("Removing selected labels..."); const query = { op: "pref-labels", method: "remove", diff --git a/js/PrefUsers.js b/js/PrefUsers.js index eed64e76b..20790ec5d 100644 --- a/js/PrefUsers.js +++ b/js/PrefUsers.js @@ -9,14 +9,14 @@ define(["dojo/_base/declare"], function (declare) { xhrPost("backend.php", { op: "pref-users", sort: sort, search: search }, (transport) => { dijit.byId('userConfigTab').attr('content', transport.responseText); - notify(""); + Notify.close(); }); }, add: function() { const login = prompt(__("Please enter username:"), ""); if (login) { - notify_progress("Adding user..."); + Notify.progress("Adding user..."); xhrPost("backend.php", {op: "pref-users", method: "add", login: login}, (transport) => { alert(transport.responseText); @@ -38,7 +38,7 @@ define(["dojo/_base/declare"], function (declare) { style: "width: 600px", execute: function () { if (this.validate()) { - notify_progress("Saving data...", true); + Notify.progress("Saving data...", true); xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => { dialog.hide(); @@ -65,12 +65,12 @@ define(["dojo/_base/declare"], function (declare) { } if (confirm(__("Reset password of selected user?"))) { - notify_progress("Resetting password for selected user..."); + Notify.progress("Resetting password for selected user..."); const id = rows[0]; xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => { - notify(''); + Notify.close(); alert(transport.responseText); }); @@ -81,7 +81,7 @@ define(["dojo/_base/declare"], function (declare) { if (sel_rows.length > 0) { if (confirm(__("Remove selected users? Neither default admin nor your account will be removed."))) { - notify_progress("Removing selected users..."); + Notify.progress("Removing selected users..."); const query = { op: "pref-users", method: "remove", diff --git a/js/Utils.js b/js/Utils.js index f01ecbc48..1050cf018 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -110,7 +110,7 @@ define(["dojo/_base/declare"], function (declare) { dialog.show(); }, displayDlg: function(title, id, param, callback) { - notify_progress("Loading, please wait...", true); + Notify.progress("Loading, please wait...", true); const query = {op: "dlg", method: id, param: param}; @@ -143,7 +143,7 @@ define(["dojo/_base/declare"], function (declare) { dialog.show(); - notify(""); + Notify.close(); if (callback) callback(transport); } catch (e) { @@ -213,14 +213,14 @@ define(["dojo/_base/declare"], function (declare) { if (netalert) netalert.show(); else - notify_error("Communication problem with server."); + Notify.error("Communication problem with server."); } } catch (e) { if (netalert) netalert.show(); else - notify_error("Communication problem with server."); + Notify.error("Communication problem with server."); console.error(e); } @@ -238,7 +238,7 @@ define(["dojo/_base/declare"], function (declare) { console.log("RI:", k, "=>", v); if (k == "daemon_is_running" && v != 1) { - notify_error("Update daemon is not running.", true); + Notify.error("Update daemon is not running.", true); return; } @@ -253,7 +253,7 @@ define(["dojo/_base/declare"], function (declare) { } if (k == "daemon_stamp_ok" && v != 1) { - notify_error("Update daemon is not updating feeds.", true); + Notify.error("Update daemon is not updating feeds.", true); return; } 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; } } diff --git a/js/prefs.js b/js/prefs.js index 7c4021201..a1866f478 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -85,7 +85,7 @@ const App = { initSecondStage: function() { document.onkeydown = () => { App.hotkeyHandler(event) }; Utils.setLoadingProgress(50); - notify(""); + Notify.close(); let tab = Utils.urlParam('tab'); @@ -154,7 +154,7 @@ function opmlImportComplete(iframe) { Element.show(iframe); - notify(''); + Notify.close(); if (dijit.byId('opmlImportDlg')) dijit.byId('opmlImportDlg').destroyRecursive(); @@ -185,7 +185,7 @@ function opmlImport() { alert(__("Please choose an OPML file first.")); return false; } else { - notify_progress("Importing, please wait...", true); + Notify.progress("Importing, please wait...", true); Element.show("upload_iframe"); @@ -195,7 +195,7 @@ function opmlImport() { function opmlRegenKey() { if (confirm(__("Replace current OPML publishing address with a new one?"))) { - notify_progress("Trying to change address...", true); + Notify.progress("Trying to change address...", true); xhrJson("backend.php", { op: "pref-feeds", method: "regenOPMLKey" }, (reply) => { if (reply) { @@ -208,10 +208,10 @@ function opmlRegenKey() { new Effect.Highlight(e); - notify(''); + Notify.close(); } else { - notify_error("Could not change feed URL."); + Notify.error("Could not change feed URL."); } } }); diff --git a/js/tt-rss.js b/js/tt-rss.js index 4eeeed131..481386114 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -478,7 +478,7 @@ const App = { Utils.helpDialog("main"); }; this.hotkey_actions["toggle_combined_mode"] = function () { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); const value = App.isCombinedMode() ? "false" : "true"; @@ -491,7 +491,7 @@ const App = { }) }; this.hotkey_actions["toggle_cdm_expanded"] = function () { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); const value = getInitParam("cdm_expanded") ? "false" : "true"; -- cgit v1.2.3