Make sure that SQLite uses no prefix
[lhc/web/wiklou.git] / resources / jquery / jquery.checkboxShiftClick.js
1 /**
2 * jQuery checkboxShiftClick
3 *
4 * This will enable checkboxes to be checked or unchecked in a row by clicking one, holding shift and clicking another one
5 *
6 * @author Krinkle <krinklemail@gmail.com>
7 * @license GPL v2
8 */
9 ( function ( $ ) {
10 $.fn.checkboxShiftClick = function ( text ) {
11 var prevCheckbox = null, $box = this;
12 // When our boxes are clicked..
13 $box.click( function ( e ) {
14 // And one has been clicked before...
15 if ( prevCheckbox !== null && e.shiftKey ) {
16 // Check or uncheck this one and all in-between checkboxes
17 $box.slice(
18 Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
19 Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
20 ).prop( 'checked', !!e.target.checked );
21 }
22 // Either way, update the prevCheckbox variable to the one clicked now
23 prevCheckbox = e.target;
24 } );
25 return $box;
26 };
27 }( jQuery ) );