summaryrefslogtreecommitdiff
path: root/resources/jquery/jquery.checkboxShiftClick.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/jquery/jquery.checkboxShiftClick.js')
-rw-r--r--resources/jquery/jquery.checkboxShiftClick.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js
index 0a1d7d7d..1990dc0d 100644
--- a/resources/jquery/jquery.checkboxShiftClick.js
+++ b/resources/jquery/jquery.checkboxShiftClick.js
@@ -6,23 +6,22 @@
* @author Krinkle <krinklemail@gmail.com>
* @license GPL v2
*/
-( function( $ ) {
-$.fn.checkboxShiftClick = function( text ) {
- var prevCheckbox = null;
- var $box = this;
- // When our boxes are clicked..
- $box.click( function( e ) {
- // And one has been clicked before...
- if ( prevCheckbox !== null && e.shiftKey ) {
- // Check or uncheck this one and all in-between checkboxes
- $box.slice(
- Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
- Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
- ).prop( 'checked', e.target.checked ? true : false );
- }
- // Either way, update the prevCheckbox variable to the one clicked now
- prevCheckbox = e.target;
- } );
- return $box;
-};
-} )( jQuery ); \ No newline at end of file
+( function ( $ ) {
+ $.fn.checkboxShiftClick = function ( text ) {
+ var prevCheckbox = null, $box = this;
+ // When our boxes are clicked..
+ $box.click( function ( e ) {
+ // And one has been clicked before...
+ if ( prevCheckbox !== null && e.shiftKey ) {
+ // Check or uncheck this one and all in-between checkboxes
+ $box.slice(
+ Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
+ Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
+ ).prop( 'checked', !!e.target.checked );
+ }
+ // Either way, update the prevCheckbox variable to the one clicked now
+ prevCheckbox = e.target;
+ } );
+ return $box;
+ };
+}( jQuery ) );