<commit_before>(function() {
    if($('.daily-message').length) {
        initDailyMessage();
    }

    var show_comments = function(e) {
        e.preventDefault();
        var $me = $(e.target);
        $me.hide();
        $me.next().show();
        $me.parents('tr').next().show();
    };

    var hide_comments = function(e) {
        e.preventDefault();
        var $me = $(e.target);
        $me.hide();
        $me.prev().show();
        $me.parents('tr').next().hide();
    };


    $('a.show').click(show_comments);
    $('a.hide').click(hide_comments);

    if ($('#queue-search').length) {
        initQueueSearch($('#queue-search'));
    }

    if($('#review-actions').length > 0) {
        initReviewActions();
    }

    if($('#monthly.highcharts-container').length) {
        initPerformanceStats();
    }

    if($('#scroll_sidebar').length && !$('body.mobile, body.tablet').length) {
        initScrollingSidebar();
    }

    if($('#addon-queue').length) {
        initQueue();
    }

    // Nav action menu overlays for queues and logs.
    var $logTabOverlay = $('#log-tab-overlay');
    var $queueTabOverlay = $('#queue-tab-overlay');
    $('.trigger-queues').click(_pd(function() {
        if (z.capabilities.mobile) {
            $queueTabOverlay.show();
        }
    }));
    $('.trigger-logs').click(_pd(function() {
        if (z.capabilities.mobile) {
            $logTabOverlay.show();
        }
    }));
    $('.nav-action-menu button').click(_pd(function() {
        // Turn buttons into links on nav tab overlays.
        var button = $(this);
        if (button.is(':last-child')) {
            $queueTabOverlay.hide();
            $logTabOverlay.hide();
        } else {
            window.location = button.data('url');
        }
    }));

    // Show add-on ID when icon is clicked
    if ($("#addon[data-id], #persona[data-id]").length) {
      $("#addon .icon").click(function() {
        window.location.hash = "id=" + $("#addon, #persona").attr("data-id");
      });
    }
})();

