<commit_before>$(function(){
    // available for admin pages

    // hide the open311_only section and reveal it only when send_method is relevant
    var $open311_only = $('.admin-open311-only');
    if ($open311_only) {
        function hide_or_show_open311(hide_fast) {
            var send_method = $('#send_method').val();
            var show_open311 = false;
            if ($('#endpoint').val()) {
                show_open311 = true; // always show the form if there is an endpoint value
            } else if (send_method && send_method.toLowerCase() != 'email') {
                show_open311 = true;
            }
            if (show_open311) {
                $open311_only.slideDown();
            } else {
                if (hide_fast) {
                    $open311_only.hide();
                } else {
                    $open311_only.slideUp();
                }
            }
        }
        $('#send_method').on('change', hide_or_show_open311);
        hide_or_show_open311(true);
    }

    // admin hints: maybe better implemented as tooltips?
    $(".admin-hint").on('click', function(){
        if ($(this).hasClass('admin-hint-show')) {
            $(this).removeClass('admin-hint-show');
        } else {
            $(this).addClass('admin-hint-show');
        }
    });

    // on a body's page, hide/show deleted contact categories
    var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category');
    if ($table_with_deleted_contacts.length == 1) {
        $table_with_deleted_contacts = $table_with_deleted_contacts.closest('table');
        var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>");
        $table_with_deleted_contacts.before($toggle_deleted_btn);
        $toggle_deleted_btn.on('click', function(e){
            e.preventDefault();
            var $cols = $table_with_deleted_contacts.find('tr.is-deleted');
            if ($cols.first().is(':visible')) {
                $cols.hide();
                $(this).prop("value", 'Show deleted contacts');
            } else {
                $cols.show();
                $(this).prop("value", 'Hide deleted contacts');
            }
        })
    }

});
<commit_msg>jslint fixes<commit_after>$(function(){
    // available for admin pages

    // hide the open311_only section and reveal it only when send_method is relevant
    var $open311_only = $('.admin-open311-only');
 
    function hide_or_show_open311(hide_fast) {
        var send_method = $('#send_method').val();
        var show_open311 = false;
        if ($('#endpoint').val()) {
            show_open311 = true; // always show the form if there is an endpoint value
        } else if (send_method && send_method.toLowerCase() != 'email') {
            show_open311 = true;
        }
        if (show_open311) {
            $open311_only.slideDown();
        } else {
            if (hide_fast) {
                $open311_only.hide();
            } else {
                $open311_only.slideUp();
            }
        }
    }

    if ($open311_only) {
        $('#send_method').on('change', hide_or_show_open311);
        hide_or_show_open311(true);
    }

    // admin hints: maybe better implemented as tooltips?
    $(".admin-hint").on('click', function(){
        if ($(this).hasClass('admin-hint-show')) {
            $(this).removeClass('admin-hint-show');
        } else {
            $(this).addClass('admin-hint-show');
        }
    });

    // on a body's page, hide/show deleted contact categories
    var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category');
    if ($table_with_deleted_contacts.length == 1) {
        $table_with_deleted_contacts = $table_with_deleted_contacts.closest('table');
        var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>");
        $table_with_deleted_contacts.before($toggle_deleted_btn);
        $toggle_deleted_btn.on('click', function(e){
            e.preventDefault();
            var $cols = $table_with_deleted_contacts.find('tr.is-deleted');
            if ($cols.first().is(':visible')) {
                $cols.hide();
                $(this).prop("value", 'Show deleted contacts');
            } else {
                $cols.show();
                $(this).prop("value", 'Hide deleted contacts');
            }
        });
    }

});

{'fraction_non_alphanumeric': 0.1469868801423171, 'fraction_numerical': 0.0200133422281521, 'mean_word_length': 2.1171171171171173, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4864100', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1301, 'n_words': 253}