<commit_before>var CustomSchedule = (function($, window, document, undefined) {

    // Default configurations, can be overwritten when the object is created
    var defaultConfig = {};

    // Constructor
    function CustomSchedule(obj, config, app) {
        // Get reference to main Project object
        this.app = app;

        // Overwrite the default configuration
        this.config = $.extend({}, defaultConfig, config);

        // Set the "CustomSchedule" or the main container
        this.CustomSchedule = $(obj);

        // Is the user connected to facebook (null : not connected, true = connected, false = not authorized)
        this.facebookConnected = null;

        // Initialize default functions
        this.init();
    }

    CustomSchedule.prototype = {

        // Initialize default functions
        init: function() {
            var self = this;

            var fb_conf = {
                appId      : 'XXXXXXXXXXXXXXXX',                   // App ID from the app dashboard
                status     : true,                                 // Check Facebook Login status
                xfbml      : true,                                  // Look for social plugins on the page
                cookie : true
            }

            if(window.location.hostname == 'waq2014.dev.libeo.com'){
                fb_conf = {
                    appId      : '1421838541381572',                   // App ID from the app dashboard
                    status     : true,                                 // Check Facebook Login status
                    xfbml      : true,                                  // Look for social plugins on the page
                    cookie : true
                }
            }
            else if(window.location.hostname == 'waq2014.job.paulcote.net'){
                fb_conf = {
                    appId      : '1382147128676757',                   // App ID from the app dashboard
                    status     : true,                                 // Check Facebook Login status
                    xfbml      : true,                                  // Look for social plugins on the page
                    cookie : true
                }
            }



            if(typeof FB != undefined && fb_conf.appId != 'XXXXXXXXXXXXXXXX'){
                FB.init(fb_conf);

                FB.getLoginStatus(function(response) {
                    if (response.status === 'connected') {
                        self.facebookConnected = true;
                        $('.facebook-connect').css('display','none');
                        $('.facebook-logout').css('display','block');
                        self.fbInitPhp(function(){self.getUserSessions();});
                    }
                    else{
                        $('.facebook-connect').css('display','block');
                        $('.facebook-logout').css('display','none');
                        self.getUserSessions();
                        self.loadSessions();
                    }
                });
            }
            else{
              window.fbasyncinit = function(){
                FB.init(fb_conf);

                FB.getLoginStatus(function(response) {
                    if (response.status === 'connected') {
                        self.facebookConnected = true;
                        $('.facebook-connect').css('display','none');
                        $('.facebook-logout').css('display','block');
                        self.fbInitPhp(function(){self.getUserSessions();});
                    }
                    else{
                        $('.facebook-connect').css('display','block');
                        $('.facebook-logout').css('display','none');
                        self.getUserSessions();
                        self.loadSessions();
                    }
                });
              }
            }

            self.bindEvents();
        },

        bindEvents: function(){
            var self = this;

            $(document.body).on('click', '.session-bookmark.add', function(){

                if(self.facebookConnected == null){
                    self.facebookConnect('self.getUserSessions(\'self.addSession('+$(this).parents('td').attr("data-session-id")+')\')');
                }
                else{
                    self.addSession($(this).parents('td').attr("data-session-id"));
                }
            });

            $(document.body).on('click', '.session-bookmark.remove', function(){

                if(self.facebookConnected == null){
                    self.facebookConnect('self.getUserSessions(\'self.removeSession('+$(this).parents('td').attr("data-session-id")+')\')');
                }
                else{
                    self.removeSession($(this).parents('td').attr("data-session-id"));
                }
            });

            $(document.body).on('click', '.facebook-connect', function(){
                self.facebookConnect(function(){self.getUserSessions(function(){self.saveUserSessions();});});
            });

            $(document.body).on('click', '.facebook-logout', function(){
                self.facebookConnected = null;
                FB.logout(function(response) {
                    $('.facebook-connect').css('display','block');
                    $('.facebook-logout').css('display','none');
                });
            });

        },

        facebookConnect: function(callback){
            var self = this;

            FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {
                    self.facebookConnected = true;
                    $('.facebook-connect').css('display','none');
                    $('.facebook-logout').css('display','block');
                    self.fbInitPhp(callback);
                }
                //else if (response.status === 'not_authorized') {
                //
                //}
                else {
                    FB.login(function(response) {
                        if (response.authResponse) {
                            self.facebookConnected = true;
                            $('.facebook-connect').css('display','none');
                            $('.facebook-logout').css('display','block');
                            self.fbInitPhp(callback);
                        }
                        else {
                            self.facebookConnected = false;
                            if(typeof callback === 'function')
                                callback();
                            else if(typeof callback === 'string'){
                                var func = new Function(callback);
                                func();
                            }
                        }
                    });<commit_msg>Change facebook button<commit_after>var CustomSchedule = (function($, window, document, undefined) {

    // Default configurations, can be overwritten when the object is created
    var defaultConfig = {};

    // Constructor
    function CustomSchedule(obj, config, app) {
        // Get reference to main Project object
        this.app = app;

        // Overwrite the default configuration
        this.config = $.extend({}, defaultConfig, config);

        // Set the "CustomSchedule" or the main container
        this.CustomSchedule = $(obj);

        // Is the user connected to facebook (null : not connected, true = connected, false = not authorized)
        this.facebookConnected = null;

        // Initialize default functions
        this.init();
    }

    CustomSchedule.prototype = {

        // Initialize default functions
        init: function() {
            var self = this;

            var fb_conf = {
                appId      : 'XXXXXXXX<KEY>',                   // App ID from the app dashboard
                status     : true,                                 // Check Facebook Login status
                xfbml      : true,                                  // Look for social plugins on the page
                cookie : true
            }

            if(window.location.hostname == 'waq2014.dev.libeo.com'){
                fb_conf = {
                    appId      : '1421838541381572',                   // App ID from the app dashboard
                    status     : true,                                 // Check Facebook Login status
                    xfbml      : true,                                  // Look for social plugins on the page
                    cookie : true
                }
            }
            else if(window.location.hostname == 'waq2014.job.paulcote.net'){
                fb_conf = {
                    appId      : '1382147128676757',                   // App ID from the app dashboard
                    status     : true,                                 // Check Facebook Login status
                    xfbml      : true,                                  // Look for social plugins on the page
                    cookie : true
                }
            }



            if(typeof FB != undefined && fb_conf.appId != 'XXXXXXXXXXXXXXXX'){
                FB.init(fb_conf);

                FB.getLoginStatus(function(response) {
                    if (response.status === 'connected') {
                        self.facebookConnected = true;
                        $('.facebook-login').css('display','none');
                        $('.facebook-logout').css('display','block');
                        self.fbInitPhp(function(){self.getUserSessions();});
                    }
                    else{
                        $('.facebook-login').css('display','block');
                        $('.facebook-logout').css('display','none');
                        self.getUserSessions();
                        self.loadSessions();
                    }
                });
            }
            else{
              window.fbasyncinit = function(){
                FB.init(fb_conf);

                FB.getLoginStatus(function(response) {
                    if (response.status === 'connected') {
                        self.facebookConnected = true;
                        $('.facebook-login').css('display','none');
                        $('.facebook-logout').css('display','block');
                        self.fbInitPhp(function(){self.getUserSessions();});
                    }
                    else{
                        $('.facebook-login').css('display','block');
                        $('.facebook-logout').css('display','none');
                        self.getUserSessions();
                        self.loadSessions();
                    }
                });
              }
            }

            self.bindEvents();
        },

        bindEvents: function(){
            var self = this;

            $(document.body).on('click', '.session-bookmark.add', function(){

                if(self.facebookConnected == null){
                    self.facebookConnect('self.getUserSessions(\'self.addSession('+$(this).parents('td').attr("data-session-id")+')\')');
                }
                else{
                    self.addSession($(this).parents('td').attr("data-session-id"));
                }
            });

            $(document.body).on('click', '.session-bookmark.remove', function(){

                if(self.facebookConnected == null){
                    self.facebookConnect('self.getUserSessions(\'self.removeSession('+$(this).parents('td').attr("data-session-id")+')\')');
                }
                else{
                    self.removeSession($(this).parents('td').attr("data-session-id"));
                }
            });

            $(document.body).on('click', '.facebook-login', function(){
                self.facebookConnect(function(){self.getUserSessions(function(){self.saveUserSessions();});});
            });

            $(document.body).on('click', '.facebook-logout', function(){
                self.facebookConnected = null;
                FB.logout(function(response) {
                    $('.facebook-login').css('display','block');
                    $('.facebook-logout').css('display','none');
                });
            });

        },

        facebookConnect: function(callback){
            var self = this;

            FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {
                    self.facebookConnected = true;
                    $('.facebook-login').css('display','none');
                    $('.facebook-logout').css('display','block');
                    self.fbInitPhp(callback);
                }
                //else if (response.status === 'not_authorized') {
                //
                //}
                else {
                    FB.login(function(response) {
                        if (response.authResponse) {
                            self.facebookConnected = true;
                            $('.facebook-login').css('display','none');
                            $('.facebook-logout').css('display','block');
                            self.fbInitPhp(callback);
                        }
                        else {
                            self.facebookConnected = false;
                            if(typeof callback === 'function')
                                callback();
                            else if(typeof callback === 'string'){
                                var func = new Function(callback);
                                func();
                            }
                        }
                    });
{'fraction_non_alphanumeric': 0.12487190748060313, 'fraction_numerical': 0.005855658029571073, 'mean_word_length': 1.1205959956541984, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5993399', 'n_tokens_mistral': 3234, 'n_tokens_neox': 2919, 'n_words': 554}