function initReviewActions() {
    var groups = $('#id_canned_response').find('optgroup');

    function showForm(element, pageload) {
        var $element = $(element),
            value = $element.find('input').val(),
            $data_toggle = $('#review-actions-form').find('.data-toggle');

        pageload = pageload || false;
        $element.closest('.review-actions').addClass('on');
        $('.review-actions .action_nav ul li').removeClass('on-tab');
        $element.find('input').attr('checked', true);

        $element.addClass('on-tab');

        if (pageload) {
          $('#review-actions-form').show();
        } else {
          $('#review-actions-form').slideDown();
          $('#review-actions').find('.errorlist').remove();
        }

        $data_toggle.hide();
        $data_toggle.filter('[data-value*="' + value + '"]').show();

        toggle_input();

        /* Fade out canned responses */
        var label = $element.text().trim();
        groups.css('color', '#AAA');
        groups.filter("[label='"+label+"']").css('color', '#444');
    }

    $('#review-actions .action_nav ul li').click(function(){ showForm(this); });

    /* Canned Response stuff */
    $('.review-actions-canned select').change(function() {
        insertAtCursor($('#id_comments'), $(this).val());
    });

    var review_checked = $('#review-actions [name=action]:checked');
    if(review_checked.length > 0) {
      showForm(review_checked.closest('li'), true);
    }

    /* File checkboxes */
    var $files_input = $('#review-actions .review-actions-files').find('input:enabled');

    if($files_input.length == 1 || ! $('#review-actions .review-actions-files').attr('data-uncheckable')) {
        // Add a dummy, disabled input
        $files_input.attr({'checked': true}).hide();
        $files_input.after($('<input>', {'type': 'checkbox', 'checked': true, 'disabled': true}));
    }

    function toggle_input(){
        var $files_input = $('#review-actions .review-actions-files').find('input:enabled'),
            $files_checked = $files_input.filter(':checked'),
            disable_submit = $files_checked.length < 1 && $('.review-actions-files').is(':visible');

        $('.review-actions-save input').attr('disabled', disable_submit);

        // If it's not :visible, we can assume it's been replaced with a dummy :disabled input
        $('#review-actions-files-warning').toggle($files_checked.filter(':enabled:visible').length > 1);
    }

    $files_input.change(toggle_input).each(toggle_input);

    /* Install Triggers */

    $('.files .install').click(_pd(function(){
        var $this = $(this),
            installer = $this.is('[data-type="search-tools"]') ? z.installSearch : z.installAddon;
        installer($this.text(), $this.attr('href'), "");<commit_msg>attr -> prop for editors.js which Marketplace sources (for jQuery 1.9 compatibility)<commit_after>(function() {
    if($('.daily-message').length) {
        initDailyMessage();
    }

    var show_comments = function(e) {
        e.preventDefault();
        var $me = $(e.target);
        $me.hide();
        $me.next().show();
        $me.parents('tr').next().show();
    };

    var hide_comments = function(e) {
        e.preventDefault();
        var $me = $(e.target);
        $me.hide();
        $me.prev().show();
        $me.parents('tr').next().hide();
    };


    $('a.show').click(show_comments);
    $('a.hide').click(hide_comments);

    if ($('#queue-search').length) {
        initQueueSearch($('#queue-search'));
    }

    if($('#review-actions').length > 0) {
        initReviewActions();
    }

    if($('#monthly.highcharts-container').length) {
        initPerformanceStats();
    }

    if($('#scroll_sidebar').length && !$('body.mobile, body.tablet').length) {
        initScrollingSidebar();
    }

    if($('#addon-queue').length) {
        initQueue();
    }

    // Nav action menu overlays for queues and logs.
    var $logTabOverlay = $('#log-tab-overlay');
    var $queueTabOverlay = $('#queue-tab-overlay');
    $('.trigger-queues').click(_pd(function() {
        if (z.capabilities.mobile) {
            $queueTabOverlay.show();
        }
    }));
    $('.trigger-logs').click(_pd(function() {
        if (z.capabilities.mobile) {
            $logTabOverlay.show();
        }
    }));
    $('.nav-action-menu button').click(_pd(function() {
        // Turn buttons into links on nav tab overlays.
        var button = $(this);
        if (button.is(':last-child')) {
            $queueTabOverlay.hide();
            $logTabOverlay.hide();
        } else {
            window.location = button.data('url');
        }
    }));

    // Show add-on ID when icon is clicked
    if ($("#addon[data-id], #persona[data-id]").length) {
      $("#addon .icon").click(function() {
        window.location.hash = "id=" + $("#addon, #persona").attr("data-id");
      });
    }
})();

function initReviewActions() {
    var groups = $('#id_canned_response').find('optgroup');

    function showForm(element, pageload) {
        var $element = $(element),
            value = $element.find('input').val(),
            $data_toggle = $('#review-actions-form').find('.data-toggle');

        pageload = pageload || false;
        $element.closest('.review-actions').addClass('on');
        $('.review-actions .action_nav ul li').removeClass('on-tab');
        $element.find('input').prop('checked', true);

        $element.addClass('on-tab');

        if (pageload) {
          $('#review-actions-form').show();
        } else {
          $('#review-actions-form').slideDown();
          $('#review-actions').find('.errorlist').remove();
        }

        $data_toggle.hide();
        $data_toggle.filter('[data-value*="' + value + '"]').show();

        toggle_input();

        /* Fade out canned responses */
        var label = $element.text().trim();
        groups.css('color', '#AAA');
        groups.filter("[label='"+label+"']").css('color', '#444');
    }

    $('#review-actions .action_nav ul li').click(function(){ showForm(this); });

    /* Canned Response stuff */
    $('.review-actions-canned select').change(function() {
        insertAtCursor($('#id_comments'), $(this).val());
    });

    var review_checked = $('#review-actions [name=action]:checked');
    if(review_checked.length > 0) {
      showForm(review_checked.closest('li'), true);
    }

    /* File checkboxes */
    var $files_input = $('#review-actions .review-actions-files').find('input:enabled');

    if($files_input.length == 1 || ! $('#review-actions .review-actions-files').attr('data-uncheckable')) {
        // Add a dummy, disabled input
        $files_input.prop('checked', true).hide();
        $files_input.after($('<input>', {'type': 'checkbox', 'checked': true, 'disabled': true}));
    }

    function toggle_input(){
        var $files_input = $('#review-actions .review-actions-files').find('input:enabled'),
            $files_checked = $files_input.filter(':checked'),
            disable_submit = $files_checked.length < 1 && $('.review-actions-files').is(':visible');

        $('.review-actions-save input').prop('disabled', disable_submit);

        // If it's not :visible, we can assume it's been replaced with a dummy :disabled input
        $('#review-actions-files-warning').toggle($files_checked.filter(':enabled:visible').length > 1);
    }

    $files_input.change(toggle_input).each(toggle_input);

    /* Install Triggers */

    $('.files .install').click(_pd(function(){
        var $this = $(this),
            installer = $this.is('[data-type="search-tools"]') ? z.installSearch : z.installAddon;
        installer($this.text(), $this.attr('href'), "");
{'fraction_non_alphanumeric': 0.20635737064088056, 'fraction_numerical': 0.0018516613517127868, 'mean_word_length': 2.612783351913787, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2822655', 'n_tokens_mistral': 2930, 'n_tokens_neox': 2878, 'n_words': 480}