1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 03:15:56 +00:00

* switch to xhr.post() almost everywhere

* call App.handlerpcjson() automatically on json request (if possible)
 * show net/log indicators in prefs
This commit is contained in:
Andrew Dolgov
2021-02-19 13:44:56 +03:00
parent bb4e4282f4
commit 660a1bbe01
34 changed files with 275 additions and 204 deletions

View File

@@ -221,8 +221,8 @@ class Af_Proxy_Http extends Plugin {
<script type="dojo/method" event="onSubmit" args="evt">
evt.preventDefault();
if (this.validate()) {
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -1,4 +1,4 @@
/* global dijit, dojo, Plugins, xhrPost, __ */
/* global dijit, dojo, Plugins, xhr, __ */
Plugins.Psql_Trgm = {
showRelated: function (id) {
@@ -10,8 +10,8 @@ Plugins.Psql_Trgm = {
const tmph = dojo.connect(dialog, "onShow", null, function (/* e */) {
dojo.disconnect(tmph);
xhrPost("backend.php", {op: 'pluginhandler', plugin: 'af_psql_trgm', method: 'showrelated', id: id}, (transport) => {
dialog.attr('content', transport.responseText);
xhr.post("backend.php", {op: 'pluginhandler', plugin: 'af_psql_trgm', method: 'showrelated', id: id}, (reply) => {
dialog.attr('content', reply);
});
});

View File

@@ -152,8 +152,8 @@ class Af_Psql_Trgm extends Plugin {
evt.preventDefault();
if (this.validate()) {
Notify.progress('Saving data...', true);
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -71,8 +71,8 @@ class Af_Readability extends Plugin {
evt.preventDefault();
if (this.validate()) {
Notify.progress('Saving data...', true);
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -47,8 +47,8 @@ class Af_RedditImgur extends Plugin {
evt.preventDefault();
if (this.validate()) {
Notify.progress('Saving data...', true);
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -51,8 +51,8 @@ class Mail extends Plugin {
evt.preventDefault();
if (this.validate()) {
Notify.progress('Saving data...', true);
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -1,4 +1,4 @@
/* global Plugins, Headlines, dojo, xhrPost, xhrJson, Notify, fox, __ */
/* global Plugins, Headlines, dojo, App, xhr, Notify, fox, __ */
Plugins.Mail = {
send: function(id) {
@@ -38,8 +38,8 @@ Plugins.Mail = {
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
xhrPost("backend.php", App.getPhArgs("mail", "emailArticle", {ids: id}), (transport) => {
dialog.attr('content', transport.responseText);
xhr.post("backend.php", App.getPhArgs("mail", "emailArticle", {ids: id}), (reply) => {
dialog.attr('content', reply);
});
});

View File

@@ -1,4 +1,4 @@
/* global Plugins, Headlines, xhrPost, dojo, fox, __ */
/* global Plugins, Headlines, xhr, dojo, fox, __ */
Plugins.Mailto = {
send: function (id) {
@@ -21,8 +21,8 @@ Plugins.Mailto = {
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
xhrPost("backend.php", App.getPhArgs("mailto", "emailArticle", {ids: id}), (transport) => {
dialog.attr('content', transport.responseText);
xhr.post("backend.php", App.getPhArgs("mailto", "emailArticle", {ids: id}), (reply) => {
dialog.attr('content', reply);
});
});

View File

@@ -1,4 +1,4 @@
/* global dojo, xhrPost, Plugins, xhrJson, Notify, fox, __ */
/* global dojo, Plugins, xhr, App, Notify, fox, __ */
Plugins.Note = {
edit: function(id) {
@@ -33,8 +33,8 @@ Plugins.Note = {
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
xhrPost("backend.php", App.getPhArgs("note", "edit", {id: id}), (transport) => {
dialog.attr('content', transport.responseText);
xhr.post("backend.php", App.getPhArgs("note", "edit", {id: id}), (reply) => {
dialog.attr('content', reply);
});
});

View File

@@ -56,8 +56,8 @@ class NSFW extends Plugin {
evt.preventDefault();
if (this.validate()) {
Notify.progress('Saving data...', true);
xhrPost("backend.php", this.getValues(), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", this.getValues(), (reply) => {
Notify.info(reply);
})
}
</script>

View File

@@ -1,4 +1,4 @@
/* global dojo, Effect, Plugins, xhrJson, Notify, fox, xhrPost, __ */
/* global dojo, Plugins, App, Notify, fox, xhr, __ */
Plugins.Share = {
shareArticle: function(id) {
@@ -40,8 +40,8 @@ Plugins.Share = {
},
unshare: function () {
if (confirm(__("Remove sharing for this article?"))) {
xhrPost("backend.php", App.getPhArgs("share", "unshare", {id: id}), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", App.getPhArgs("share", "unshare", {id: id}), (reply) => {
Notify.info(reply);
const icon = document.querySelector(".share-icon-" + id);
@@ -59,8 +59,8 @@ Plugins.Share = {
const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
xhrPost("backend.php", App.getPhArgs("share", "shareDialog", {id: id}), (transport) => {
dialog.attr('content', transport.responseText)
xhr.post("backend.php", App.getPhArgs("share", "shareDialog", {id: id}), (reply) => {
dialog.attr('content', reply)
const icon = document.querySelector(".share-icon-" + id);

View File

@@ -1,12 +1,12 @@
/* global Plugins, Notify, xhrPost */
/* global Plugins, Notify, xhr, App */
Plugins.Share = {
clearKeys: function() {
if (confirm(__("This will invalidate all previously shared article URLs. Continue?"))) {
Notify.progress("Clearing URLs...");
xhrPost("backend.php", App.getPhArgs("share", "clearArticleKeys"), (transport) => {
Notify.info(transport.responseText);
xhr.post("backend.php", App.getPhArgs("share", "clearArticleKeys"), (reply) => {
Notify.info(reply);
});
}