Make posting by Ctrl+Enter possible

It is nice to be able to post a reply by pressing Ctrl/Cmd+Enter, this
also works on in other microbloging clients like Twitter. This patch
adds this possibility.
This commit is contained in:
Jeena 2016-05-22 00:42:34 +02:00
parent bf540b5b49
commit 0c19e27520

View file

@ -78,6 +78,14 @@ $(function(){
$("#older-link").off('click').click(clickOlderLink);
$(".micropub-form button[type='submit']").off('click').click(submitMicropubForm);
// Post by ctrl/cmd + enter in the text area
$(".micropub-form textarea.content").keyup(function(e) {
if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
var button = $(e.target).closest('form').find('button[value=reply]');
button[0].click();
}
});
$(".micropub-form .content").focus(function () {
$(this).animate({ height: "4em" }, 200);
var $target = $(evt.target);