summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static/js
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-02-06 22:27:15 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-02-06 22:27:15 +0100
commit70ee90217657b8e30dc766d70322c19546cb8368 (patch)
tree9fd7b1dca034b11cf3a8bcae161bba925ad644d9 /hyperkitty/static/js
parentfa04cb6fb6da7861c6d23991a5c2636e5b2a641f (diff)
downloadhyperkitty-70ee90217657b8e30dc766d70322c19546cb8368.tar.gz
hyperkitty-70ee90217657b8e30dc766d70322c19546cb8368.tar.xz
hyperkitty-70ee90217657b8e30dc766d70322c19546cb8368.zip
Add a link to quote the message being replied to
Diffstat (limited to 'hyperkitty/static/js')
-rw-r--r--hyperkitty/static/js/hyperkitty.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js
index 36812cf..86db2bd 100644
--- a/hyperkitty/static/js/hyperkitty.js
+++ b/hyperkitty/static/js/hyperkitty.js
@@ -178,6 +178,25 @@ function setup_replies() {
e.preventDefault();
$(this).parents(".reply-form").first().slideUp();
});
+ $(".reply-form a.quote").click(function(e) {
+ e.preventDefault();
+ var quoted = $(this).parents(".email").first()
+ .find(".email-body").clone()
+ .find(".quoted-switch").remove().end()
+ .find(".quoted-text").remove().end()
+ .text();
+ var textarea = $(this).parents(".reply-form").find("textarea");
+ // remove signature
+ var sig_index = quoted.search(/^-- $/m);
+ if (sig_index != -1) {
+ quoted = quoted.substr(0, sig_index);
+ }
+ // add quotation marks
+ quoted = $.trim(quoted).replace(/^/mg, "> ");
+ // insert before any previous text
+ textarea.val(quoted + "\n" + textarea.val());
+ textarea.focus();
+ });
}
@@ -258,9 +277,9 @@ function setup_attachments() {
function setup_quotes() {
$('div.email-body .quoted-switch a')
- .click(function() {
+ .click(function(e) {
+ e.preventDefault();
$(this).parent().next(".quoted-text").slideToggle('fast');
- return false;
});
}