1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-07-01 12:40:50 +02:00
ttrss/plugins/mailto/init.js
Andrew Dolgov e4609c18ef * add (disabled) shortcut syntax for plugin methods
* add controls shortcut for pluginhandler tags
 * add similar shortcut for frontend
 * allow plugins to selectively exclude their methods from CSRF checking
2021-02-17 21:44:21 +03:00

40 lines
832 B
JavaScript

/* global Plugins, Headlines, xhrPost, dojo, fox, __ */
Plugins.Mailto = {
send: function (id) {
if (!id) {
const ids = Headlines.getSelected();
if (ids.length == 0) {
alert(__("No articles selected."));
return;
}
id = ids.toString();
}
const dialog = new fox.SingleUseDialog({
title: __("Forward article by email (mailto:)"),
content: __("Loading, please wait...")
});
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);
});
});
dialog.show();
}
};
// override default hotkey action if enabled
Plugins.Mail = Plugins.Mail || {};
Plugins.Mail.onHotkey = function(id) {
Plugins.Mailto.send(id);
};