<commit_before>////////////////////////////////////////////////////////////////////////////////
// Editable Control
//
// Controls based on this class have typically two states: one for
// displaying (default) and one for editing its value. The latter becomes
// available when clicking on the display state.
////////////////////////////////////////////////////////////////////////////////
var controls = function (controls, $) {
	controls.editable = function () {
		var self = Object.create(controls.control);
		
		// mode can be either 'display' or 'edit'
		self.mode = 'display';
		
		// switches to mode / between modes
		self.toggle = function (mode) {
			this.mode = mode || {'display': 'edit', 'edit': 'display'}[this.mode];
			this.redraw();
			if (mode === 'edit') {
				this.UI.find('.focus').focus();
			}
		};
		
		// constructs display representation
		self.display = function (self, $elem) {
			return $elem
				// dropdown appears on mouse click
				.click(function () {
					// switching display w/ edit
					self.toggle('edit');

					// 'click outside' handler
					function handler(event) {
						console.log(self.UI.find('input,select').andSelf());
						if (event.target !== (self.UI.find('input,select')[0] || self.UI[0])) {
							// handling actual click outside event
							self.toggle('display');
						} else {
							// re-binding one time handler
							$('body').one('click', handler);
						}
						return false;
					}
					
					// emulating a 'click outside' event
					$('body').one('click', handler);

					return false;
				});
		};
		
		// constructs editable representation
		self.edit = function () {
			throw "Abstract";
		};
		
		// constructs jQuery representation of control
		self.getUI = function () {
			if (this.mode === 'edit') {
				return this.edit();
			} else {
				return this.display();
			}
		};
		
		return self;
	};
	
	return controls;
}(controls || {},
	jQuery);
<commit_msg>console.log() removed<commit_after>////////////////////////////////////////////////////////////////////////////////
// Editable Control
//
// Controls based on this class have typically two states: one for
// displaying (default) and one for editing its value. The latter becomes
// available when clicking on the display state.
////////////////////////////////////////////////////////////////////////////////
var controls = function (controls, $) {
	controls.editable = function () {
		var self = Object.create(controls.control);
		
		// mode can be either 'display' or 'edit'
		self.mode = 'display';
		
		// switches to mode / between modes
		self.toggle = function (mode) {
			this.mode = mode || {'display': 'edit', 'edit': 'display'}[this.mode];
			this.redraw();
			if (mode === 'edit') {
				this.UI.find('.focus').focus();
			}
		};
		
		// constructs display representation
		self.display = function (self, $elem) {
			return $elem
				// dropdown appears on mouse click
				.click(function () {
					// switching display w/ edit
					self.toggle('edit');

					// 'click outside' handler
					function handler(event) {
						if (event.target !== (self.UI.find('input,select')[0] || self.UI[0])) {
							// handling actual click outside event
							self.toggle('display');
						} else {
							// re-binding one time handler
							$('body').one('click', handler);
						}
						return false;
					}
					
					// emulating a 'click outside' event
					$('body').one('click', handler);

					return false;
				});
		};
		
		// constructs editable representation
		self.edit = function () {
			throw "Abstract";
		};
		
		// constructs jQuery representation of control
		self.getUI = function () {
			if (this.mode === 'edit') {
				return this.edit();
			} else {
				return this.display();
			}
		};
		
		return self;
	};
	
	return controls;
}(controls || {},
	jQuery);

{'fraction_non_alphanumeric': 0.22492799162084315, 'fraction_numerical': 0.0010473946059177796, 'mean_word_length': 1.9294478527607362, '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': '6171497', 'n_tokens_mistral': 1329, 'n_tokens_neox': 999, 'n_words': 302}