<commit_before>$(function() {
    PushManager = window.PushManager || {};
    PushManager.NewRequestDialog = PushManager.NewRequestDialog || {};

    PushManager.NewRequestDialog.element = $('#create-new-request-dialog');
    PushManager.NewRequestDialog.element.dialog({
        autoOpen: false,
        title: 'Create/Edit Push Request',
        width: 650,
        minWidth: 650,
        height: 805,
        maxHeight: 805,
        minHeight: 805,
        closeOnEscape: false
    });

    PushManager.NewRequestDialog.validate = function() {
        var d = PushManager.NewRequestDialog.element;

        // Validate ReviewBoard ID
        if(!/^\d*$/.test(d.find('#request-form-review').val())) {
            alert("Invalid review # - only integer ReviewBoard IDs are allowed.");
            return false;
        }

        // Validate l10n-only request
        if(d.find('#request-form-tags').val().match('[ ]?l10n-only[ ]?') && d.find('#request-form-branch').val() !== '') {
            alert("l10n-only request should not have a branch. " +
                  "Use l10n request tag if you have a repository change to be pushed. " +
                  "Please remove l10n-only tag or branch name from your request.");
            return false;
        }

        return true;
    };
    $('#request-info-form').submit(PushManager.NewRequestDialog.validate);

    PushManager.NewRequestDialog.open_new_request = function(title, branch, repo, review, comments, description, watchers, tags, requestid, requestuser, notyours) {
        var d = PushManager.NewRequestDialog.element;

        d.find('#request-form-title').val(title || '');
        d.find('#request-form-repo').val(repo || PushManager.current_user);
        d.find('#request-form-branch').val(branch || '');
        d.find('#request-form-review').val(review || '');
        d.find('#request-form-tags').val(tags || '');
        d.find('#request-form-comments').val(comments || '');
        d.find('#request-form-description').val(description || '');
        d.find('#request-form-watchers').val(watchers || '');
        d.find('#request-form-user').val(requestuser || '');
        d.find('#request-form-id').val(requestid || '');
        d.find('#request-form-takeover-label').toggle(notyours || false);

        d.dialog('open');
    };

    $('#create-new-request').click(function() {
        PushManager.NewRequestDialog.open_new_request();
    });

    $('.edit-request').click(function() {
        var that = $(this).closest('.request-module');
        var tags = '';
        that.find('ul.tags > li').each(function() {
            if(tags !== '') tags += ' ';
            tags += $(this).text().replace(/^\s+|\s+$/g, '');
        });
        PushManager.NewRequestDialog.open_new_request(
            that.attr('request_title'),
            that.attr('branch'),
            that.attr('repo'),
            that.attr('reviewid'),
            that.find('.request-comments').text().replace(/\n{3,}/g, '\n\n'),
            that.find('.request-description').text(),
            that.attr('watchers'),
            tags,
            that.attr('request'),
            that.attr('user'),
            that.attr('user') != PushManager.current_user
        );
    });

    $('.tag-suggestion').click(function() {
        var that = $(this);
        var tagtext = $("#request-form-tags").val();
        var newtag = that.text();
        if(tagtext.indexOf(newtag) == -1) {
            if(tagtext.length > 0) {
                tagtext += " ";
            }
            tagtext += newtag;
            $("#request-form-tags").val(tagtext);
        }<commit_msg>Use the classname of tags instead of text value<commit_after>$(function() {
    PushManager = window.PushManager || {};
    PushManager.NewRequestDialog = PushManager.NewRequestDialog || {};

    PushManager.NewRequestDialog.element = $('#create-new-request-dialog');
    PushManager.NewRequestDialog.element.dialog({
        autoOpen: false,
        title: 'Create/Edit Push Request',
        width: 650,
        minWidth: 650,
        height: 805,
        maxHeight: 805,
        minHeight: 805,
        closeOnEscape: false
    });

    PushManager.NewRequestDialog.validate = function() {
        var d = PushManager.NewRequestDialog.element;

        // Validate ReviewBoard ID
        if(!/^\d*$/.test(d.find('#request-form-review').val())) {
            alert("Invalid review # - only integer ReviewBoard IDs are allowed.");
            return false;
        }

        // Validate l10n-only request
        if(d.find('#request-form-tags').val().match('[ ]?l10n-only[ ]?') && d.find('#request-form-branch').val() !== '') {
            alert("l10n-only request should not have a branch. " +
                  "Use l10n request tag if you have a repository change to be pushed. " +
                  "Please remove l10n-only tag or branch name from your request.");
            return false;
        }

        return true;
    };
    $('#request-info-form').submit(PushManager.NewRequestDialog.validate);

    PushManager.NewRequestDialog.open_new_request = function(title, branch, repo, review, comments, description, watchers, tags, requestid, requestuser, notyours) {
        var d = PushManager.NewRequestDialog.element;

        d.find('#request-form-title').val(title || '');
        d.find('#request-form-repo').val(repo || PushManager.current_user);
        d.find('#request-form-branch').val(branch || '');
        d.find('#request-form-review').val(review || '');
        d.find('#request-form-tags').val(tags || '');
        d.find('#request-form-comments').val(comments || '');
        d.find('#request-form-description').val(description || '');
        d.find('#request-form-watchers').val(watchers || '');
        d.find('#request-form-user').val(requestuser || '');
        d.find('#request-form-id').val(requestid || '');
        d.find('#request-form-takeover-label').toggle(notyours || false);

        d.dialog('open');
    };

    $('#create-new-request').click(function() {
        PushManager.NewRequestDialog.open_new_request();
    });

    $('.edit-request').click(function() {
        var that = $(this).closest('.request-module');
        var tags = '';
        that.find('ul.tags > li').each(function(_, elem) {
            if(tags !== '') tags += ' ';
            tags += elem.classList[0].replace(/tag-/, '');
        });
        PushManager.NewRequestDialog.open_new_request(
            that.attr('request_title'),
            that.attr('branch'),
            that.attr('repo'),
            that.attr('reviewid'),
            that.find('.request-comments').text().replace(/\n{3,}/g, '\n\n'),
            that.find('.request-description').text(),
            that.attr('watchers'),
            tags,
            that.attr('request'),
            that.attr('user'),
            that.attr('user') != PushManager.current_user
        );
    });

    $('.tag-suggestion').click(function() {
        var that = $(this);
        var tagtext = $("#request-form-tags").val();
        var newtag = that.text();
        if(tagtext.indexOf(newtag) == -1) {
            if(tagtext.length > 0) {
                tagtext += " ";
            }
            tagtext += newtag;
            $("#request-form-tags").val(tagtext);
        }
{'fraction_non_alphanumeric': 0.17981853175694254, 'fraction_numerical': 0.00783612867748144, 'mean_word_length': 2.2667265379434216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1859792', 'n_tokens_mistral': 2151, 'n_tokens_neox': 2063, 'n_words': 331}