diff options
author | Andrew Dolgov <[email protected]> | 2018-12-02 20:56:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-02 20:56:30 +0300 |
commit | 526389b2d380177490605037fdc3a24ebc688fac (patch) | |
tree | 65d79cebf0811e8927efeffac9f1e11b4552a63f | |
parent | 495248dd9783985750591c050d055ac4c2cf1712 (diff) |
update notify_* calls to use Notify
-rw-r--r-- | classes/pref/prefs.php | 24 | ||||
-rw-r--r-- | js/Article.js | 6 | ||||
-rw-r--r-- | js/CommonDialogs.js | 34 | ||||
-rw-r--r-- | js/CommonFilters.js | 2 | ||||
-rw-r--r-- | js/Feeds.js | 10 | ||||
-rwxr-xr-x | js/Headlines.js | 4 | ||||
-rw-r--r-- | js/PrefFeedTree.js | 36 | ||||
-rw-r--r-- | js/PrefFilterTree.js | 14 | ||||
-rw-r--r-- | js/PrefHelpers.js | 26 | ||||
-rw-r--r-- | js/PrefLabelTree.js | 4 | ||||
-rw-r--r-- | js/PrefUsers.js | 12 | ||||
-rw-r--r-- | js/Utils.js | 12 | ||||
-rwxr-xr-x | js/common.js | 36 | ||||
-rwxr-xr-x | js/prefs.js | 12 | ||||
-rw-r--r-- | js/tt-rss.js | 4 | ||||
-rw-r--r-- | plugins/af_psql_trgm/init.php | 2 | ||||
-rwxr-xr-x | plugins/af_readability/init.php | 2 | ||||
-rwxr-xr-x | plugins/af_redditimgur/init.php | 2 | ||||
-rwxr-xr-x | plugins/af_zz_imgproxy/init.php | 2 | ||||
-rw-r--r-- | plugins/import_export/import_export.js | 8 | ||||
-rw-r--r-- | plugins/mail/init.php | 2 | ||||
-rw-r--r-- | plugins/mail/mail.js | 2 | ||||
-rw-r--r-- | plugins/note/note.js | 4 | ||||
-rw-r--r-- | plugins/nsfw/init.php | 2 | ||||
-rw-r--r-- | plugins/share/share.js | 8 | ||||
-rw-r--r-- | plugins/share/share_prefs.js | 4 | ||||
-rwxr-xr-x | utils/extract-i18n-js.pl | 2 | ||||
-rwxr-xr-x | utils/update-translations.sh | 4 |
28 files changed, 134 insertions, 146 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 88741447e..24c813649 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -183,7 +183,7 @@ class Pref_Prefs extends Handler_Protected { print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> evt.preventDefault(); if (this.validate()) { - notify_progress('Saving data...', true); + Notify.progress('Saving data...', true); new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), @@ -249,12 +249,12 @@ class Pref_Prefs extends Handler_Protected { print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> evt.preventDefault(); if (this.validate()) { - notify_progress('Changing password...', true); + Notify.progress('Changing password...', true); new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify(''); + Notify.close(); if (transport.responseText.indexOf('ERROR: ') == 0) { $('pwd_change_infobox').innerHTML = @@ -316,14 +316,14 @@ class Pref_Prefs extends Handler_Protected { print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> evt.preventDefault(); if (this.validate()) { - notify_progress('Disabling OTP', true); + Notify.progress('Disabling OTP', true); new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify(''); + Notify.close(); if (transport.responseText.indexOf('ERROR: ') == 0) { - notify_error(transport.responseText.replace('ERROR: ', '')); + Notify.error(transport.responseText.replace('ERROR: ', '')); } else { window.location.reload(); } @@ -367,14 +367,14 @@ class Pref_Prefs extends Handler_Protected { print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> evt.preventDefault(); if (this.validate()) { - notify_progress('Saving data...', true); + Notify.progress('Saving data...', true); new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify(''); + Notify.close(); if (transport.responseText.indexOf('ERROR:') == 0) { - notify_error(transport.responseText.replace('ERROR:', '')); + Notify.error(transport.responseText.replace('ERROR:', '')); } else { window.location.reload(); } @@ -441,7 +441,7 @@ class Pref_Prefs extends Handler_Protected { if (msg == 'PREFS_NEED_RELOAD') { window.location.reload(); } else { - notify_info(msg); + Notify.info(msg); } } } }); @@ -689,12 +689,12 @@ class Pref_Prefs extends Handler_Protected { print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> evt.preventDefault(); if (this.validate()) { - notify_progress('Saving data...', true); + Notify.progress('Saving data...', true); new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify(''); + Notify.close(); if (confirm(__('Selected plugins have been enabled. Reload?'))) { window.location.reload(); } 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("<span onclick=\"Utils.explainError(1)\">Update daemon is not running.</span>", true); + Notify.error("<span onclick=\"Utils.explainError(1)\">Update daemon is not running.</span>", true); return; } @@ -253,7 +253,7 @@ define(["dojo/_base/declare"], function (declare) { } if (k == "daemon_stamp_ok" && v != 1) { - notify_error("<span onclick=\"Utils.explainError(3)\">Update daemon is not updating feeds.</span>", true); + Notify.error("<span onclick=\"Utils.explainError(3)\">Update daemon is not updating feeds.</span>", 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 = "<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; } } 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"; diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 7787d5b37..514f5731a 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -150,7 +150,7 @@ class Af_Psql_Trgm extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index e0c57d093..8c17738c9 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -61,7 +61,7 @@ class Af_Readability extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 2b8415dd0..1958e83be 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -45,7 +45,7 @@ class Af_RedditImgur extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 1c1e99ae4..ca49e94a7 100755 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -216,7 +216,7 @@ class Af_Zz_ImgProxy extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/import_export/import_export.js b/plugins/import_export/import_export.js index 780f6bfc7..56a2a5c3e 100644 --- a/plugins/import_export/import_export.js +++ b/plugins/import_export/import_export.js @@ -14,7 +14,7 @@ function exportData() { style: "width: 600px", prepare: function() { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); new Ajax.Request("backend.php", { parameters: "op=pluginhandler&plugin=import_export&method=exportrun&offset=" + exported, @@ -53,7 +53,7 @@ function exportData() { exception_error("exportData", e, transport.responseText); } - notify(''); + Notify.close(); } }); @@ -81,7 +81,7 @@ function dataImportComplete(iframe) { Element.hide(iframe); - notify(''); + Notify.close(); if (dijit.byId('dataImportDlg')) dijit.byId('dataImportDlg').destroyRecursive(); @@ -112,7 +112,7 @@ function importData() { alert(__("Please choose the file first.")); return false; } else { - notify_progress("Importing, please wait...", true); + Notify.progress("Importing, please wait...", true); Element.show("data_upload_iframe"); diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 5294931c7..d8f92853e 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -45,7 +45,7 @@ class Mail extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js index af0cf3552..b72289c2a 100644 --- a/plugins/mail/mail.js +++ b/plugins/mail/mail.js @@ -29,7 +29,7 @@ function emailArticle(id) { if (error) { alert(__('Error sending email:') + ' ' + error); } else { - notify_info('Your message has been sent.'); + Notify.info('Your message has been sent.'); dialog.hide(); } diff --git a/plugins/note/note.js b/plugins/note/note.js index c1f317b52..836481c40 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -12,10 +12,10 @@ function editArticleNote(id) { style: "width: 600px", execute: function() { if (this.validate()) { - notify_progress("Saving article note...", true); + Notify.progress("Saving article note...", true); xhrJson("backend.php", this.attr('value'), (reply) => { - notify(''); + Notify.close(); dialog.hide(); if (reply) { diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php index 6a1ae3c65..53b9ee479 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -63,7 +63,7 @@ class NSFW extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/share/share.js b/plugins/share/share.js index 4a6a65ce6..a22e01715 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -12,7 +12,7 @@ function shareArticle(id) { newurl: function() { if (confirm(__("Generate new share URL for this article?"))) { - notify_progress("Trying to change URL...", true); + Notify.progress("Trying to change URL...", true); const query = { op: "pluginhandler", plugin: "share", method: "newkey", id: id }; @@ -34,10 +34,10 @@ function shareArticle(id) { const img = $("SHARE-IMG-" + id); if (img) img.src = img.src.replace("notshared.png", "share.png"); - notify(''); + Notify.close(); } else { - notify_error("Could not change URL."); + Notify.error("Could not change URL."); } } }); @@ -47,7 +47,7 @@ function shareArticle(id) { unshare: function() { if (confirm(__("Remove sharing for this article?"))) { - notify_progress("Trying to unshare...", true); + Notify.progress("Trying to unshare...", true); const query = { op: "pluginhandler", plugin: "share", method: "unshare", id: id }; diff --git a/plugins/share/share_prefs.js b/plugins/share/share_prefs.js index 79ca37284..92975f8f4 100644 --- a/plugins/share/share_prefs.js +++ b/plugins/share/share_prefs.js @@ -1,11 +1,11 @@ function clearArticleAccessKeys() { if (confirm(__("This will invalidate all previously shared article URLs. Continue?"))) { - notify_progress("Clearing URLs..."); + Notify.progress("Clearing URLs..."); const query = { op: "pluginhandler", plugin: "share", method: "clearArticleKeys" }; xhrPost("backend.php", query, () => { - notify_info("Shared URLs cleared."); + Notify.info("Shared URLs cleared."); }); } diff --git a/utils/extract-i18n-js.pl b/utils/extract-i18n-js.pl index d6179fc70..b51e7ce5a 100755 --- a/utils/extract-i18n-js.pl +++ b/utils/extract-i18n-js.pl @@ -5,7 +5,7 @@ use strict; while (<STDIN>) { chomp; - if (/(__|notify_progress|notify|notify_info|notify_error)\(['"](.*?)['"]\)/) { + if (/(__|Notify.progress|Notify.msg|Notify.info|Notify.error)\(['"](.*?)['"]\)/) { my $msg = $2; $msg =~ s/\"/\\\"/g; diff --git a/utils/update-translations.sh b/utils/update-translations.sh index b955ac28d..1ba50fa5c 100755 --- a/utils/update-translations.sh +++ b/utils/update-translations.sh @@ -3,9 +3,9 @@ TEMPLATE=messages.pot xgettext -kT_js_decl -kT_sprintf -k_ngettext:1,2 -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php include/*.php `find classes -iname '*.php'` `find plugins -iname '*.php'` -xgettext --from-code utf-8 -k__ -knotify_info -knotify_progress -kngettext -L Perl -j -o $TEMPLATE js/*.js `find plugins -iname '*.js'` +xgettext --from-code utf-8 -k__ -kNotify.info -kNotify.error -kNotify.progress -kngettext -L Perl -j -o $TEMPLATE js/*.js `find plugins -iname '*.js'` -xgettext --from-code utf-8 -k__ -knotify_info -knotify_progress -kngettext -L Java -j -o $TEMPLATE js/*.js `find plugins -iname '*.js'` +xgettext --from-code utf-8 -k__ -kNotify.info -kNotify.error -kNotify.progress -kngettext -L Java -j -o $TEMPLATE js/*.js `find plugins -iname '*.js'` update_lang() { if [ -f $1.po ]; then |