From 59478e06c25303a790a0840ab2ac30662c4ef781 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 5 Aug 2014 16:46:22 +0200 Subject: c'est la merde.. --- plugins/copymessage/copymessage.js | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 plugins/copymessage/copymessage.js (limited to 'plugins/copymessage/copymessage.js') diff --git a/plugins/copymessage/copymessage.js b/plugins/copymessage/copymessage.js new file mode 100644 index 000000000..046edc073 --- /dev/null +++ b/plugins/copymessage/copymessage.js @@ -0,0 +1,40 @@ +/** + * CopyMessage plugin script + */ + +function rcmail_copyto(command, el, pos) { + if (rcmail.env.rcm_destfolder == rcmail.env.mailbox) + return; + + var prev_sel = null; + + // also select childs of (collapsed) threads + if (rcmail.env.uid) { + if (!rcmail.message_list.in_selection(rcmail.env.uid)) { + prev_sel = rcmail.message_list.get_selection(); + rcmail.message_list.select_row(rcmail.env.uid); + } + + if (rcmail.message_list.rows[rcmail.env.uid].has_children && !rcmail.message_list.rows[rcmail.env.uid].expanded) + rcmail.message_list.select_childs(rcmail.env.uid); + + rcmail.env.uid = null; + } + + rcmail.command('copy', rcmail.env.rcm_destfolder, $(el)); + + if (prev_sel) { + rcmail.message_list.clear_selection(); + + for (var i in prev_sel) + rcmail.message_list.select_row(prev_sel[i], CONTROL_KEY); + } + + delete rcmail.env.rcm_destfolder; +} + +$(document).ready(function(){ + if (window.rcm_contextmenu_register_command) { + rcm_contextmenu_register_command('copy', 'rcmail_copyto', $('#rcmContextCopy'), 'moreacts', 'after', true); + } +}); \ No newline at end of file -- cgit v1.2.3