/**
 * @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);
		});	
		
		// Remove all selections by doubleclicking the body
		$('body').bind('dblclick', function() {
			objects.find(settings.items).removeClass('selected');
		});
		
		// Return objects
		return objects;

	};

})(jQuery.noConflict());

@@ -1316,16 +1316,125 @@
 , last;%0A
+%09%09%09%09%0A%09%09%09// Remove text ranges%0A%09%09%09if(window.getSelection) %7B%0A%09%09%09%09window.getSelection().removeAllRanges();%0A%09%09%09%7D%0A
 %09%09%09%0A%09%09%09/

Remove text ranges on select