<commit_before>/**
 * @package assets
 */

(function($) {

	/**
	 * This plugin makes items selectable. Clicking an item will select it 
	 * by adding the class <code>.selected</code>. Holding down the shift key 
	 * while clicking multiple items creates a selection range. Holding the meta key 
	 * (which is <code>cmd</code> on a Mac or <code>ctrl</code> on Windows) allows 
	 * the selection of multiple items or the modification of an already selected 
	 * range of items. Doubleclicking outside the selection list will 
	 * remove the selection.
	 *
	 * @param {Object} custom_settings
	 *  An object specifying the items that should be made selectable and 
	 *  their ordering handles. The latter is needed to properly handle item highlighting 
	 *  when used in connection with the orderable plugin
	 */
 	$.fn.symphonySelectable = function(custom_settings) {
		var objects = this;
		var settings = {
			items: 'tbody tr',
			handles: 'td'
		};
		
		$.extend(settings, custom_settings);
		
	/*-----------------------------------------------------------------------*/
		
		// Make selectable
		objects.addClass('selectable');
		
		// Process selections
		objects.delegate(settings.items, 'click.symSelectable', function(event) {
			var item = $(this),
				items = item.siblings().andSelf(),
				selection, first, last;
			
			// Range selection
			if((event.shiftKey) && items.filter('.selected').size() > 0) {
				
				// Select upwards
				if(item.prevAll().filter('.selected').size() > 0) {
					first = items.filter('.selected:first').index();
					last = item.index() + 1;
				}
				
				// Select downwards
				else {
					first = item.index();
					last = items.filter('.selected:last').index() + 1;
				}
				
				// Get selection
				selection = items.slice(first, last);
				
				// Deselect items outside the selection range
				items.filter('.selected').not(selection).removeClass('selected').trigger('deselect');
				
				// Select range
				selection.addClass('selected').trigger('select');
			}
			
			// Single selection
			else {
			
				// Press meta key to adjust current range, otherwise the selection will be removed
				if(!event.metaKey) {
					items.not(item).filter('.selected').removeClass('selected').trigger('deselect');
				}
				
				// Toggle selection
				item.toggleClass('selected');
				
				// Fire event
				if(item.is('.selected')) {
					item.trigger('select');
				}
				else {
					item.trigger('deselect');
				}		
			}

		});
				
		// Handle highlighting conflicts between orderable and selectable items
		objects.find(settings.handles).bind('mousedown', function(event) {
			var object = $(this).parents(objects[0].tagName).addClass('selecting');
			window.setTimeout(function() {
			    object.removeClass('selecting');
			}, 50);
		});	
		<commit_msg>Don't forget to check/uncheck checkboxes while selecting<commit_after>/**
 * @package assets
 */

(function($) {

	/**
	 * This plugin makes items selectable. Clicking an item will select it 
	 * by adding the class <code>.selected</code>. Holding down the shift key 
	 * while clicking multiple items creates a selection range. Holding the meta key 
	 * (which is <code>cmd</code> on a Mac or <code>ctrl</code> on Windows) allows 
	 * the selection of multiple items or the modification of an already selected 
	 * range of items. Doubleclicking outside the selection list will 
	 * remove the selection.
	 *
	 * @param {Object} custom_settings
	 *  An object specifying the items that should be made selectable and 
	 *  their ordering handles. The latter is needed to properly handle item highlighting 
	 *  when used in connection with the orderable plugin
	 */
 	$.fn.symphonySelectable = function(custom_settings) {
		var objects = this;
		var settings = {
			items: 'tbody tr',
			handles: 'td'
		};
		
		$.extend(settings, custom_settings);
		
	/*-----------------------------------------------------------------------*/
		
		// Make selectable
		objects.addClass('selectable');
		
		// Process selections
		objects.delegate(settings.items, 'click.symSelectable', function(event) {
			var item = $(this),
				items = item.siblings().andSelf(),
				selection, deselection, first, last;
			
			// Range selection
			if((event.shiftKey) && items.filter('.selected').size() > 0) {
				
				// Select upwards
				if(item.prevAll().filter('.selected').size() > 0) {
					first = items.filter('.selected:first').index();
					last = item.index() + 1;
				}
				
				// Select downwards
				else {
					first = item.index();
					last = items.filter('.selected:last').index() + 1;
				}
				
				// Get selection
				selection = items.slice(first, last);
				
				// Deselect items outside the selection range
				deselection = items.filter('.selected').not(selection).removeClass('selected').trigger('deselect');
				deselection.find('input[type=checkbox]').attr('checked', false);
				
				// Select range
				selection.addClass('selected').trigger('select');
				selection.find('input[type=checkbox]').attr('checked', true);
			}
			
			// Single selection
			else {
			
				// Press meta key to adjust current range, otherwise the selection will be removed
				if(!event.metaKey) {
					deselection = items.not(item).filter('.selected').removeClass('selected').trigger('deselect');
					deselection.find('input[type=checkbox]').attr('checked', false);
				}
				
				// Toggle selection
				item.toggleClass('selected');
				item.find('input[type=checkbox]').attr('checked', true);
				
				// Fire event
				if(item.is('.selected')) {
					item.trigger('select');
				}
				else {
					item.trigger('deselect');
				}		
			}

		});
				
		// Handle highlighting conflicts between orderable and selectable items
		objects.find(settings.handles).bind('mousedown', function(event) {
			var object = $(this).parents(objects[0].tagName).addClass('selecting');
			window.setTimeout(function() {
			    object.removeClass('selecting');
			}, 50);
		});	
		
{'fraction_non_alphanumeric': 0.15793890567304464, 'fraction_numerical': 0.0023497818059751594, 'mean_word_length': 2.7858958068614994, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '4214193', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1583, 'n_words': 449}