$(document).ready(function () {

    //Paramétrage des data-tables
    $('.datatable').DataTable({
        "language": {
            "url": "/Scripts/dataTables.french.lang"
        }
    });

    $('.datatable').on('click', 'tbody>tr', function () {
        var url = $(this).data('url');
        window.location.href = url;
    });


    //Conservation de la trace (pages d'admin)
    $("a.start-trace").on("click", function () {
        sessionStorage.setItem("trace", window.location);
    });

    $("body").on("click", "a", function () {
        if ($("a.keep-trace").length > 0 & sessionStorage.getItem("trace")==null) {
            sessionStorage.setItem("trace", $("a.keep-trace").first().attr("href"));
        }
    });

    if ($("a.keep-trace").length > 0) {
        if (sessionStorage.getItem("trace") != null) {
            $("a.keep-trace").attr("href", sessionStorage.getItem("trace"));
        }
    }


});
