summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/Article.js6
-rw-r--r--js/PrefHelpers.js38
2 files changed, 41 insertions, 3 deletions
diff --git a/js/Article.js b/js/Article.js
index b933ed716..970234818 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -32,7 +32,7 @@ define(["dojo/_base/declare"], function (declare) {
if (ids.length > 0) {
const score = prompt(__("Please enter new score for selected articles:"));
- if (parseInt(score) != undefined) {
+ if (!isNaN(parseInt(score))) {
ids.each((id) => {
const row = $("RROW-" + id);
@@ -66,7 +66,7 @@ define(["dojo/_base/declare"], function (declare) {
const score_old = row.getAttribute("data-score");
const score = prompt(__("Please enter new score for this article:"), score_old);
- if (parseInt(score) != undefined) {
+ if (!isNaN(parseInt(score))) {
row.setAttribute("data-score", score);
const pic = row.select(".icon-score")[0];
@@ -340,4 +340,4 @@ define(["dojo/_base/declare"], function (declare) {
}
return Article;
-}); \ No newline at end of file
+});
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index a3d122029..6a62cb593 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -1,5 +1,43 @@
define(["dojo/_base/declare"], function (declare) {
Helpers = {
+ AppPasswords: {
+ getSelected: function() {
+ return Tables.getSelected("app-password-list");
+ },
+ updateContent: function(data) {
+ $("app_passwords_holder").innerHTML = data;
+ dojo.parser.parse("app_passwords_holder");
+ },
+ removeSelected: function() {
+ const rows = this.getSelected();
+
+ if (rows.length == 0) {
+ alert("No passwords selected.");
+ } else {
+ if (confirm(__("Remove selected app passwords?"))) {
+
+ xhrPost("backend.php", {op: "pref-prefs", method: "deleteAppPassword", ids: rows.toString()}, (transport) => {
+ this.updateContent(transport.responseText);
+ Notify.close();
+ });
+
+ Notify.progress("Loading, please wait...");
+ }
+ }
+ },
+ generate: function() {
+ const title = prompt("Password description:")
+
+ if (title) {
+ xhrPost("backend.php", {op: "pref-prefs", method: "generateAppPassword", title: title}, (transport) => {
+ this.updateContent(transport.responseText);
+ Notify.close();
+ });
+
+ Notify.progress("Loading, please wait...");
+ }
+ },
+ },
clearFeedAccessKeys: function() {
if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) {
Notify.progress("Clearing URLs...");