##// END OF EJS Templates
Post message by ctrl-enter on the text field
Post message by ctrl-enter on the text field

File last commit:

r1005:1df42bd8 default
r1005:1df42bd8 default
Show More
form.js
26 lines | 743 B | application/javascript | JavascriptLexer
$('input[name=image]').wrap($('<div class="file_wrap"></div>'));
$('body').on('change', 'input[name=image]', function(event) {
var file = event.target.files[0];
if(file.type.match('image.*')) {
var fileReader = new FileReader();
fileReader.addEventListener("load", function(event) {
var wrapper = $('.file_wrap');
wrapper.find('.file-thumb').remove();
wrapper.append(
$('<div class="file-thumb" style="background-image: url('+event.target.result+')"></div>')
);
});
fileReader.readAsDataURL(file);
}
});
var form = $('#form');
$('textarea').keypress(function(event) {
if (event.which == 13) {
form.submit();
}
});