summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-01 22:19:20 +0300
committerAndrew Dolgov <[email protected]>2018-12-01 22:19:20 +0300
commitbc96eac2ac6579bfe7a4d99292c0ada3412dc54c (patch)
tree3c5e857d48ce8b1249fd1ecf7b68a9fa2b5368b8 /js
parent2cd23e344cd46318935ca3eb8bdbe06e277131c2 (diff)
addLabel -> CommonDialogs
Diffstat (limited to 'js')
-rwxr-xr-xjs/functions.js48
-rwxr-xr-xjs/prefs.js2
-rw-r--r--js/tt-rss.js4
3 files changed, 26 insertions, 28 deletions
diff --git a/js/functions.js b/js/functions.js
index 04a81d925..f4e422aec 100755
--- a/js/functions.js
+++ b/js/functions.js
@@ -651,6 +651,29 @@ const CommonDialogs = {
});
dialog.show();
+ },
+ addLabel: function(select, callback) {
+ const caption = prompt(__("Please enter label caption:"), "");
+
+ if (caption != undefined && caption.trim().length > 0) {
+
+ const query = {op: "pref-labels", method: "add", caption: caption.trim()};
+
+ if (select)
+ Object.extend(query, {output: "select"});
+
+ notify_progress("Loading, please wait...", true);
+
+ xhrPost("backend.php", query, (transport) => {
+ if (callback) {
+ callback(transport);
+ } else if (App.isPrefs()) {
+ updateLabelList();
+ } else {
+ Feeds.reload();
+ }
+ });
+ }
}
};
@@ -1067,31 +1090,6 @@ function uploadFeedIcon() {
return false;
}
-function addLabel(select, callback) {
- const caption = prompt(__("Please enter label caption:"), "");
-
- if (caption != undefined && caption.trim().length > 0) {
-
- const query = { op: "pref-labels", method: "add", caption: caption.trim() };
-
- if (select)
- Object.extend(query, {output: "select"});
-
- notify_progress("Loading, please wait...", true);
-
- xhrPost("backend.php", query, (transport) => {
- if (callback) {
- callback(transport);
- } else if (App.isPrefs()) {
- updateLabelList();
- } else {
- Feeds.reload();
- }
- });
- }
-
-}
-
function createNewRuleElement(parentNode, replaceNode) {
const form = document.forms["filter_new_rule_form"];
const query = { op: "pref-filters", method: "printrulename", rule: dojo.formToJson(form) };
diff --git a/js/prefs.js b/js/prefs.js
index 1541d49d0..67be0b474 100755
--- a/js/prefs.js
+++ b/js/prefs.js
@@ -97,7 +97,7 @@ const App = {
CommonDialogs.quickAddFeed();
return false;
case "create_label":
- addLabel();
+ CommonDialogs.addLabel();
return false;
case "create_filter":
quickAddFilter();
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 46f100e27..6dd4a91eb 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -421,7 +421,7 @@ const App = {
}
};
this.hotkey_actions["create_label"] = function () {
- addLabel();
+ CommonDialogs.addLabel();
};
this.hotkey_actions["create_filter"] = function () {
quickAddFilter();
@@ -480,7 +480,7 @@ const App = {
onActionSelected: function(opid) {
switch (opid) {
case "qmcPrefs":
- gotoPreferences();
+ document.location.href = "prefs.php";
break;
case "qmcLogout":
document.location.href = "backend.php?op=logout";