<commit_before>define('plugin/download-archive', ['jquery', 'aui', 'model/page-state', 'util/navbuilder', 'exports'], function ($, AJS, pageState, navBuilder, exports) {
    exports.onReady = function (buttonSelector) {
        var $button = $(buttonSelector);

        /**
         * Update the "download archive" button's URL to target the specified ref.
         *
         * @param revisionRef the ref that the archive button should target. Falsey means no ref to be set, which will
         * cause the server to default to HEAD of the default branch.
         */
        var updateDownloadRef = function(revisionRef) {
            $button.attr("href", AJS.contextPath() + "/plugins/servlet/archive/projects/" +
                encodeURIComponent(pageState.getProject().key) + "/repos/" +
                encodeURIComponent(pageState.getRepository().slug) +
                (revisionRef ? "?at=" + encodeURIComponent(revisionRef) : ""));
        };

        // On page load, grab the current ref out of page-state
        var currentRef = pageState.getRevisionRef() ? pageState.getRevisionRef().id : null;
        updateDownloadRef(currentRef);

        // Also, bind to the branch selector's change event to grab the newly selected ref
        eve.on('stash.feature.repository.revisionReferenceSelector.revisionRefChanged', function(revisionRef, context) {
            updateDownloadRef(revisionRef.id);
        });
    }
});

AJS.$(function() {
    require('plugin/download-archive').onReady('#download-archive-button');
});<commit_msg>STASHDEV-6530: Update front-end code to stop using APIs removed in Stash 3.0<commit_after>define('plugin/download-archive', [
    'jquery',
    'aui',
    'model/page-state',
    'util/navbuilder',
    'exports'
], function(
    $,
    AJS,
    pageState,
    navBuilder,
    exports
) {


    exports.onReady = function (buttonSelector) {
        var $button = $(buttonSelector);

        /**
         * Update the "download archive" button's URL to target the specified ref.
         *
         * @param revisionRef the ref that the archive button should target. Falsey means no ref to be set, which will
         * cause the server to default to HEAD of the default branch.
         */
        var updateDownloadRef = function(revisionRef) {
            $button.attr("href", AJS.contextPath() + "/plugins/servlet/archive/projects/" +
                encodeURIComponent(pageState.getProject().getKey()) + "/repos/" +
                encodeURIComponent(pageState.getRepository().getSlug()) +
                (revisionRef ? "?at=" + encodeURIComponent(revisionRef) : ""));
        };

        // On page load, grab the current ref out of page-state
        var currentRef = pageState.getRevisionRef() ? pageState.getRevisionRef().id : null;
        updateDownloadRef(currentRef);

        // Also, bind to the branch selector's change event to grab the newly selected ref
        eve.on('stash.feature.repository.revisionReferenceSelector.revisionRefChanged', function(revisionRef, context) {
            updateDownloadRef(revisionRef.id);
        });
    }
});

AJS.$(function() {
    require('plugin/download-archive').onReady('#download-archive-button');
});

{'fraction_non_alphanumeric': 0.12293291731669266, 'fraction_numerical': 0.00187207488299532, 'mean_word_length': 2.758499413833529, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2871455', 'n_tokens_mistral': 876, 'n_tokens_neox': 857, 'n_words': 223}