mirror of https://gitlab.com/tildes/tildes.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
586 B
19 lines
586 B
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
$.onmount('[data-js-prevent-double-submit]', function() {
|
|
$(this).on('beforeSend.ic', function(evt, elt, data, settings, xhr, requestId) {
|
|
var $form = $(this);
|
|
|
|
if ($form.attr('data-js-submitting') !== undefined) {
|
|
xhr.abort();
|
|
return false;
|
|
} else {
|
|
$form.attr('data-js-submitting', true);
|
|
}
|
|
});
|
|
|
|
$(this).on('complete.ic', function() {
|
|
$(this).removeAttr('data-js-submitting');
|
|
});
|
|
});
|