<commit_before>Ember.FacebookMixin = Ember.Mixin.create({
    FBUser: void 0,
    appId: void 0,
    facebookParams: Ember.Object.create(),
    fetchPicture: true,
    connectError: false,

    init: function() {
        this._super();
        return window.FBApp = this;
    },

    facebookConfigChanged: (function() {
        var _this = this;
        this.removeObserver('appId');

        window.fbAsyncInit = function() {
            return _this.fbAsyncInit();
        };

        return $(function() {
            var js;
            $('body').append($("<div>").attr('id', 'fb-root'));
            js = document.createElement('script');
            
            $(js).attr({
                id: 'facebook-jssdk',
                async: true,
                src: "//connect.facebook.net/en_US/all.js"
            });
            return $('head').append(js);
        });
    }).observes('facebookParams', 'appId'),

    fbAsyncInit: function() {
        var facebookParams,
            _this = this;

        facebookParams = this.get('facebookParams');
        facebookParams = facebookParams.setProperties({
            appId: this.get('appId' || facebookParams.get('appId') || void 0),
            status: facebookParams.get('status') || true,
            cookie: facebookParams.get('cookie') || true,
            xfbml: facebookParams.get('xfbml') || true,
            channelUrl: facebookParams.get('channelUrl') || void 0
        });

        FB.init(facebookParams);

        this.set('FBloading', true);


        FB.Event.subscribe('auth.authResponseChange', function(response) {
            if (typeof _this.appLogin == 'function') {
                _this.appLogin(response.authResponse);
            }
            return _this.updateFBUser(response);
        });

        FB.Event.subscribe('auth.login', function(response){
            console.log("pol", response);
        });

        FB.Event.subscribe('auth.statusChange', function(response){
            console.log("polka", response);
            if (response.status === 'not_authorized' ){
                console.log("User has not authorized the application")
            }
        });

        return FB.getLoginStatus(function(response) {
            console.log("hallo", response);
            if (response.status === 'connected') {

                if (typeof _this.appLogin == 'function') {
                    _this.appLogin(response.authResponse);
                }
            }

            return _this.updateFBUser(response);
        });
    },

    updateFBUser: function(response) {
        var _this = this;

        if (response.status === 'connected') {
            return FB.api('/me', function(user) {
                var FBUser;
                FBUser = Ember.Object.create(user);
                FBUser.set('accessToken', response.authResponse.accessToken);
                FBUser.set('accessToken', response.authResponse.accessToken);
                FBUser.set('expiresIn', response.authResponse.expiresIn);

                if (_this.get('fetchPicture')) {
                    return FB.api('/me/picture', function(resp) {
                        FBUser.picture = resp.data.url;
                        _this.set('FBUser', FBUser);
                        return FB.api('/me/picture?type=large', function(resp) {
                            FBUser.largePicture = resp.data.url;
                            _this.set('FBUser', FBUser);
                            return _this.set('FBloading', false);
                        });
                    });
                } else {
                    _this.set('FBUser', FBUser);
                    return _this.set('FBloading', false);
                }
            });
        } else {
            this.set('FBUser', false);
            return this.set('FBloading', false);
        }
    }
});



Ember.FBView = Ember.View.extend({
   classNames: ['btn', 'btn-facebook', 'btn-iconed', 'fb-login-button'],
   error: null,
   click: function(e){
       var _this = this;
       FB.getLoginStatus(function(response) {
            if (response.status === 'connected') {
                App.appLogin(response.authResponse);

            } else {
               FB.login(function(response){
                  console.log("KUKOO!", response);
                  if (response.status === 'connected') {
                    App.appLogin(response.authResponse);

                  }

                  if (response.authResponse == null && response.status == 'unknown'){
                      console.log("There was an error logging in the user or authorizing the app");
                      FBApp.set('connectError', gettext("There was an error logging in the user or authorizing the app"));
                  }
               });
            }
       });
   }
});


