mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-22 21:31:48 +00:00
31 lines
831 B
JavaScript
31 lines
831 B
JavaScript
$(document).on('turbolinks:load', function() {
|
|
$(document).on('keypress', '.post :input:not(textarea):not([type=submit])', function(e) {
|
|
if (e.keyCode == 13) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
}
|
|
});
|
|
|
|
$('.submit-post').click(function(e) {
|
|
var form = $(this).parents('form.form');
|
|
var invalid_help = $('.invalid_help');
|
|
var sending_help = $('.sending_help');
|
|
|
|
invalid_help.addClass('d-none');
|
|
sending_help.addClass('d-none');
|
|
|
|
if (form[0].checkValidity() === false) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
invalid_help.removeClass('d-none');
|
|
} else {
|
|
sending_help.removeClass('d-none');
|
|
}
|
|
|
|
form.addClass('was-validated');
|
|
});
|
|
|
|
$('.submit-post-incomplete').click(function(e) {
|
|
$('.sending_help').removeClass('d-none');
|
|
});
|
|
});
|