Last active
June 4, 2019 14:59
-
-
Save croisillon/7464507 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before | |
if ( self.data('branches') ) { | |
checked_stack.push( this ); | |
} else { | |
var len = checked_stack.length; | |
if ( this.checked === true ) { | |
checked_stack.push( this ); | |
if ( checked_stack.length > max_selected ) { | |
checked_stack.shift().checked = false; | |
} | |
} else { | |
var arr = []; | |
while ( len-- ) { | |
if ( this.id !== checked_stack[len]['id'] ) { | |
arr.push(checked_stack[len]); | |
} | |
} | |
checked_stack = arr.reverse(); | |
} | |
} | |
// After | |
(self.data('branches') | |
&& ( | |
checked_stack.push(this) | |
) | |
) || | |
(self.data('branches') | |
|| ( | |
(this.checked === true | |
&& ( | |
checked_stack.push(this), | |
(checked_stack.length > max_selected | |
&& ( | |
checked_stack.shift().checked = false | |
) | |
) | |
) | |
) || | |
(this.checked === true | |
|| ( | |
checked_stack = (function (len) { | |
var arr = []; | |
while ( len-- ) { | |
this.id !== checked_stack[len]['id'] && arr.push(checked_stack[len]); | |
} | |
return arr; | |
} (checked_stack.length) ).reverse() | |
) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment