<commit_before>// Copyright © 2013 <NAME> AS http://medialaben.no

(function($) {
	'use strict';
	//!Public methods
	var pub = {
		//Init the editor. Takes options.
		init: function(options) {
			return this.each(function(){
				var $this = $(this);
				//If the plugin hasn't been initialized yet save all our settings 
				if(!$this.data('autoexpand')){
					$this.data('autoexpand', $.extend({}, $.fn.autoexpand.defaults, options) );
					//Read options from the data-attr
					if( $this.attr('data-autoexpand-options') !== undefined ){
						options = $this.attr('data-autoexpand-options').split(';');
						$.each(options, function( index, value ){
							var p = value.split(':');
							if (/true/i.test(p[1])) p[1] = true;
							if (/false/i.test(p[1])) p[1] = false;
							if(! isNaN (p[1]-0) && p[1] !== null && p[1] !== "" && p[1] !== false && p[1] !== true){
								p[1] = parseInt(p[1], 10);
							}
							if (p.length === 2 && p[0].length > 0){
								p[0] = $.trim(p[0]);
								p[1] = $.trim(p[1]);
								$this.data('autoexpand')[p[0]] = p[1];
							}
						});
						
						$this.data('autoexpand');
					}
				}
				//Store the original height so this can be applied again if we destroy the plugin
				$this.data('autoexpand').originalHeight = $this.outerHeight();

				if($this.data('autoexpand').resizeOnInit) pub.resize.apply($this);
				
				$this.on('keyup focus', function(){
					pub.resize.apply($this);
				});
				
				if( $this.data('autoexpand').actAsInput ){
					$this.on('keypress', function(e){
						if((e.keyCode || e.which) == 13) {
							$this.parents('form').submit();
							return false;
						}
					});
				}
			});
		},
		
		resize: function(){
			return this.each(function(){
				var $this = $(this);
				var data = $this.data('autoexpand');
				//The height is set to zero so that we can also handle shrinking of the field.
				$this.css({ height: 0 });
				//Set the height to the scrollHeight + the width of the top and bottom border
				var height = $this[0].scrollHeight + (parseFloat($this.css('border-top-width')) + parseFloat($this.css('border-bottom-width')));
				//Check if we are within our boundaries
				if( data.min !== 0 && height < data.min ){
					height = data.min;
				}
				if( data.max !== 0 && height > data.max ){
					height = data.max;<commit_msg>Prevents the continuous sumit of the parent form when acting as input.<commit_after>// Copyright © 2013 DB Medialab AS http://medialaben.no

(function($) {
	'use strict';
	//!Public methods
	var pub = {
		//Init the editor. Takes options.
		init: function(options) {
			return this.each(function(){
				var $this = $(this);
				//If the plugin hasn't been initialized yet save all our settings 
				if(!$this.data('autoexpand')){
					$this.data('autoexpand', $.extend({}, $.fn.autoexpand.defaults, options) );
					//Read options from the data-attr
					if( $this.attr('data-autoexpand-options') !== undefined ){
						options = $this.attr('data-autoexpand-options').split(';');
						$.each(options, function( index, value ){
							var p = value.split(':');
							if (/true/i.test(p[1])) p[1] = true;
							if (/false/i.test(p[1])) p[1] = false;
							if(! isNaN (p[1]-0) && p[1] !== null && p[1] !== "" && p[1] !== false && p[1] !== true){
								p[1] = parseInt(p[1], 10);
							}
							if (p.length === 2 && p[0].length > 0){
								p[0] = $.trim(p[0]);
								p[1] = $.trim(p[1]);
								$this.data('autoexpand')[p[0]] = p[1];
							}
						});
						
						$this.data('autoexpand');
					}
				}
				//Store the original height so this can be applied again if we destroy the plugin
				$this.data('autoexpand').originalHeight = $this.outerHeight();

				if($this.data('autoexpand').resizeOnInit) pub.resize.apply($this);
				
				$this.on('keyup focus', function(){
					pub.resize.apply($this);
				});
				
				if( $this.data('autoexpand').actAsInput ){
					$this.on('keypress', function(e){
						if((e.keyCode || e.which) == 13) {
							return false;
						}
					});
					
					$this.on('keyup', function(e){
						if((e.keyCode || e.which) == 13) {
							$this.parents('form').submit();
						}
					});
				}
			});
		},
		
		resize: function(){
			return this.each(function(){
				var $this = $(this);
				var data = $this.data('autoexpand');
				//The height is set to zero so that we can also handle shrinking of the field.
				$this.css({ height: 0 });
				//Set the height to the scrollHeight + the width of the top and bottom border
				var height = $this[0].scrollHeight + (parseFloat($this.css('border-top-width')) + parseFloat($this.css('border-bottom-width')));
				//Check if we are within our boundaries
				if( data.min !== 0 && height < data.min ){
					height = data.min;
				}
				if( data.max !== 0 && height > data.max ){
					height = data.max;
{'fraction_non_alphanumeric': 0.19481327800829876, 'fraction_numerical': 0.014107883817427386, 'mean_word_length': 2.579064587973274, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '4078839', 'n_tokens_mistral': 2112, 'n_tokens_neox': 1573, 'n_words': 404}