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

    var $revisionReplaceBlock = $('#revision-replace-block');
    var $localeInput = $('#id_locale');
    var $filterForm = $('#revision-filter');
    var $pageInput = $('#revision-page');
    var currentLocale = $('html').attr('lang');

    /**
     * Builds and returns an individual list item
     * @param {Object} properties - A properties object with values
     * for the attibutes of the anchor element
     * Example
     * --------
     * {
     *   id: 'revert',
     *   href: controlURLs.revertURL,
     *   text: gettext(actionsArray[i]),
     *   icon: 'undo'
     * }
     * @returns The list element as a `HTMLElement`
     */
    function getListItem(properties) {
        var listItem = document.createElement('li');
        var anchor = document.createElement('a');
        anchor.setAttribute('id', properties.id);
        anchor.setAttribute('href', properties.href);
        anchor.classList.add('button');
        anchor.textContent = properties.text;
        anchor.append(window.mdnIcons ? window.mdnIcons.getIcon(properties.icon) : '');
        return listItem.appendChild(anchor);
    }

    /**
     * Builds and returns all the action buttons as an unordered list
     * @param {Object} controlURLs - The url for each action
     * @returns An unordered list with action buttons as a `HTMLElement`
     */
    function getActionButtons(controlURLs) {
        var actionsArray = ['Revert', 'View Page', 'Edit Page', 'History'];
        var pageButtons = document.createElement('ul');
        pageButtons.setAttribute('id', 'page-buttons');

        for (var i = 0, l = actionsArray.length; i < l; i++) {
            if (actionsArray[i] === 'Revert') {
                pageButtons.appendChild(getListItem({
                    id: 'revert',
                    href: controlURLs.revertURL,
                    text: gettext('Revert'),
                    icon: 'undo'
                }));
            }

            if (actionsArray[i] === 'View Page') {
                pageButtons.appendChild(getListItem({
                    id: 'view',
                    href: controlURLs.viewURL,
                    text: gettext('View Page'),
                    icon: 'play'
                }));
            }

            if (actionsArray[i] === 'Edit Page') {
                pageButtons.appendChild(getListItem({
                    id: 'edit',
                    href: controlURLs.editURL,
                    text: gettext('Edit Page'),
                    icon: 'pencil'
                }));
            }

            if (actionsArray[i] === 'History') {
                pageButtons.appendChild(getListItem({
                    id: 'history',
                    href: controlURLs.editURL,
                    text: gettext('History'),
                    icon: 'book'
                }));
            }
        }

        return pageButtons;
    }

    /**
     * Builds and returns the actions bar setting urls as specified
     * in the `controlURLs` object
     * @param {Object} controlURLs - URLs to set for the various controls
     * Example
     * --------
     * {
     *   revertURL: 'https://...',
     *   viewURL: 'https://...',<commit_msg>Bug 1489981, history button goes to edit instead on dashboard<commit_after>(function ($) {
    'use strict';

    var $revisionReplaceBlock = $('#revision-replace-block');
    var $localeInput = $('#id_locale');
    var $filterForm = $('#revision-filter');
    var $pageInput = $('#revision-page');
    var currentLocale = $('html').attr('lang');

    /**
     * Builds and returns an individual list item
     * @param {Object} properties - A properties object with values
     * for the attibutes of the anchor element
     * Example
     * --------
     * {
     *   id: 'revert',
     *   href: controlURLs.revertURL,
     *   text: gettext(actionsArray[i]),
     *   icon: 'undo'
     * }
     * @returns The list element as a `HTMLElement`
     */
    function getListItem(properties) {
        var listItem = document.createElement('li');
        var anchor = document.createElement('a');
        anchor.setAttribute('id', properties.id);
        anchor.setAttribute('href', properties.href);
        anchor.classList.add('button');
        anchor.textContent = properties.text;
        anchor.append(window.mdnIcons ? window.mdnIcons.getIcon(properties.icon) : '');
        return listItem.appendChild(anchor);
    }

    /**
     * Builds and returns all the action buttons as an unordered list
     * @param {Object} controlURLs - The url for each action
     * @returns An unordered list with action buttons as a `HTMLElement`
     */
    function getActionButtons(controlURLs) {
        var actionsArray = ['Revert', 'View Page', 'Edit Page', 'History'];
        var pageButtons = document.createElement('ul');
        pageButtons.setAttribute('id', 'page-buttons');

        for (var i = 0, l = actionsArray.length; i < l; i++) {
            if (actionsArray[i] === 'Revert') {
                pageButtons.appendChild(getListItem({
                    id: 'revert',
                    href: controlURLs.revertURL,
                    text: gettext('Revert'),
                    icon: 'undo'
                }));
            }

            if (actionsArray[i] === 'View Page') {
                pageButtons.appendChild(getListItem({
                    id: 'view',
                    href: controlURLs.viewURL,
                    text: gettext('View Page'),
                    icon: 'play'
                }));
            }

            if (actionsArray[i] === 'Edit Page') {
                pageButtons.appendChild(getListItem({
                    id: 'edit',
                    href: controlURLs.editURL,
                    text: gettext('Edit Page'),
                    icon: 'pencil'
                }));
            }

            if (actionsArray[i] === 'History') {
                pageButtons.appendChild(getListItem({
                    id: 'history',
                    href: controlURLs.historyURL,
                    text: gettext('History'),
                    icon: 'book'
                }));
            }
        }

        return pageButtons;
    }

    /**
     * Builds and returns the actions bar setting urls as specified
     * in the `controlURLs` object
     * @param {Object} controlURLs - URLs to set for the various controls
     * Example
     * --------
     * {
     *   revertURL: 'https://...',
     *   viewURL: 'https://...',
{'fraction_non_alphanumeric': 0.13111485968409753, 'fraction_numerical': 0.0013801564177273425, 'mean_word_length': 1.688375927452597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '2199444', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1724, 'n_words': 430}