<commit_before>/*
|--------------------------------------------------------------------------
| Global App View
|--------------------------------------------------------------------------
*/
App.Views.App = Backbone.View.extend({

	el: 'body',

	// Initialize the main view (attached to the <body> tag)
	initialize: function() {
		// Initialize the loading indicator (used to indicate when something is loading on the page)
		this.mainLoadingIndicator = new App.Views.MainLoadingIndicator();

		// Initialize the contact view
		this.contactViewStyle = new App.Views.ContactViewStyle();

		// Initialize the navbar view
		this.navBar = new App.Views.NavBar();
	},
});

/*
|--------------------------------------------------------------------------
| Main Loading Indicator
|--------------------------------------------------------------------------
|
| Shows the user that something is loading in the background
|
*/
App.Views.MainLoadingIndicator = Backbone.View.extend({
	// Attach this view to the element with id="main-loading-indicator"
	el: '#main-loading-indicator',

	initialize: function() {
		// Here, we're going to initialize some listeners so that anywhere
		// in the application, we can fire a show/hide event that will cause
		// this view to show/hide the loading indicator

		// Listen for the "show:main-loading-indicator" event
		vent.on('show:main-loading-indicator', this.showLoading, this);

		// Listen for the "hide:main-loading-indicator" event
		vent.on('hide:main-loading-indicator', this.hideLoading, this);
	},

	showLoading: function() {

		// this.$el refers to the jQuery wrapped element. In this case:
		// $("#main-loading-indicator"). Here we're going to show it
		this.$el.show();
	},

	hideLoading: function() {
		this.$el.hide();
	}
});

/*
|--------------------------------------------------------------------------
| Navigation Bar View
|--------------------------------------------------------------------------
*/
App.Views.NavBar = Backbone.View.extend({
	el: '#navigation-bar',

	initialize: function() {
		// Listen for the contact:edit event so we can load the editContact view.
		// This way, anywhere in the application can load the editing pane.
		vent.on('contact:edit', this.editContact, this);

		// Listen for the contact:syncFB event so that we can sync with facebook
		// from anywhere in the application
		vent.on('contact:syncFB', this.addFBInfo, this);

		// Setup some listeners for closing the modals
		vent.on('close:addModal', function() {this.addModal.close();}, this);
		vent.on('close:editModal', function() {this.editModal.close();}, this);

		// Initialize the addContactView so that we can refer to it later when
		// a user would like to add a contact
		this.addContactView = new App.Views.AddContact({ collection: App.contacts });

		// Respond to an event fired from the facebook-user package, letting us know
		// that the user has logged in with Facebook. Here we'll change the
		// "Login with Facebook" button to "Sync with Facebook"
		App.facebookUser.on('facebook:connected', function(response) {
			this.$('#login-with-facebook-container').remove();
			this.$('#sync-with-facebook-container').show();
		});
	},

	events: {
		'click #add-contact-form-button': 'openContactForm',

		'click #login-with-facebook': function(event) {

			// When the user clicks the login with facebook button, establish a
			// facebook-user listener that will insert their profile pic anywhere
			// with a .fb-self-pic class
			App.facebookUser.login(function(response) {
				$('.fb-self-pic').attr('src', 'https://graph.facebook.com/' + response.authResponse.userID + '/picture');
			});
		},<commit_msg>Fixed an issue created when commenting<commit_after>/*
|--------------------------------------------------------------------------
| Global App View
|--------------------------------------------------------------------------
*/
App.Views.App = Backbone.View.extend({

	el: 'body',

	// Initialize the main view (attached to the <body> tag)
	initialize: function() {
		// Initialize the loading indicator (used to indicate when something is loading on the page)
		this.mainLoadingIndicator = new App.Views.MainLoadingIndicator();

		// Initialize the contact view
		this.contactViewStyle = new App.Views.ContactViewStyle();

		// Initialize the navbar view
		this.navBar = new App.Views.NavBar();
	},
});

/*
|--------------------------------------------------------------------------
| Main Loading Indicator
|--------------------------------------------------------------------------
|
| Shows the user that something is loading in the background
|
*/
App.Views.MainLoadingIndicator = Backbone.View.extend({
	// Attach this view to the element with id="main-loading-indicator"
	el: '#main-loading-indicator',

	initialize: function() {
		// Here, we're going to initialize some listeners so that anywhere
		// in the application, we can fire a show/hide event that will cause
		// this view to show/hide the loading indicator

		// Listen for the "show:main-loading-indicator" event
		vent.on('show:main-loading-indicator', this.showLoading, this);

		// Listen for the "hide:main-loading-indicator" event
		vent.on('hide:main-loading-indicator', this.hideLoading, this);
	},

	showLoading: function() {

		// this.$el refers to the jQuery wrapped element. In this case:
		// $("#main-loading-indicator"). Here we're going to show it
		this.$el.show();
	},

	hideLoading: function() {
		this.$el.hide();
	}
});

/*
|--------------------------------------------------------------------------
| Navigation Bar View
|--------------------------------------------------------------------------
*/
App.Views.NavBar = Backbone.View.extend({
	el: '#navigation-bar',

	initialize: function() {
		// Listen for the contact:edit event so we can load the editContact view.
		// This way, anywhere in the application can load the editing pane.
		vent.on('contact:edit', this.editContact, this);

		// Listen for the contact:syncFB event so that we can sync with facebook
		// from anywhere in the application
		vent.on('contact:syncFB', this.addFBInfo, this);

		// Setup some listeners for closing the modals
		vent.on('close:addModal', function() {this.addModal.close();}, this);
		vent.on('close:editModal', function() {this.editModal.close();}, this);

		// Initialize the addContactView so that we can refer to it later when
		// a user would like to add a contact
		this.addContactView = new App.Views.AddContact({ collection: App.contacts });

		// Cache the jQuery DOM elements before using in the Facebook callback
		loginWithFacebookContainer = this.$('#login-with-facebook-container');
		syncWithFacebookContainer = this.$('#sync-with-facebook-container');

		// Respond to an event fired from the facebook-user package, letting us know
		// that the user has logged in with Facebook. Here we'll change the
		// "Login with Facebook" button to "Sync with Facebook"
		App.facebookUser.on('facebook:connected', function(response) {
			loginWithFacebookContainer.remove();
			syncWithFacebookContainer.show();
		});
	},

	events: {
		'click #add-contact-form-button': 'openContactForm',

		'click #login-with-facebook': function(event) {

			// When the user clicks the login with facebook button, establish a
			// facebook-user listener that will insert their profile pic anywhere
			// with a .fb-self-pic class
			App.facebookUser.login(function(response) {
				$('.fb-self-pic').attr('src', 'https://graph.facebook.com/' + response.authResponse.userID + '/picture');
			});
		},
{'fraction_non_alphanumeric': 0.2338592072119846, 'fraction_numerical': 0.0, 'mean_word_length': 2.3218846323205637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2697714', 'n_tokens_mistral': 2097, 'n_tokens_neox': 1909, 'n_words': 644}