<commit_before>/*-----------------------------------------------------------------------------
	Collapsible plugin
-----------------------------------------------------------------------------*/
	
	jQuery.fn.symphonyCollapsible = function(custom_settings) {
		var objects = this;
		var settings = {
			items:				'.instance',
			handles:			'.header:first',
			delay_initialize:	false
		};
		
		jQuery.extend(settings, custom_settings);
		
	/*-------------------------------------------------------------------------
		Collapsible
	-------------------------------------------------------------------------*/
		
		objects = objects.map(function() {
			var object = this;
			var item = null;
			
			var start = function() {
				item = jQuery(this).parents(settings.items);
				
				jQuery(document).mouseup(stop);
				
				if (item.is('.collapsed')) {
					object.addClass('expanding');
					item.addClass('expanding');
					object.trigger('expandstart', [item]);
				}
				
				else {
					object.addClass('collapsing');
					item.addClass('collapsing');
					object.trigger('collapsestart', [item]);
				}
				
				return false;
			};
			
			var stop = function() {
				jQuery(document).unbind('mouseup', stop);
				
				if (item != null) {
					object.removeClass('expanding collapsing');
					item.removeClass('expanding collapsing');
					
					if (item.is('.collapsed')) {
						item.removeClass('collapsed').addClass('expanded');
						object.trigger('expandstop', [item]);
					}
					
					else {
						item.removeClass('expanded').addClass('collapsed');
						object.trigger('collapsestop', [item]);
					}
					
					item = null;
				}
				
				return false;
			};
			
		/*-------------------------------------------------------------------*/
			
			if (object instanceof jQuery === false) {
				object = jQuery(object);
			}
			
			object.collapsible = {
				cancel: function() {
					jQuery(document).unbind('mouseup', stop);
					
					if (item != null) {
						if (item.is('.collapsed')) {
							object.removeClass('expanding');
							item.removeClass('expanding');
							object.trigger('expandcancel', [item]);
						}
						
						else {
							object.removeClass('collapsing');
							item.removeClass('collapsing');
							object.trigger('collapsecancel', [item]);
						}
					}
				},
				
				initialize: function() {
					object.addClass('collapsible');
					object.find(settings.items).each(function() {
						var item = jQuery(this);
						var handle = item.find(settings.handles);
						
						handle.unbind('mousedown', start);
						handle.bind('mousedown', start);
					});
				},
				
				collapseAll: function() {
					object.find(settings.items).each(function() {
						var item = jQuery(this);
						
						if (item.is('.collapsed')) return;
						
						object.trigger('collapsestart', [item]);
						item.removeClass('expanded').addClass('collapsed');
						object.trigger('collapsestop', [item]);
					});
				},
				
				expandAll: function() {
					object.find(settings.items).each(function() {
						var item = jQuery(this);
						
						if (item.is('.expanded')) return;
						
						object.trigger('expandstart', [item]);
						item.removeClass('collapsed').addClass('expanded');
						object.trigger('expandstop', [item]);
					});
				}
			};
			
			if (settings.delay_initialize === true) {
				object.collapsible.initialize();
			}
			
			return object;
		});
		
		objects.collapsible = {
			collapseAll: function() {
				objects.each(function() {
					this.collapsible.collapseAll();
				});
			},
			
			expandAll: function() {
				objects.each(function() {
					this.collapsible.expandAll();
				});
			}
		};
		
		return objects;
	};
	
/*---------------------------------------------------------------------------*/<commit_msg>Basic documentation for the collapsible plugin<commit_after>/**
 * @package assets
 */

(function($) {

	/**
	 * This plugin makes items callapsible.
	 *
	 * @param {Object} custom_settings
	 *  An object specifying the item to be collapsed, their handles and 
	 *  a initialization delay
	 */
	$.fn.symphonyCollapsible = function(custom_settings) {
		var objects = this;
		var settings = {
			items:				'.instance',
			handles:			'.header:first',
			delay_initialize:	false
		};
		
		$.extend(settings, custom_settings);
		
	/*-----------------------------------------------------------------------*/
		
		objects = objects.map(function() {
			var object = this;
			var item = null;
			
			var start = function() {
				item = $(this).parents(settings.items);
				
				$(document).mouseup(stop);
				
				if (item.is('.collapsed')) {
					object.addClass('expanding');
					item.addClass('expanding');
					object.trigger('expandstart', [item]);
				}
				
				else {
					object.addClass('collapsing');
					item.addClass('collapsing');
					object.trigger('collapsestart', [item]);
				}
				
				return false;
			};
			
			var stop = function() {
				$(document).unbind('mouseup', stop);
				
				if (item != null) {
					object.removeClass('expanding collapsing');
					item.removeClass('expanding collapsing');
					
					if (item.is('.collapsed')) {
						item.removeClass('collapsed').addClass('expanded');
						object.trigger('expandstop', [item]);
					}
					
					else {
						item.removeClass('expanded').addClass('collapsed');
						object.trigger('collapsestop', [item]);
					}
					
					item = null;
				}
				
				return false;
			};
			
		/*-------------------------------------------------------------------*/
			
			if (object instanceof $ === false) {
				object = $(object);
			}
			
			object.collapsible = {
				cancel: function() {
					$(document).unbind('mouseup', stop);
					
					if (item != null) {
						if (item.is('.collapsed')) {
							object.removeClass('expanding');
							item.removeClass('expanding');
							object.trigger('expandcancel', [item]);
						}
						
						else {
							object.removeClass('collapsing');
							item.removeClass('collapsing');
							object.trigger('collapsecancel', [item]);
						}
					}
				},
				
				initialize: function() {
					object.addClass('collapsible');
					object.find(settings.items).each(function() {
						var item = $(this);
						var handle = item.find(settings.handles);
						
						handle.unbind('mousedown', start);
						handle.bind('mousedown', start);
					});
				},
				
				collapseAll: function() {
					object.find(settings.items).each(function() {
						var item = $(this);
						
						if (item.is('.collapsed')) return;
						
						object.trigger('collapsestart', [item]);
						item.removeClass('expanded').addClass('collapsed');
						object.trigger('collapsestop', [item]);
					});
				},
				
				expandAll: function() {
					object.find(settings.items).each(function() {
						var item = $(this);
						
						if (item.is('.expanded')) return;
						
						object.trigger('expandstart', [item]);
						item.removeClass('collapsed').addClass('expanded');
						object.trigger('expandstop', [item]);
					});
				}
			};
			
			if (settings.delay_initialize === true) {
				object.collapsible.initialize();
			}
			
			return object;
		});
		
		objects.collapsible = {
			collapseAll: function() {
				objects.each(function() {
					this.collapsible.collapseAll();
				});
			},
			
			expandAll: function() {
				objects.each(function() {
					this.collapsible.expandAll();
				});
			}
		};
		
		return objects;
	};

})(jQuery.noConflict());
{'fraction_non_alphanumeric': 0.22870980761469123, 'fraction_numerical': 0.0, 'mean_word_length': 1.886990291262136, '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': '1069465', 'n_tokens_mistral': 3056, 'n_tokens_neox': 2032, 'n_words': 339}