"use strict";
jQuery(document).ready(function ($) {
    var updateOutput = function (e) {
        var list = e.length ? e : $(e.target), output = list.data('output');
        $.ajax({
            method: "POST",
            url: "savelist",
            data: {
                list: list.nestable('serialize')
            }, success: function (data) {
            }
        }).fail(function (jqXHR, textStatus, errorThrown) {
            alert(" Unable to save new list order: " + errorThrown);
        });
    };
    $('#nestable').nestable({
        group: 1,
        maxDepth: 7,
    }).on('change', updateOutput);
});
