<commit_before>/* globals L10N */
$(function() {
    $('.panel-heading').on('click', function() {
        const panel = $(this).parents('.panel');
        const others = $(this).parents('.accordion').find('.open').not(panel);

        others.removeClass('open init');

        panel.toggleClass('open');
        panel.find('.panel-body').slideToggle();

        others.find('.panel-body').slideUp('fast');
    });

    $('.reset-btn').on('click', function() {
        const msg = L10N.really_delete;
        const really = confirm(msg);
        const data = {'type': 'reset'};
        const elem = $(this);
        elem.addClass('saving');
        if (really) {
            $.ajax({
                'url': '../api/admin.php',
                'data': data,
                'dataType': 'json',
                'type': 'post',
                'success': function(resp) {
                    elem.removeClass('saving');
                    elem.addClass(resp);

                    setTimeout(function() {
                        elem.removeClass('error success');
                    }, 3000);
                }
            });
        }
    });

    $('.save-btn').on('click', function(e) {
        e.preventDefault();
        const elem = $(this);
        elem.addClass('saving');
        const data = 'type=config&' + $('form').serialize();
        $.ajax({
            'url': '../api/admin.php',
            'data': data,
            'dataType': 'json',
            'type': 'post',
            'success': function(resp) {
                elem.removeClass('saving');
                elem.addClass(resp);
                setTimeout(function() {
                    elem.removeClass('error success');
                }, 2000);
            }
        });
    });
});
<commit_msg>Admin: reload page after save/reset<commit_after>/* globals L10N */
$(function() {
    $('.panel-heading').on('click', function() {
        const panel = $(this).parents('.panel');
        const others = $(this).parents('.accordion').find('.open').not(panel);

        others.removeClass('open init');

        panel.toggleClass('open');
        panel.find('.panel-body').slideToggle();

        others.find('.panel-body').slideUp('fast');
    });

    $('.reset-btn').on('click', function() {
        const msg = L10N.really_delete;
        const really = confirm(msg);
        const data = {'type': 'reset'};
        const elem = $(this);
        elem.addClass('saving');
        if (really) {
            $.ajax({
                'url': '../api/admin.php',
                'data': data,
                'dataType': 'json',
                'type': 'post',
                'success': function(resp) {
                    elem.removeClass('saving');
                    elem.addClass(resp);

                    setTimeout(function() {
                        elem.removeClass('error success');

                        window.location.reload();
                    }, 3000);
                }
            });
        }
    });

    $('.save-btn').on('click', function(e) {
        e.preventDefault();
        const elem = $(this);
        elem.addClass('saving');
        const data = 'type=config&' + $('form').serialize();
        $.ajax({
            'url': '../api/admin.php',
            'data': data,
            'dataType': 'json',
            'type': 'post',
            'success': function(resp) {
                elem.removeClass('saving');
                elem.addClass(resp);
                setTimeout(function() {
                    elem.removeClass('error success');

                    window.location.reload();
                }, 2000);
            }
        });
    });
});

{'fraction_non_alphanumeric': 0.17572559366754617, 'fraction_numerical': 0.0063324538258575196, 'mean_word_length': 1.33435960591133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6921045', 'n_tokens_mistral': 1017, 'n_tokens_neox': 938, 'n_words': 166}