var delay = (function(){
    var timer = 0;
    return function(callback, ms){
        clearTimeout (timer);
        timer = setTimeout(callback, ms);
    };
})();

$(function () { $('[data-bs-toggle="tooltip"]').tooltip() });
$('.alert.alert-success.auto-hide').delay(3000).slideUp();

if(typeof bootbox !== 'undefined') {
    bootbox.addLocale('pp', {
        OK : 'OK',
        CANCEL : 'Abbrechen',
        CONFIRM : 'Bestätigen'
    });

    bootbox.setLocale('pp');

    $('form.delete').on('submit', function($event) {
        $event.preventDefault();

        let $form = $(this);

        bootbox.confirm({
            'size' : 'large',
            'message' : $form.data('message'),
            'callback' : function($result) {
                if($result) $form.off('submit').submit();
            }
        });
    });
}



