<commit_before>(function(win, doc, $) {
    'use strict';

    // hide old table
    $('.bc-old').addClass('hidden');
    // show new table
    $('.bc-data').removeClass('hidden');

    // Private var to assign IDs to history for accessibility purposes
    var historyCount = 0;

    // The open button template
    var $historyLink = $('<button title="' + gettext('Open implementation notes') + '" class="bc-history-link only-icon" tabindex="-1"><span>' + gettext('Open') + '</span><i class="ic-history" aria-hidden="true"></i></button>');
    // The close button template
    var $historyCloseButton = $('<button class="bc-history-button only-icon"><abbr title="' + gettext('Return to compatibility table.') + '"><span>' + gettext('Close') + '</span><i class="icon-times" aria-hidden="true"></i></abbr></button>');

    var animationProps = {
        duration: 150,
        queue: false,
        easing: 'linear'
    };

    //  Usage: $('.compat-table').mozCompatTable();
    return jQuery.fn.mozCompatTable = function() {

        return $(this).each(function() {

            var $table = $(this);

            // add beta notice & menu
            addBetaNotice($table);

            // Keep track of what may be open within this table
            var $openCell;

            // This limits very quick opening and closing of cells which results in incorrect height counts
            var animating = false;

            var subjectAnimation = $.extend({ complete: function() { animating = false; } }, animationProps);

            // Activate all history cells for keyboard
            $table.find('.bc-has-history').each(function() {
                var historyId = 'bc-history-' + (++historyCount);
                var $td = $(this);
                var $history = $td.find('.bc-history');

                $td.attr({
                    tabIndex: 0,
                    'aria-expanded': false,
                    'aria-controls': historyId
                });

                $history.attr('id', historyId);
                // generate and add button to open history tray
                $historyLink.clone().insertBefore($history);
            });

            // Listen for interaction on "history" cells
            $table.on('click touchend', '.bc-has-history', function(e) {
                var $actualTarget = $(e.target);

                // Don't open/close if the user interaction is within the history section
                if ($actualTarget.parents('.bc-history').length || $actualTarget.hasClass('bc-history')) {
                    e.stopImmediatePropagation();
                    return;
                }

                // prevent touch event from bubbling to a click event as well
                // has no effect if this was a click
                e.preventDefault();

                // Close previous cell, open the next one
                closeAndOpenHistory($(this));
            });

            // Listen for interaction on "close" buttons
            $table.on('click touchend', '.bc-history-button', function(ev) {
                ev.stopImmediatePropagation();
                hideHistory();
            });

            // Listen for keyboard events to open/close history
            $table.on('keypress', '.bc-has-history', function(ev) {
                var $td = $(this);
                var key = ev.which;

                if (key === 13 || key === 32) {
                    closeAndOpenHistory($td);
                    ev.preventDefault();
                } else if (key === 27) {
                    hideHistory();
                    ev.preventDefault();
                }
            });

            /** add beta notice & associated functonality */
            function addBetaNotice($table) {
                var $betaMenuWrapper = $('<div />', { 'class': 'bc-beta-menu' });
                var $betaMenuTrigger = $('<a />', { text: gettext('New compatibility tables are in beta '), href: '/en-US/docs/New_Compatibility_Tables_Beta' }).append($('<i />', { class: 'icon-caret-down', 'aria-hidden': 'true' }));
                var $betaSubmenu = $('<ul />', { 'class': 'submenu js-submenu' });
                var betaSubmenuItems = [];

                var $betaLink = $('<a />', { text: gettext('More about the beta.'), href: '/docs/New_Compatibility_Tables_Beta' });
                betaSubmenuItems.push($betaLink);

                var $betaSurvey = $('<a />', { text: gettext('Take the survey'), href: 'https://www.surveygizmo.com/s3/2342437/0b5ff6b6b8f6', 'class': 'external external-icon' });<commit_msg>Fixed l10n-aware link to New_Compatibility_Tables_Beta (#4609)<commit_after>(function(win, doc, $) {
    'use strict';

    // hide old table
    $('.bc-old').addClass('hidden');
    // show new table
    $('.bc-data').removeClass('hidden');

    // Private var to assign IDs to history for accessibility purposes
    var historyCount = 0;

    // The open button template
    var $historyLink = $('<button title="' + gettext('Open implementation notes') + '" class="bc-history-link only-icon" tabindex="-1"><span>' + gettext('Open') + '</span><i class="ic-history" aria-hidden="true"></i></button>');
    // The close button template
    var $historyCloseButton = $('<button class="bc-history-button only-icon"><abbr title="' + gettext('Return to compatibility table.') + '"><span>' + gettext('Close') + '</span><i class="icon-times" aria-hidden="true"></i></abbr></button>');

    var animationProps = {
        duration: 150,
        queue: false,
        easing: 'linear'
    };

    //  Usage: $('.compat-table').mozCompatTable();
    return jQuery.fn.mozCompatTable = function() {

        return $(this).each(function() {

            var $table = $(this);

            // add beta notice & menu
            addBetaNotice($table);

            // Keep track of what may be open within this table
            var $openCell;

            // This limits very quick opening and closing of cells which results in incorrect height counts
            var animating = false;

            var subjectAnimation = $.extend({ complete: function() { animating = false; } }, animationProps);

            // Activate all history cells for keyboard
            $table.find('.bc-has-history').each(function() {
                var historyId = 'bc-history-' + (++historyCount);
                var $td = $(this);
                var $history = $td.find('.bc-history');

                $td.attr({
                    tabIndex: 0,
                    'aria-expanded': false,
                    'aria-controls': historyId
                });

                $history.attr('id', historyId);
                // generate and add button to open history tray
                $historyLink.clone().insertBefore($history);
            });

            // Listen for interaction on "history" cells
            $table.on('click touchend', '.bc-has-history', function(e) {
                var $actualTarget = $(e.target);

                // Don't open/close if the user interaction is within the history section
                if ($actualTarget.parents('.bc-history').length || $actualTarget.hasClass('bc-history')) {
                    e.stopImmediatePropagation();
                    return;
                }

                // prevent touch event from bubbling to a click event as well
                // has no effect if this was a click
                e.preventDefault();

                // Close previous cell, open the next one
                closeAndOpenHistory($(this));
            });

            // Listen for interaction on "close" buttons
            $table.on('click touchend', '.bc-history-button', function(ev) {
                ev.stopImmediatePropagation();
                hideHistory();
            });

            // Listen for keyboard events to open/close history
            $table.on('keypress', '.bc-has-history', function(ev) {
                var $td = $(this);
                var key = ev.which;

                if (key === 13 || key === 32) {
                    closeAndOpenHistory($td);
                    ev.preventDefault();
                } else if (key === 27) {
                    hideHistory();
                    ev.preventDefault();
                }
            });

            /** add beta notice & associated functonality */
            function addBetaNotice($table) {
                var $betaMenuWrapper = $('<div />', { 'class': 'bc-beta-menu' });
                var $betaMenuTrigger = $('<a />', { text: gettext('New compatibility tables are in beta '), href: '/docs/New_Compatibility_Tables_Beta' }).append($('<i />', { class: 'icon-caret-down', 'aria-hidden': 'true' }));
                var $betaSubmenu = $('<ul />', { 'class': 'submenu js-submenu' });
                var betaSubmenuItems = [];

                var $betaLink = $('<a />', { text: gettext('More about the beta.'), href: '/docs/New_Compatibility_Tables_Beta' });
                betaSubmenuItems.push($betaLink);

                var $betaSurvey = $('<a />', { text: gettext('Take the survey'), href: 'https://www.surveygizmo.com/s3/2342437/0b5ff6b6b8f6', 'class': 'external external-icon' });
{'fraction_non_alphanumeric': 0.14841451454723767, 'fraction_numerical': 0.006320148196578402, 'mean_word_length': 1.8353413654618473, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2747294', 'n_tokens_mistral': 2489, 'n_tokens_neox': 2319, 'n_words': 637}