import('bootstrap');
import $ from 'jquery';
import 'datatables.net-bs5';

$(function () {
    function getLang()
    {
        if (window.location.href.indexOf("/de/") > -1) {
            return 'de'
        }

        if (window.location.href.indexOf("/en/") > -1) {
            return 'en'
        }

        if (window.location.href.indexOf("/es/") > -1) {
            return 'es'
        }
        return 'de';
    }

    const table = $('.table-responsive')

    table.on('show.bs.dropdown', function () {
        $('#explorerTable').css("overflow", "inherit");
    });

    table.on('hide.bs.dropdown', function () {
        $('#explorerTable').css("overflow", "auto");
    })

    $('#explorerTable').DataTable({
        initComplete: function (settings, json) {
            $('input[type="search"]').first().focus();
        },
        stateSave: true,
        autoWidth: true,
        paging: true,
        ordering: true,
        order: [[0, "asc"]],
        columnDefs: [
            {"targets": 4, "orderable": false},
        ]
    });
})