<commit_before>/*
 * jQuery MiniColors: A tiny color picker built on jQuery
 *
 * Copyright <NAME> for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
 *
 * Dual-licensed under the MIT and GPL Version 2 licenses
 *
*/
if(jQuery) (function($) {
	
	// The minicolors object (public methods and settings)
	$.minicolors = {
		
		// Default settings
		settings: {
			defaultSlider: 'hue',
			letterCase: 'lowercase',
			hideSpeed: 100,
			showSpeed: 100,
			animationSpeed: 100,
			animationEasing: 'swing'
		},
		
		// Initialized all controls of type=minicolors
		init: function() {
			$('INPUT[type=minicolors]').each( function() {
				init( $(this) );
			});
		},
		
		// Remove the specified control from the DOM
		remove: function(input) {
			$(input).each( function() {
				remove($(this));
			});
		},
		
		// Refresh the controls
		refresh: function() {
			$('INPUT[type=minicolors]').each( function() {
				refresh($(this));
			});
		},
		
		// Shows the specified control
		show: function(input) {
			show( $(input).eq(0) );
		},
		
		// Hides all controls
		hide: function() {
			hide();
		},
		
		// Utility to convert a hex string to RGB(A) object
		rgbObject: function(input) {
			var hex = parseHex($(input).val(), true),
				rgb = hex2rgb(hex),
				opacity = input.attr('data-opacity');
			if( !rgb ) return null;
			if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
			return rgb;
		},
		
		// Utility to convert a hex string to an RGB(A) string
		rgbString: function(input) {
			var hex = parseHex($(input).val(), true),
				rgb = hex2rgb(hex),
				opacity = input.attr('data-opacity');
			if( !rgb ) return null;
			if( opacity === undefined ) {
				return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
			} else {
				return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
			}
		}
		
	};
	
	// Initialize all input[type=minicolors] elements
	function init(input) {
		
		var minicolors = $('<span class="minicolors" />'),
			sliderType = input.attr('data-slider') || $.minicolors.settings.defaultSlider;
		
		if( input.data('initialized') ) return;
		
		// The wrapper
		minicolors
			.attr('class', input.attr('data-class'))
			.attr('style', input.attr('data-style'))
			.toggleClass('minicolors-swatch-left', input.attr('data-swatch-position') === 'left' )
			.toggleClass('minicolors-with-opacity', input.attr('data-opacity') !== undefined );
		
		// Custom positioning
		if( input.attr('data-position') !== undefined ) {
			$.each(input.attr('data-position').split(' '), function() {
				minicolors.addClass('minicolors-position-' + this);
			});
		}
		
		// The input
		input
			.data('initialized', true)
			.attr('data-default', input.attr('data-default') || '')
			.attr('data-slider', sliderType)
			.prop('size', 7)
			.prop('maxlength', 7)
			.wrap(minicolors)
			.after(
				'<span class="minicolors-panel minicolors-slider-' + sliderType + '">' + 
					'<span class="minicolors-slider">' + 
						'<span class="minicolors-picker"></span>' +
					'</span>' + 
					'<span class="minicolors-opacity-slider">' + 
						'<span class="minicolors-picker"></span>' +
					'</span>' +
					'<span class="minicolors-grid">' +
						'<span class="minicolors-grid-inner"></span>' +
						'<span class="minicolors-picker"><span></span></span>' +
					'</span>' +
				'</span>'
			);
		
		// Prevent text selection in IE
		input.parent().find('.minicolors-panel').on('selectstart', function() { return false; }).end();
		
		// Detect swatch position
		if( input.attr('data-swatch-position') === 'left' ) {
			// Left
			input.before('<span class="minicolors-swatch"><span></span></span>');
		} else {
			// Right
			input.after('<span class="minicolors-swatch"><span></span></span>');
		}
		
		// Disable textfield
		if( input.attr('data-textfield') === 'false' ) input.addClass('minicolors-hidden');
		
		// Inline controls
		if( input.attr('data-control') === 'inline' ) input.parent().addClass('minicolors-inline');
		
		updateFromInput(input);
		
	}
	
	// Refresh the specified control
	function refresh(input) {
		updateFromInput(input);
	}
	
	// Removes the specified control
	function remove(input) {
		var minicolors = input.parent();
		if( input.data('initialized') && minicolors.hasClass('minicolors') ) {
			minicolors.remove();
		}
	}
	
	// Shows the specified dropdown panel
	function show(input) {
		
		var minicolors = input.parent(),
			panel = minicolors.find('.minicolors-panel');
		
		// Do nothing if uninitialized, disabled, or already open
		if( !input.data('initialized') || input.prop('disabled') || minicolors.hasClass('minicolors-focus') ) return;
		
		hide();
		
		minicolors.addClass('minicolors-focus');
		panel
			.stop(true, true)
			.fadeIn($.minicolors.settings.showSpeed, function() {
				input.trigger('show');
			});
		
	}
	
	// Hides all dropdown panels
	function hide() {
		
		$('.minicolors:not(.minicolors-inline)').each( function() {
			
			var minicolors = $(this),
				input = minicolors.find('INPUT');
			
			minicolors.find('.minicolors-panel').fadeOut($.minicolors.settings.hideSpeed, function(e) {
				if(minicolors.hasClass('minicolors-focus')) {
					input.trigger('hide');
				}
				minicolors.removeClass('minicolors-focus');
			});			
						
		});<commit_msg>pass the input element back on trigger; for sake of consistency re: the change event elsewhere<commit_after>/*
 * jQuery MiniColors: A tiny color picker built on jQuery
 *
 * Copyright <NAME> for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
 *
 * Dual-licensed under the MIT and GPL Version 2 licenses
 *
*/
if(jQuery) (function($) {
	
	// The minicolors object (public methods and settings)
	$.minicolors = {
		
		// Default settings
		settings: {
			defaultSlider: 'hue',
			letterCase: 'lowercase',
			hideSpeed: 100,
			showSpeed: 100,
			animationSpeed: 100,
			animationEasing: 'swing'
		},
		
		// Initialized all controls of type=minicolors
		init: function() {
			$('INPUT[type=minicolors]').each( function() {
				init( $(this) );
			});
		},
		
		// Remove the specified control from the DOM
		remove: function(input) {
			$(input).each( function() {
				remove($(this));
			});
		},
		
		// Refresh the controls
		refresh: function() {
			$('INPUT[type=minicolors]').each( function() {
				refresh($(this));
			});
		},
		
		// Shows the specified control
		show: function(input) {
			show( $(input).eq(0) );
		},
		
		// Hides all controls
		hide: function() {
			hide();
		},
		
		// Utility to convert a hex string to RGB(A) object
		rgbObject: function(input) {
			var hex = parseHex($(input).val(), true),
				rgb = hex2rgb(hex),
				opacity = input.attr('data-opacity');
			if( !rgb ) return null;
			if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
			return rgb;
		},
		
		// Utility to convert a hex string to an RGB(A) string
		rgbString: function(input) {
			var hex = parseHex($(input).val(), true),
				rgb = hex2rgb(hex),
				opacity = input.attr('data-opacity');
			if( !rgb ) return null;
			if( opacity === undefined ) {
				return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
			} else {
				return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
			}
		}
		
	};
	
	// Initialize all input[type=minicolors] elements
	function init(input) {
		
		var minicolors = $('<span class="minicolors" />'),
			sliderType = input.attr('data-slider') || $.minicolors.settings.defaultSlider;
		
		if( input.data('initialized') ) return;
		
		// The wrapper
		minicolors
			.attr('class', input.attr('data-class'))
			.attr('style', input.attr('data-style'))
			.toggleClass('minicolors-swatch-left', input.attr('data-swatch-position') === 'left' )
			.toggleClass('minicolors-with-opacity', input.attr('data-opacity') !== undefined );
		
		// Custom positioning
		if( input.attr('data-position') !== undefined ) {
			$.each(input.attr('data-position').split(' '), function() {
				minicolors.addClass('minicolors-position-' + this);
			});
		}
		
		// The input
		input
			.data('initialized', true)
			.attr('data-default', input.attr('data-default') || '')
			.attr('data-slider', sliderType)
			.prop('size', 7)
			.prop('maxlength', 7)
			.wrap(minicolors)
			.after(
				'<span class="minicolors-panel minicolors-slider-' + sliderType + '">' + 
					'<span class="minicolors-slider">' + 
						'<span class="minicolors-picker"></span>' +
					'</span>' + 
					'<span class="minicolors-opacity-slider">' + 
						'<span class="minicolors-picker"></span>' +
					'</span>' +
					'<span class="minicolors-grid">' +
						'<span class="minicolors-grid-inner"></span>' +
						'<span class="minicolors-picker"><span></span></span>' +
					'</span>' +
				'</span>'
			);
		
		// Prevent text selection in IE
		input.parent().find('.minicolors-panel').on('selectstart', function() { return false; }).end();
		
		// Detect swatch position
		if( input.attr('data-swatch-position') === 'left' ) {
			// Left
			input.before('<span class="minicolors-swatch"><span></span></span>');
		} else {
			// Right
			input.after('<span class="minicolors-swatch"><span></span></span>');
		}
		
		// Disable textfield
		if( input.attr('data-textfield') === 'false' ) input.addClass('minicolors-hidden');
		
		// Inline controls
		if( input.attr('data-control') === 'inline' ) input.parent().addClass('minicolors-inline');
		
		updateFromInput(input);
		
	}
	
	// Refresh the specified control
	function refresh(input) {
		updateFromInput(input);
	}
	
	// Removes the specified control
	function remove(input) {
		var minicolors = input.parent();
		if( input.data('initialized') && minicolors.hasClass('minicolors') ) {
			minicolors.remove();
		}
	}
	
	// Shows the specified dropdown panel
	function show(input) {
		
		var minicolors = input.parent(),
			panel = minicolors.find('.minicolors-panel');
		
		// Do nothing if uninitialized, disabled, or already open
		if( !input.data('initialized') || input.prop('disabled') || minicolors.hasClass('minicolors-focus') ) return;
		
		hide();
		
		minicolors.addClass('minicolors-focus');
		panel
			.stop(true, true)
			.fadeIn($.minicolors.settings.showSpeed, function() {
				input.trigger('show', input);
			});
		
	}
	
	// Hides all dropdown panels
	function hide() {
		
		$('.minicolors:not(.minicolors-inline)').each( function() {
			
			var minicolors = $(this),
				input = minicolors.find('INPUT');
			
			minicolors.find('.minicolors-panel').fadeOut($.minicolors.settings.hideSpeed, function(e) {
				if(minicolors.hasClass('minicolors-focus')) {
					input.trigger('hide', input);
				}
				minicolors.removeClass('minicolors-focus');
			});			
						
		});
{'fraction_non_alphanumeric': 0.18673402563382918, 'fraction_numerical': 0.0028066236317709796, 'mean_word_length': 3.238699444885012, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, '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': '7516875', 'n_tokens_mistral': 4230, 'n_tokens_neox': 3463, 'n_words': 715}