$.collapsibleTabs: rewrite code for expandCondition and collapseCondition

...to make it slightly more understandable. Per Ori's comments on
I62aeb2b6.

Change-Id: Ib0e41916006cd4a3d6077345e3199fb4d5d77556