diff --git a/www/include/js/jquery.Selection.js b/www/include/js/jquery.Selection.js new file mode 100644 index 0000000000..efbf2b15de --- /dev/null +++ b/www/include/js/jquery.Selection.js @@ -0,0 +1,196 @@ +/* + * Selection Object + * + * + */ + +(function( window ) { + + var Selectable = function(options) { + + var defaults = { + allow_multiple : false, + container : window.document, + selector : '*', + callbackSelection : null, + selectStart : null, + selectStop : null + }, + options = (typeof options == 'object') ? options : {}; + + this.options = jQuery.extend(defaults, options); + this.datas = new Array(); + + var $container = jQuery(this.options.container), + $this = this; + + if(jQuery($container).hasClass('selectionnable')) + { + /* this container is already selectionnable */ + + return; + } + + jQuery($container).addClass('selectionnable'); + + jQuery(this.options.selector, $container) + .live('mousedown', function(event){ + + if(typeof $this.options.selectStart === 'function') + { + $this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this); + } + + var $that = jQuery(this); + + var k = get_value($that, $this); + + if(is_shift_key(event) && jQuery('.last_selected', $container).filter($this.options.selector).length != 0) + { + var lst = jQuery($this.options.selector, $container); + + var index1 = jQuery.inArray( jQuery('.last_selected', $container).filter($this.options.selector)[0], lst ); + var index2 = jQuery.inArray( $that[0], lst ); + + if(index2= 0; + }, + get : function(){ + + return this.datas; + }, + empty : function(){ + this.datas = new Array(); + + return this; + }, + length : function(){ + + return this.datas.length; + }, + size : function(){ + + return this.datas.length; + }, + serialize : function(separator){ + + separator = separator || ';'; + + return this.datas.join(separator); + }, + selectAll : function(separator){ + var $this = this; + + jQuery(this.optionsthis.options.selector, $container).not('.selected').filter(':visible').each(function(){ + $this.push(get_value(this, $this)); + $(this).addClass('selected'); + }); + + return this; + } + }; + +console.log('SELECTABALE to be declare'); + + window.Selectable = Selectable; +console.log('SELECTABALE declared'); +})(window); \ No newline at end of file diff --git a/www/include/js/tests/jquery.Selection.js.html b/www/include/js/tests/jquery.Selection.js.html new file mode 100644 index 0000000000..28971ba315 --- /dev/null +++ b/www/include/js/tests/jquery.Selection.js.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + +

QUnit example

+

+
+

+
    +
    test markup, will be hidden
    + + diff --git a/www/include/minify/groupsConfig.php b/www/include/minify/groupsConfig.php index 90fcc35247..a241d13375 100644 --- a/www/include/minify/groupsConfig.php +++ b/www/include/minify/groupsConfig.php @@ -79,7 +79,12 @@ $groups = array( , '//login/geonames.js' , '//include/jslibs/jquery.form.2.49.js' , '//include/jslibs/jquery.vertical.buttonset.js' + , '//include/js/jquery.Selection.js' + , '//prod/jquery.Prod.js' + , '//prod/jquery.Results.js' , '//prod/page0.js' + , '//prod/jquery.WorkZone.js' + , '//prod/jquery.Alerts.js' , '//prod/publicator.js' , '//prod/jquery.order.js' , '//include/jslibs/jquery.sprintf.1.0.3.js'