<commit_msg>removed redundant logging<commit_after>Ember.FacebookMixin = Ember.Mixin.create({
    FBUser: void 0,
    appId: void 0,
    facebookParams: Ember.Object.create(),
    fetchPicture: true,
    connectError: false,

    init: function() {
        this._super();
        return window.FBApp = this;
    },

    facebookConfigChanged: (function() {
        var _this = this;
        this.removeObserver('appId');

        window.fbAsyncInit = function() {
            return _this.fbAsyncInit();
        };

        return $(function() {
            var js;
            $('body').append($("<div>").attr('id', 'fb-root'));
            js = document.createElement('script');
            
            $(js).attr({
                id: 'facebook-jssdk',
                async: true,
                src: "//connect.facebook.net/en_US/all.js"
            });
            return $('head').append(js);
        });
    }).observes('facebookParams', 'appId'),

    fbAsyncInit: function() {
        var facebookParams,
            _this = this;

        facebookParams = this.get('facebookParams');
        facebookParams = facebookParams.setProperties({
            appId: this.get('appId' || facebookParams.get('appId') || void 0),
            status: facebookParams.get('status') || true,
            cookie: facebookParams.get('cookie') || true,
            xfbml: facebookParams.get('xfbml') || true,
            channelUrl: facebookParams.get('channelUrl') || void 0
        });

        FB.init(facebookParams);

        this.set('FBloading', true);


        FB.Event.subscribe('auth.authResponseChange', function(response) {
            if (typeof _this.appLogin == 'function') {
                _this.appLogin(response.authResponse);
            }
            return _this.updateFBUser(response);
        });

        FB.Event.subscribe('auth.login', function(response){
            console.log("pol", response);
        });

        FB.Event.subscribe('auth.statusChange', function(response){
            console.log("polka", response);
            if (response.status === 'not_authorized' ){
                console.log("User has not authorized the application")
            }
        });

        return FB.getLoginStatus(function(response) {
            console.log("hallo", response);
            if (response.status === 'connected') {

                if (typeof _this.appLogin == 'function') {
                    _this.appLogin(response.authResponse);
                }
            }

            return _this.updateFBUser(response);
        });
    },

    updateFBUser: function(response) {
        var _this = this;

        if (response.status === 'connected') {
            return FB.api('/me', function(user) {
                var FBUser;
                FBUser = Ember.Object.create(user);
                FBUser.set('accessToken', response.authResponse.accessToken);
                FBUser.set('accessToken', response.authResponse.accessToken);
                FBUser.set('expiresIn', response.authResponse.expiresIn);

                if (_this.get('fetchPicture')) {
                    return FB.api('/me/picture', function(resp) {
                        FBUser.picture = resp.data.url;
                        _this.set('FBUser', FBUser);
                        return FB.api('/me/picture?type=large', function(resp) {
                            FBUser.largePicture = resp.data.url;
                            _this.set('FBUser', FBUser);
                            return _this.set('FBloading', false);
                        });
                    });
                } else {
                    _this.set('FBUser', FBUser);
                    return _this.set('FBloading', false);
                }
            });
        } else {
            this.set('FBUser', false);
            return this.set('FBloading', false);
        }
    }
});



Ember.FBView = Ember.View.extend({
   classNames: ['btn', 'btn-facebook', 'btn-iconed', 'fb-login-button'],
   error: null,
   click: function(e){
       var _this = this;
       FB.getLoginStatus(function(response) {
            if (response.status === 'connected') {
                App.appLogin(response.authResponse);
            } else {
               FB.login(function(response){
                  if (response.status === 'connected') {
                    App.appLogin(response.authResponse);

                  }

                  if (response.authResponse == null && response.status == 'unknown'){
                      FBApp.set('connectError', gettext("There was an error connecting Facebook"));
                  }
               });
            }
       });
   }
});



{'fraction_non_alphanumeric': 0.13596537527710334, 'fraction_numerical': 0.0008445054365037475, 'mean_word_length': 1.6027472527472528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4550544', 'n_tokens_mistral': 2596, 'n_tokens_neox': 2394, 'n_words': 440}