finish xhrPost migration of js/
This commit is contained in:
parent
7e8be97b66
commit
fd752a79af
93
js/prefs.js
93
js/prefs.js
|
@ -734,16 +734,12 @@ function init() {
|
||||||
loading_set_progress(50);
|
loading_set_progress(50);
|
||||||
|
|
||||||
const clientTzOffset = new Date().getTimezoneOffset() * 60;
|
const clientTzOffset = new Date().getTimezoneOffset() * 60;
|
||||||
|
const params = { op: "rpc", method: "sanityCheck", clientTzOffset: clientTzOffset };
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
xhrPost("backend.php", params, (transport) => {
|
||||||
parameters: {
|
|
||||||
op: "rpc", method: "sanityCheck",
|
|
||||||
clientTzOffset: clientTzOffset
|
|
||||||
},
|
|
||||||
onComplete: function (transport) {
|
|
||||||
backend_sanity_check_callback(transport);
|
backend_sanity_check_callback(transport);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error(e);
|
exception_error(e);
|
||||||
}
|
}
|
||||||
|
@ -793,44 +789,32 @@ function pref_hotkey_handler(e) {
|
||||||
|
|
||||||
function removeCategory(id, item) {
|
function removeCategory(id, item) {
|
||||||
|
|
||||||
const ok = confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name));
|
if (confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name))) {
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
const query = "?op=pref-feeds&method=removeCat&ids=" +
|
|
||||||
param_escape(id);
|
|
||||||
|
|
||||||
notify_progress("Removing category...");
|
notify_progress("Removing category...");
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
const query = { op: "pref-feeds", method: "removeCat",
|
||||||
parameters: query,
|
ids: id };
|
||||||
onComplete: function (transport) {
|
|
||||||
|
xhrPost("backend.php", query, () => {
|
||||||
notify('');
|
notify('');
|
||||||
updateFeedList();
|
updateFeedList();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeSelectedCategories() {
|
function removeSelectedCategories() {
|
||||||
|
|
||||||
const sel_rows = getSelectedCategories();
|
const sel_rows = getSelectedCategories();
|
||||||
|
|
||||||
if (sel_rows.length > 0) {
|
if (sel_rows.length > 0) {
|
||||||
|
if (confirm(__("Remove selected categories?"))) {
|
||||||
const ok = confirm(__("Remove selected categories?"));
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
notify_progress("Removing selected categories...");
|
notify_progress("Removing selected categories...");
|
||||||
|
|
||||||
const query = "?op=pref-feeds&method=removeCat&ids="+
|
const query = { op: "pref-feeds", method: "removeCat",
|
||||||
param_escape(sel_rows.toString());
|
ids: sel_rows.toString() };
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
xhrPost("backend.php", query, () => {
|
||||||
parameters: query,
|
|
||||||
onComplete: function(transport) {
|
|
||||||
updateFeedList();
|
updateFeedList();
|
||||||
} });
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(__("No categories are selected."));
|
alert(__("No categories are selected."));
|
||||||
|
@ -843,18 +827,11 @@ function createCategory() {
|
||||||
const title = prompt(__("Category title:"));
|
const title = prompt(__("Category title:"));
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
|
|
||||||
notify_progress("Creating category...");
|
notify_progress("Creating category...");
|
||||||
|
|
||||||
const query = "?op=pref-feeds&method=addCat&cat=" +
|
xhrPost("backend.php", { op: "pref-feeds", method: "addCat", cat: title }, () => {
|
||||||
param_escape(title);
|
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
|
||||||
parameters: query,
|
|
||||||
onComplete: function (transport) {
|
|
||||||
notify('');
|
notify('');
|
||||||
updateFeedList();
|
updateFeedList();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,24 +852,17 @@ function showInactiveFeeds() {
|
||||||
removeSelected: function () {
|
removeSelected: function () {
|
||||||
const sel_rows = this.getSelectedFeeds();
|
const sel_rows = this.getSelectedFeeds();
|
||||||
|
|
||||||
console.log(sel_rows);
|
|
||||||
|
|
||||||
if (sel_rows.length > 0) {
|
if (sel_rows.length > 0) {
|
||||||
const ok = confirm(__("Remove selected feeds?"));
|
if (confirm(__("Remove selected feeds?"))) {
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
notify_progress("Removing selected feeds...", true);
|
notify_progress("Removing selected feeds...", true);
|
||||||
|
|
||||||
const query = "?op=pref-feeds&method=remove&ids=" +
|
const query = { op: "pref-feeds", method: "remove",
|
||||||
param_escape(sel_rows.toString());
|
ids: sel_rows.toString() };
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
xhrPost("backend.php", query, () => {
|
||||||
parameters: query,
|
|
||||||
onComplete: function (transport) {
|
|
||||||
notify('');
|
notify('');
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
updateFeedList();
|
updateFeedList();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,21 +881,12 @@ function showInactiveFeeds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function opmlRegenKey() {
|
function opmlRegenKey() {
|
||||||
const ok = confirm(__("Replace current OPML publishing address with a new one?"));
|
if (confirm(__("Replace current OPML publishing address with a new one?"))) {
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
|
|
||||||
notify_progress("Trying to change address...", true);
|
notify_progress("Trying to change address...", true);
|
||||||
|
|
||||||
const query = "?op=pref-feeds&method=regenOPMLKey";
|
xhrJson("backend.php", { op: "pref-feeds", method: "regenOPMLKey" }, (reply) => {
|
||||||
|
if (reply) {
|
||||||
new Ajax.Request("backend.php", {
|
|
||||||
parameters: query,
|
|
||||||
onComplete: function (transport) {
|
|
||||||
const reply = JSON.parse(transport.responseText);
|
|
||||||
|
|
||||||
const new_link = reply.link;
|
const new_link = reply.link;
|
||||||
|
|
||||||
const e = $('pub_opml_url');
|
const e = $('pub_opml_url');
|
||||||
|
|
||||||
if (new_link) {
|
if (new_link) {
|
||||||
|
@ -949,17 +910,13 @@ function labelColorReset() {
|
||||||
const labels = getSelectedLabels();
|
const labels = getSelectedLabels();
|
||||||
|
|
||||||
if (labels.length > 0) {
|
if (labels.length > 0) {
|
||||||
const ok = confirm(__("Reset selected labels to default colors?"));
|
if (confirm(__("Reset selected labels to default colors?"))) {
|
||||||
|
|
||||||
if (ok) {
|
const query = { op: "pref-labels", method: "colorreset",
|
||||||
const query = "?op=pref-labels&method=colorreset&ids=" +
|
ids: labels.toString() };
|
||||||
param_escape(labels.toString());
|
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
xhrPost("backend.php", query, () => {
|
||||||
parameters: query,
|
|
||||||
onComplete: function (transport) {
|
|
||||||
updateLabelList();
|
updateLabelList();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,16 +235,14 @@ function init() {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
loading_set_progress(30);
|
loading_set_progress(30);
|
||||||
|
init_hotkey_actions();
|
||||||
|
|
||||||
const a = document.createElement('audio');
|
const a = document.createElement('audio');
|
||||||
|
|
||||||
const hasAudio = !!a.canPlayType;
|
const hasAudio = !!a.canPlayType;
|
||||||
const hasSandbox = "sandbox" in document.createElement("iframe");
|
const hasSandbox = "sandbox" in document.createElement("iframe");
|
||||||
const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
|
const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
|
||||||
const clientTzOffset = new Date().getTimezoneOffset() * 60;
|
const clientTzOffset = new Date().getTimezoneOffset() * 60;
|
||||||
|
|
||||||
init_hotkey_actions();
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
||||||
hasMp3: hasMp3,
|
hasMp3: hasMp3,
|
||||||
|
|
Loading…
Reference in New Issue