<commit_before>(() => {
    const SELECTOR = {
        container: '.js-content-sortable',
        item:      '[data-id]'
    };

    let init;
    (init = function (context) {
        $(context || 'body').find(SELECTOR.container).sortable({
            items:  SELECTOR.item,
            update: (e, ui) => {
                let $items = ui.item.closest(SELECTOR.container).find(SELECTOR.item),
                    ids    = [];

                if ($items.length > 0) {
                    ids = $items.map((i, item) => {
                        return $(item).data('id');
                    }).get();
                }
            }
        });
    })();
    $(document).on('app.ajax.html', (e, args) => {
        init(args.$html);
    });
})();
<commit_msg>Send request in sorting JS.<commit_after>(() => {
    const SELECTOR = {
        container: '.js-content-sortable[data-reposition-url][data-class]',
        item:      '[data-id]'
    };

    let init;
    (init = function (context) {
        $(context || 'body').find(SELECTOR.container).sortable({
            items:  SELECTOR.item,
            update: (e, ui) => {
                const $container = ui.item.closest(SELECTOR.container);

                const $items = $container.find(SELECTOR.item);

                if (!$items.length) {
                    return;
                }

                const options = $container.data();

                let data = {
                    'class': options.class,
                    ids:     $items.map((i, item) => {
                        return $(item).data('id');
                    }).get()
                };

                if (options.slug) {
                    data.slug = options.slug;
                }

                $.ajax({
                    url:  options.repositionUrl,
                    type: 'post',
                    data: data
                });
            }
        });
    })();
    $(document).on('app.ajax.html', (e, args) => {
        init(args.$html);
    });
})();

{'fraction_non_alphanumeric': 0.16410510659395142, 'fraction_numerical': 0.0004957858205255329, 'mean_word_length': 1.1559829059829059, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5089699', 'n_tokens_mistral': 582, 'n_tokens_neox': 543, 'n_words': 96}