?? GreyFile — Mystic File Browser

Current path: home/webdevt/www/schtroumpf.fr/modules/an_productextratabs/views/js/



?? Go up: /home/webdevt/www/schtroumpf.fr/modules/an_productextratabs/views

?? Viewing: sorting.js

/**
* 2022 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
*  @author    Anvanto <anvantoco@gmail.com>
*  @copyright 2022 Anvanto
*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*/

! function(t) {
    "use strict";

    var idSortTable = '#table-tab';
    var numColPos = 3;

    var n = t.when(),
        e = "undefined" != typeof baseAdminDir ? location.origin + baseAdminDir + currentIndex + "&token=" + token : location.href,
        o = e + "&ajax";
    t(document).ready(function() {
        var e = t(idSortTable + " tbody")[0];
        return "undefined" != typeof e && void new Sortable(e, {
            group: "name",
            sort: !0,
            handle: '.handle',
            delay: 0,
            disabled: !1,
            draggable: "tr",
            store: null,
            animation: 150,
            setData: function(t, n) {
                t.setData("Text", n.textContent)
            },
            onStart: function(t) {},
            onEnd: function(t) {},
            onSort: function(e) {
                n = n.then(function() {
                    return t.post(o, {
                        action: "updatePositions",
                        positions: t(idSortTable + " tbody tr").toArray().map(function(n) {
                            return parseInt(t(n).children("td").eq(1).html()) || 0
                        })
                    })
                }).then(function(n) {
                    var e = 1;
                    n.success ? (t(idSortTable + " tbody tr").each(function() {
                        t(t(this).children("td")[numColPos]).find('span').html(e++)
                    }), showSuccessMessage(n.message)) : showErrorMessage(n.message)
                })
            }
        })
    })
}(jQuery);


??

??