<commit_before>irc.Views.Connect = Backbone.View.extend({

	el: '#connect',
	template: templates.connect,

	events: {
		'submit form': 'submitForm',
		'click a[href="#advanced"]': 'clickAdvanced'
	},

	initialize: function(){

		_( this ).bindAll( 'render', 'connect', 'show', 'hide', 'submitForm' );

		this.render();

	},

	render: function(){

		var html = this.template({
			preset_server: irc.config.preset_server
		});
		var $connect = $.parseHTML( html );
		this.$el.html( $connect );

		this.$modal = this.$el.children('div.modal');
		this.$form = this.$modal.children('form');
		this.$channels = this.$form.find('input[name="channels"]');
		this.$advanced = this.$form.find('div.advanced');

		this.$modal.modal({
			backdrop: false,
			show: true
		});
		this.$channels.sparkartTags();
		this.$advanced.toggle();

		return this;

	},

	connect: function( parameters ){

		irc.socket.emit( 'new_irc_connection', parameters );

	},

	show: function(){

		this.$modal.modal('show');

	},

	hide: function(){

		this.$modal.modal('hide');

	},

	submitForm: function( e ){

		e.preventDefault();

		var parameters = this.$form.serializeObject();
		parameters.channels = parameters.channels.split(',');

		this.connect( parameters );
		this.hide();		

	},

	clickAdvanced: function( e ){

		e.preventDefault();

		this.$advanced.toggle( 100 );

	}

});<commit_msg>Focus on first input on connect dialog<commit_after>irc.Views.Connect = Backbone.View.extend({

	el: '#connect',
	template: templates.connect,

	events: {
		'submit form': 'submitForm',
		'click a[href="#advanced"]': 'clickAdvanced'
	},

	initialize: function(){

		_( this ).bindAll( 'render', 'connect', 'show', 'hide', 'submitForm' );

		this.render();
		this.show();

	},

	render: function(){

		var html = this.template({
			preset_server: irc.config.preset_server
		});
		var $connect = $.parseHTML( html );
		this.$el.html( $connect );

		this.$modal = this.$el.children('div.modal');
		this.$form = this.$modal.children('form');
		this.$channels = this.$form.find('input[name="channels"]');
		this.$advanced = this.$form.find('div.advanced');

		this.$modal.modal({ backdrop: false });
		this.$channels.sparkartTags();
		this.$advanced.toggle();

		return this;

	},

	connect: function( parameters ){

		irc.socket.emit( 'new_irc_connection', parameters );

	},

	show: function(){

		this.$modal.modal('show');
		this.$form.find('input').filter(':visible:first').focus();

	},

	hide: function(){

		this.$modal.modal('hide');

	},

	submitForm: function( e ){

		e.preventDefault();

		var parameters = this.$form.serializeObject();
		parameters.channels = parameters.channels.split(',');

		this.connect( parameters );
		this.hide();		

	},

	clickAdvanced: function( e ){

		e.preventDefault();

		this.$advanced.toggle( 100 );

	}

});

{'fraction_non_alphanumeric': 0.19787234042553192, 'fraction_numerical': 0.002127659574468085, 'mean_word_length': 4.010657193605684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '101634', 'n_tokens_mistral': 1048, 'n_tokens_neox': 899, 'n_words': 172}