openstamanager/lib/init.js

71 lines
1.9 KiB
JavaScript
Raw Normal View History

$(document).ready(function () {
// Inizializzazzione dei box AdminLTE
$('.box').boxWidget();
// Modal di default
$('[data-href]').not('.ask, .bound').click(function () {
launch_modal($(this).data('title'), $(this).data('href'), 1, $(this).data('target'));
});
2018-02-28 23:44:30 +01:00
$('[data-href]').not('.ask, .bound').addClass('bound clickable');
// Tooltip
$('.tip').not('.tooltipstered').each(function () {
$this = $(this);
$this.tooltipster({
animation: 'grow',
contentAsHTML: true,
hideOnClick: true,
onlyOne: true,
maxWidth: 350,
touchDevices: true,
trigger: 'hover',
position: $this.data('position') ? $this.data('position') : 'top',
});
});
// Autosize per le textarea
autosize($('.autosize'));
if ($('form').length) {
$('form').not('.no-check').parsley();
}
window.Parsley.on('field:success', function () {
this.$element.removeClass('parsley-success');
});
2019-07-15 18:34:59 +02:00
start_datepickers();
// Aggiunta nell'URL del nome tab su cui tornare dopo il submit
// Blocco del pulsante di submit dopo il primo submit
$("form").submit(function () {
if ($(this).parsley().validate()) {
$(this).submit(function () {
return false;
});
$(this).find('[type=submit]').prop("disabled", true).addClass("disabled");
$(this).find('input:disabled, select:disabled').prop('disabled', false);
var hash = window.location.hash;
if (hash) {
var input = $('<input/>', {
type: 'hidden',
name: 'hash',
value: hash,
});
$(this).append(input);
}
return true;
}
return false;
});
start_superselect();
start_inputmask();
});