<commit_before>/**
 * @classDescription	Custom selectbox with the option to use jScrollPane
 *						for a custom scrollbar. Hides the original selectbox off 
 *						screen so that it will still get picked up as a form element.
 *
 * @version				1.0.0
 *
 * @author				<NAME> - <EMAIL>
 * @date				04/05/2010
 * @lastUpdate			01/20/2013 
 * @dependency			jScrollPane.js			optional
 * 						jquery.mousewheel.js	optional
 * 
 * @param {DOMElement}	options.selectbox			the selectbox that is being customized, REQUIRED (default undefined)
 * @param {Boolean}		options.customScrollbar		whether or not to use jScrollPane to restyle system scrollbar (default false)
 * @param {Number}		options.zIndex				The default z-index of the selectbox. (default 100)
 * @param {Function}	options.changeCallback		Function that gets executed on change of the selectbox (default empty function)
 * @param {Function}	options.manager				Optional reference to a class that manages all instances of the selectbox
 * @param {Object}		options.scrollOptions		jScrollPane options, refer to jscrollpane documentation for possible options
 * 													http://www.kelvinluck.com/assets/jquery/jScrollPane/scripts/jScrollPane.js
 */
(function($){
	var undefined;

	window.SelectBoxManager = function(options){
		var sbs = [], 
			self = this;
			
		$(document).click(function(e) {
			if($(e.target).parents(".customSelect").get(0) == null) {
				self.close();
			}
		});
		
		this.add = function(sb) {
			sbs.push(sb);	
		};
		
		this.close = function() {
			$(sbs).each(function() {
				this.close();					 
			});
		};
	};
	
	var sb_manager = new SelectBoxManager(); 
	
	window.SelectBox = function(options){
		var self = this,
		cfg = $.extend(true, {
			manager: sb_manager,
			customScrollbar: false,
			zIndex: 100,
			changeCallback: function(val) { },
			truncate: function(str) {return str;},
			scrollOptions: {}
		}, options);
		
		var $customSelect, $selectedValue, $selectValueWrap, $selectList, $dl, $options,
			_isOpen = false, 
			_isEnabled = true,
			_isFocused = false,
			_selectedValue = "";
		
		function init() {
			var selectId = "";
			if(cfg.selectbox.attr("id") != "") {
				selectId = 'id="select-'+cfg.selectbox.attr("id")+'"';
			}
			cfg.selectbox.wrap('<div class="customSelect" '+selectId+' />');
			
			$customSelect = cfg.selectbox.parents(".customSelect");
			$options = cfg.selectbox.find("option");
			
			var selectListHTML = ['<div class="selectList"><div class="selectListOuterWrap"><div class="selectListInnerWrap"><div class="selectListTop"></div><dl>'];
			selectListHTML.push(_renderOptions());
			selectListHTML.push('</dl><div class="selectListBottom"></div></div></div></div>');<commit_msg>if there isn't an id defined, don't add id="selectbox-undefined" like it was before<commit_after>/**
 * @classDescription	Custom selectbox with the option to use jScrollPane
 *						for a custom scrollbar. Hides the original selectbox off 
 *						screen so that it will still get picked up as a form element.
 *
 * @version				1.0.0
 *
 * @author				<NAME> - <EMAIL>
 * @date				04/05/2010
 * @lastUpdate			01/20/2013 
 * @dependency			jScrollPane.js			optional
 * 						jquery.mousewheel.js	optional
 * 
 * @param {DOMElement}	options.selectbox			the selectbox that is being customized, REQUIRED (default undefined)
 * @param {Boolean}		options.customScrollbar		whether or not to use jScrollPane to restyle system scrollbar (default false)
 * @param {Number}		options.zIndex				The default z-index of the selectbox. (default 100)
 * @param {Function}	options.changeCallback		Function that gets executed on change of the selectbox (default empty function)
 * @param {Function}	options.manager				Optional reference to a class that manages all instances of the selectbox
 * @param {Object}		options.scrollOptions		jScrollPane options, refer to jscrollpane documentation for possible options
 * 													http://www.kelvinluck.com/assets/jquery/jScrollPane/scripts/jScrollPane.js
 */
(function($){
	var undefined;

	window.SelectBoxManager = function(options){
		var sbs = [], 
			self = this;
			
		$(document).click(function(e) {
			if($(e.target).parents(".customSelect").get(0) == null) {
				self.close();
			}
		});
		
		this.add = function(sb) {
			sbs.push(sb);	
		};
		
		this.close = function() {
			$(sbs).each(function() {
				this.close();					 
			});
		};
	};
	
	var sb_manager = new SelectBoxManager(); 
	
	window.SelectBox = function(options){
		var self = this,
		cfg = $.extend(true, {
			manager: sb_manager,
			customScrollbar: false,
			zIndex: 100,
			changeCallback: function(val) { },
			truncate: function(str) {return str;},
			scrollOptions: {}
		}, options);
		
		var $customSelect, $selectedValue, $selectValueWrap, $selectList, $dl, $options,
			_isOpen = false, 
			_isEnabled = true,
			_isFocused = false,
			_selectedValue = "";
		
		function init() {
			var selectId = "";
			if(typeof cfg.selectbox.attr("id") !== "undefined") {
				selectId = 'id="select-'+cfg.selectbox.attr("id")+'"';
			}
			cfg.selectbox.wrap('<div class="customSelect" '+selectId+' />');
			
			$customSelect = cfg.selectbox.parents(".customSelect");
			$options = cfg.selectbox.find("option");
			
			var selectListHTML = ['<div class="selectList"><div class="selectListOuterWrap"><div class="selectListInnerWrap"><div class="selectListTop"></div><dl>'];
			selectListHTML.push(_renderOptions());
			selectListHTML.push('</dl><div class="selectListBottom"></div></div></div></div>');
{'fraction_non_alphanumeric': 0.1413260672116258, 'fraction_numerical': 0.009445958219800182, 'mean_word_length': 3.7100085543199315, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7100461', 'n_tokens_mistral': 2049, 'n_tokens_neox': 1720, 'n_words': 433}