- /**
- * Toggle the open/close state of a list is a menu.
- *
- * @param {jQuery} $item
- * The li item to be toggled.
- *
- * @param {Boolean} switcher
- * A flag that forces toggleClass to add or a remove a class, rather than
- * simply toggling its presence.
- */
- function toggleList($item, switcher) {
- var $toggle = $item.children('.toolbar-box').children('.toolbar-handle');
- switcher = (typeof switcher !== 'undefined') ? switcher : !$item.hasClass('open');
- // Toggle the item open state.
- $item.toggleClass('open', switcher);
- // Twist the toggle.
- $toggle.toggleClass('open', switcher);
- // Adjust the toggle text.
- $toggle
- .find('.action')
- // Expand Structure, Collapse Structure.
- .text((switcher) ? ui.handleClose : ui.handleOpen);