summaryrefslogtreecommitdiff
path: root/plugins/mailto/init.js
blob: ae68bf49bbb0b0033988776eece7f34a8e6eeab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* global Plugins, Headlines, 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 query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle&param=" + encodeURIComponent(id);

		const dialog = new fox.SingleUseDialog({
			id: "emailArticleDlg",
			title: __("Forward article by email"),
			href: query});

		dialog.show();
	}
};

// override default hotkey action if enabled
Plugins.Mail = Plugins.Mail || {};

Plugins.Mail.onHotkey = function(id) {
	Plugins.Mailto.send(id);
};