Path: blob/master/webroot/rsrc/js/phui/behavior-phui-selectable-list.js
12241 views
/**1* @provides javelin-behavior-phui-selectable-list2* @requires javelin-behavior3* javelin-stratcom4* javelin-dom5*/67JX.behavior('phui-selectable-list', function() {89JX.Stratcom.listen('click', 'phui-oi-selectable', function(e) {10if (!e.isNormalClick()) {11return;12}1314// If the user clicked a link, ignore it.15if (e.getNode('tag:a')) {16return;17}1819var root = e.getNode('phui-oi-selectable');2021// If the user did not click the checkbox, pretend they did. This makes22// the entire element a click target to make changing the selection set a23// bit easier.24if (!e.getNode('tag:input')) {25var checkbox = getCheckbox(root);26checkbox.checked = !checkbox.checked;2728e.kill();29}3031setTimeout(JX.bind(null, redraw, root), 0);32});3334function getCheckbox(root) {35return JX.DOM.find(root, 'input');36}3738function redraw(root) {39var checkbox = getCheckbox(root);40JX.DOM.alterClass(root, 'phui-oi-selected', !!checkbox.checked);41}4243});444546