<commit_before>'use strict';
/*global $:false */
/*jshint unused:false */

function toggleNotes() {
    var siblingSelector = '.diffbar .diffbar-item.js-select-menu',
        buttonSelector = '.js-toggle-all-notes',
        $singleToggles = $('.show-file-notes input'),
        buttonTemplate  = '<div class="diffbar-item"><label><input type="checkbox" checked="checked" class="js-toggle-all-notes" style="margin-right: 5px;">Show all notes</label></div>';

    // Add the checkbox
    $(siblingSelector).after(buttonTemplate);

    // Easier to simulate the click than toggling all comments and checkboxes
    $(buttonSelector).change(function(event) {
        $.each($singleToggles, function(index, value) {
            value.click();
        });<commit_msg>Toggle all notes button only rendered once<commit_after>'use strict';
/*global $:false */
/*jshint unused:false */

function toggleNotes() {
    var toggleButtonSelector = '.js-toggle-all-notes';

    // Don't run this if we've already added the button
    if ($(toggleButtonSelector).length) {
        return;
    }

    var $singleToggles = $('.show-file-notes input'),
        buttonTemplate = '<div class="diffbar-item"><label><input type="checkbox" checked="checked" class="js-toggle-all-notes" style="margin-right: 5px;">Show all notes</label></div>';

    // Add the checkbox
    $('.diffbar .diffbar-item.js-select-menu').after(buttonTemplate);

    // Easier to simulate the click than toggling all comments and checkboxes
    $(toggleButtonSelector).change(function(event) {
        $.each($singleToggles, function(index, value) {
            value.click();
        });
{'fraction_non_alphanumeric': 0.15558267236119586, 'fraction_numerical': 0.0012202562538133007, 'mean_word_length': 3.5054945054945055, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6320907', 'n_tokens_mistral': 480, 'n_tokens_neox': 460, 'n_words': 111}