<commit_before>$(function() {
    /**
     * Toggles the ARIA expanded and hidden attributes' state.
     *
     * @param Object elem The element on which to toggle the attribute.
     */
    function toggleAria(elem) {
        var expandedState = elem.attr('aria-expanded') === 'true' ? 'false' : 'true';
        var hiddenState = elem.attr('aria-hidden') === 'true' ? 'false' : 'true';
        elem.attr('aria-hidden', hiddenState);
        elem.attr('aria-expanded', expandedState);
    }

    $('#panel-toggle').click(function(event) {
        var panelContent = $('#panel-content');
        var icon = $('.navpanel-icon', this);

        icon.toggleClass('expanded');
        panelContent.toggle();
        toggleAria(panelContent);
    });

    var permalinkNode = $('.panel a[title="Permalink"]');
    permalinkNode = permalinkNode.length == 0 ? null : permalinkNode[0];

    function pushPermalink() {
        if (history.state && history.state.permalink) {
            return false;
        }
        if (permalinkNode) {
            history.pushState(
                { permalink: permalinkNode.href },
                window.title,
                permalinkNode.href
            );
            return true;
        }
        return false;
    }

    if (permalinkNode) {
        permalinkNode.addEventListener('click', (event) => {
            if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
                return;
            }
            if (pushPermalink()) {
                event.preventDefault();
            }
        });
    }

    function handleAccelerator(event) {
        if (event.altKey || event.ctrlKey || event.metaKey) {<commit_msg>Bug 1541199 - Avoid reloading the page on triggering permalink twice<commit_after>$(function() {
    /**
     * Toggles the ARIA expanded and hidden attributes' state.
     *
     * @param Object elem The element on which to toggle the attribute.
     */
    function toggleAria(elem) {
        var expandedState = elem.attr('aria-expanded') === 'true' ? 'false' : 'true';
        var hiddenState = elem.attr('aria-hidden') === 'true' ? 'false' : 'true';
        elem.attr('aria-hidden', hiddenState);
        elem.attr('aria-expanded', expandedState);
    }

    $('#panel-toggle').click(function(event) {
        var panelContent = $('#panel-content');
        var icon = $('.navpanel-icon', this);

        icon.toggleClass('expanded');
        panelContent.toggle();
        toggleAria(panelContent);
    });

    var permalinkNode = $('.panel a[title="Permalink"]');
    permalinkNode = permalinkNode.length == 0 ? null : permalinkNode[0];

    function pushPermalink() {
        if (permalinkNode) {
            if (window.location.href != permalinkNode.href) {
                history.pushState(
                    { permalink: permalinkNode.href },
                    window.title,
                    permalinkNode.href
                );
            }
            return true;
        }
        return false;
    }

    if (permalinkNode) {
        permalinkNode.addEventListener('click', (event) => {
            if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
                return;
            }
            if (pushPermalink()) {
                event.preventDefault();
            }
        });
    }

    function handleAccelerator(event) {
        if (event.altKey || event.ctrlKey || event.metaKey) {
{'fraction_non_alphanumeric': 0.1364033809385019, 'fraction_numerical': 0.0032060623724861556, 'mean_word_length': 1.9535283993115318, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5157489', 'n_tokens_mistral': 987, 'n_tokens_neox': 953, 'n_words': 197}