<commit_before>/**
 * Module that enables account claiming on the project page. Makes unclaimed
 * usernames show popovers when clicked, where they can input their email.
 *
 * Sends HTTP requests to the claim_user_post endpoint.
 */
this.OSFAccountClaimer = (function($, global) {

    /** Validates that the input is an email address.
    * https://stackoverflow.com/questions/46155/validate-email-address-in-javascript
    */
    function validateEmail(email) {
        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(email);
    }

    function AccountClaimer (selector, options) {
        this.selector = selector;
        this.element = $(selector);
        this.options = $.extend({}, defaults, options);
        this.init();
    }

    function getClaimUrl() {
        var uid = $(this).data('pk');
        // FIXME: Hack; don't get project id from global
        var pid = global.nodeId;
        return  '/api/v1/user/' + uid + '/' + pid +  '/claim/verify/';
    }

    AccountClaimer.prototype = {
        constructor: AccountClaimer,
        init: function() {
            this.element.editable({
                type: 'text',
                value: '',
                ajaxOptions: {
                    type: 'post',
                    contentType: 'application/json',
                    dataType: 'json'  // Expect JSON response
                },
                display: function(value, sourceData){
                    if (sourceData && sourceData.fullname) {
                        $(this).text(sourceData.fullname);
                    }
                },
                // Send JSON payload
                params: function(params) {
                    return JSON.stringify(params);
                },
                title: 'Claim Account',
                placement: 'bottom',
                value: '',
                placeholder: 'Enter email...',
                validate: function(value) {<commit_msg>remove duplicate key in editable options<commit_after>/**
 * Module that enables account claiming on the project page. Makes unclaimed
 * usernames show popovers when clicked, where they can input their email.
 *
 * Sends HTTP requests to the claim_user_post endpoint.
 */
this.OSFAccountClaimer = (function($, global) {

    /** Validates that the input is an email address.
    * https://stackoverflow.com/questions/46155/validate-email-address-in-javascript
    */
    function validateEmail(email) {
        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(email);
    }

    function AccountClaimer (selector, options) {
        this.selector = selector;
        this.element = $(selector);
        this.options = $.extend({}, defaults, options);
        this.init();
    }

    function getClaimUrl() {
        var uid = $(this).data('pk');
        // FIXME: Hack; don't get project id from global
        var pid = global.nodeId;
        return  '/api/v1/user/' + uid + '/' + pid +  '/claim/verify/';
    }

    AccountClaimer.prototype = {
        constructor: AccountClaimer,
        init: function() {
            this.element.editable({
                type: 'text',
                value: '',
                ajaxOptions: {
                    type: 'post',
                    contentType: 'application/json',
                    dataType: 'json'  // Expect JSON response
                },
                display: function(value, sourceData){
                    if (sourceData && sourceData.fullname) {
                        $(this).text(sourceData.fullname);
                    }
                },
                // Send JSON payload
                params: function(params) {
                    return JSON.stringify(params);
                },
                title: 'Claim Account',
                placement: 'bottom',
                placeholder: 'Enter email...',
                validate: function(value) {
{'fraction_non_alphanumeric': 0.16473988439306358, 'fraction_numerical': 0.012042389210019268, 'mean_word_length': 1.6485969387755102, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '5778517', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1143, 'n_words': 258}