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

    var gsTranslate = window.gsTranslate,
        encode = encodeURIComponent,
        translate,
        // https://gitorious.org/social/mainline/source/d318b5c10e557c447fc341747f72bf9cd73a6246:lib/action.php#L430
        installdir = _peopletagAC.replace("/main/peopletagautocomplete", "");

    translate = function (text) {
        var appId        = 'Bearer ',    // FIXME legacy: http://msdn.microsoft.com/en-us/library/hh454950.aspx
            to           = gsTranslate.targetLanguage || 'en',
            callbackName = 'gsTranslate.callback',
            script;

        script = document.createElement('script');

        script.src = '//api.microsofttranslator.com/V2/Ajax.svc/Translate' +
            '?appId=' + encode(appId) + encode(gsTranslate.accessToken.token) +
            '&to=' + encode(to) +
            '&text=' + encode(text) +
            '&oncomplete=' + encode(callbackName);

        document.body.appendChild(script);
    };

    $(document).on('click', '.gs-translate', function (e) {
        e.preventDefault();

        var $this = $(this),
            text = $this.closest('.notice').find('.e-content').first().text();

        if (gsTranslate.accessToken.expires < Date.now()) {
            // TODO: Error handling
            $.getJSON(installdir + '/main/translatenotice/renewtoken', function (data) {
                gsTranslate.accessToken.token = data.token;
                gsTranslate.accessToken.expires = data.expires;

                translate(text);
            });
        } else {
            translate(text);
        }
    });

    gsTranslate.callback = function (response) {
        alert(response);
    };
}(window, jQuery));<commit_msg>Formatting<commit_after>/*global _peopletagAC: false*/
( function( window, $ ) {
    "use strict";

    var gsTranslate = window.gsTranslate,
        encode = encodeURIComponent,
        translate,
        installdir = _peopletagAC.replace( "/main/peopletagautocomplete", "" ),
        $dialog = $( "<div class='gs-translate-dialog'>" ).dialog( { autoOpen: false } )/*.appendTo( "body" )*/;

    translate = function( text ) {
        var appId        = "Bearer ",    /* FIXME legacy: http://msdn.microsoft.com/en-us/library/hh454950.aspx */
            to           = gsTranslate.targetLanguage || "en",
            callbackName = "gsTranslate.callback",
            script;

        script = document.createElement( "script" );

        script.src = "//api.microsofttranslator.com/V2/Ajax.svc/Translate" +
            "?appId=" + encode( appId ) + encode( gsTranslate.accessToken.token ) +
            "&to=" + encode( to ) +
            "&text=" + encode( text ) +
            "&oncomplete=" + encode( callbackName );

        document.body.appendChild( script );
    };

    $( document ).on( "click", ".gs-translate", function( e ) {
        e.preventDefault();

        var $this = $( this ),
            text = $this.closest( ".notice" ).find( ".e-content" ).first().text();

        if ( gsTranslate.accessToken.expires < Date.now() ) {
            /* TODO: Error handling */
            $.getJSON( installdir + "/main/translatenotice/renewtoken", function( data ) {
                gsTranslate.accessToken.token = data.token;
                gsTranslate.accessToken.expires = data.expires;

                translate( text );
            } );
        } else {
            translate( text );
        }
    } );

    gsTranslate.callback = function( response ) {
        $dialog.text( response ).dialog( "open" );
    };
}( window, jQuery ) );
{'fraction_non_alphanumeric': 0.15106914745903915, 'fraction_numerical': 0.012218828103304638, 'mean_word_length': 2.07600341588386, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 1, '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': '4694972', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1049, 'n_words': 179}