summaryrefslogtreecommitdiff
path: root/js/PrefHelpers.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-03 12:57:19 +0300
committerAndrew Dolgov <[email protected]>2018-12-03 12:57:19 +0300
commita049b5bd88f3ce07af0e2aa7c21992dc0605eea6 (patch)
treee445d525ecb04fb76ca8d3fbdead8c0e669ce1b4 /js/PrefHelpers.js
parent8f1881e12c96f9b4f3e439dfa9d1a156f5475dcc (diff)
shorten declaration of PrefHelpers.OPML
Diffstat (limited to 'js/PrefHelpers.js')
-rw-r--r--js/PrefHelpers.js123
1 files changed, 61 insertions, 62 deletions
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index e4ffb04ef..1b23ebea3 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -147,84 +147,83 @@ define(["dojo/_base/declare"], function (declare) {
dijit.byId('genConfigTab').attr('content', transport.responseText);
Notify.close();
});
- }
- };
-
- Helpers.OPML = {
- import: function() {
- const opml_file = $("opml_file");
+ },
+ OPML: {
+ import: function() {
+ const opml_file = $("opml_file");
- if (opml_file.value.length == 0) {
- alert(__("Please choose an OPML file first."));
- return false;
- } else {
- Notify.progress("Importing, please wait...", true);
+ if (opml_file.value.length == 0) {
+ alert(__("Please choose an OPML file first."));
+ return false;
+ } else {
+ Notify.progress("Importing, please wait...", true);
- Element.show("upload_iframe");
+ Element.show("upload_iframe");
- return true;
- }
- },
- onImportComplete: function(iframe) {
- if (!iframe.contentDocument.body.innerHTML) return false;
+ return true;
+ }
+ },
+ onImportComplete: function(iframe) {
+ if (!iframe.contentDocument.body.innerHTML) return false;
- Element.show(iframe);
+ Element.show(iframe);
- Notify.close();
+ Notify.close();
- if (dijit.byId('opmlImportDlg'))
- dijit.byId('opmlImportDlg').destroyRecursive();
+ if (dijit.byId('opmlImportDlg'))
+ dijit.byId('opmlImportDlg').destroyRecursive();
- const content = iframe.contentDocument.body.innerHTML;
+ const content = iframe.contentDocument.body.innerHTML;
- const dialog = new dijit.Dialog({
- id: "opmlImportDlg",
- title: __("OPML Import"),
- style: "width: 600px",
- onCancel: function () {
- window.location.reload();
- },
- execute: function () {
- window.location.reload();
- },
- content: content
- });
+ const dialog = new dijit.Dialog({
+ id: "opmlImportDlg",
+ title: __("OPML Import"),
+ style: "width: 600px",
+ onCancel: function () {
+ window.location.reload();
+ },
+ execute: function () {
+ window.location.reload();
+ },
+ content: content
+ });
- dojo.connect(dialog, "onShow", function () {
- Element.hide(iframe);
- });
+ dojo.connect(dialog, "onShow", function () {
+ Element.hide(iframe);
+ });
- dialog.show();
- },
- export: function() {
- console.log("export");
- window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm"));
- },
- changeKey: function() {
- if (confirm(__("Replace current OPML publishing address with a new one?"))) {
- Notify.progress("Trying to change address...", true);
+ dialog.show();
+ },
+ export: function() {
+ console.log("export");
+ window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm"));
+ },
+ changeKey: function() {
+ if (confirm(__("Replace current OPML publishing address with a new one?"))) {
+ Notify.progress("Trying to change address...", true);
- xhrJson("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => {
- if (reply) {
- const new_link = reply.link;
- const e = $('pub_opml_url');
+ xhrJson("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => {
+ if (reply) {
+ const new_link = reply.link;
+ const e = $('pub_opml_url');
- if (new_link) {
- e.href = new_link;
- e.innerHTML = new_link;
+ if (new_link) {
+ e.href = new_link;
+ e.innerHTML = new_link;
- new Effect.Highlight(e);
+ new Effect.Highlight(e);
- Notify.close();
+ Notify.close();
- } else {
- Notify.error("Could not change feed URL.");
+ } else {
+ Notify.error("Could not change feed URL.");
+ }
}
- }
- });
- }
- return false;
- },
+ });
+ }
+ return false;
+ },
+ }
};
return Helpers;