{{ include('layout/js/cookies.js.twig') }}
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
axios.defaults.headers.common['Accept'] = 'application/json';
axios.defaults.headers.common['Content-Type'] = 'application/json';
jQuery(document).ready(function ($) {
$('input[type="file"]').next(".custom-file-label").text('{{ 'meta.file_browse'|trans({}, 'forms') }}');
$(document).on('change', 'input[type="file"]', function (e) {
var files = e.target.files;
var fileNames = '';
$.each(files, function(key, file) {
fileNames += file.name+' ';
});
if (fileNames != undefined || fileNames != "") {
$(this).next(".custom-file-label").attr('data-content', fileNames);
$(this).next(".custom-file-label").text(fileNames);
}
});
$(".confirmDelete").click(function () {
$text = $(this).data('delete-text') !== undefined ? $(this).data('delete-text') : "{{ 'meta.confirm_delete'|trans|raw }}";
return confirm($text);
});
$('#remoteModal').on('show.bs.modal', function (e) {
$(this).find('.modal-remote-data').html('<div class="alert alert-info" role="alert">\n' +
'{{ 'loading'|trans }}' +
'</div>');
$(this).find('.modal-title').text(e.relatedTarget.getAttribute('data-title'));
$(this).find('.modal-remote-data').load(e.relatedTarget.href);
});
// adult warning popup
$('#warningcontainer .accept-popup').click(function (event) {
createCookie('adult_warning_accepted', '1', 365);
});
$('#warningcontainer .close-popup').click(function (event) {
event.preventDefault();
$('#warningcontainer').hide();
});
});