##// END OF EJS Templates
Don't use JS and links in tag buttons. Use <button> instead
Don't use JS and links in tag buttons. Use <button> instead

File last commit:

r1007:17f2694e default
r1039:4008735b default
Show More
form.js
26 lines | 760 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 && event.ctrlKey) {
form.submit();
}
});