1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00
phorge-phorge/webroot/rsrc/js/application/differential/behavior-diff-radios.js
2011-02-03 15:41:58 -08:00

34 lines
879 B
JavaScript

/**
* @provides javelin-behavior-differential-diff-radios
* @requires javelin-lib-dev
*/
JX.behavior('differential-diff-radios', function(config) {
JX.Stratcom.listen(
'click',
'differential-new-radio',
function(e) {
var target = e.getTarget();
var adjust;
var node;
var reset = false;
for (var ii = 0; ii < config.radios.length; ii++) {
node = JX.$(config.radios[ii]);
if (parseInt(node.value, 10) >= parseInt(target.value, 10)) {
if (node.checked) {
node.checked = false;
reset = true;
}
node.disabled = 'disabled';
} else {
node.disabled = '';
if (!adjust || adjust.value < node.value) {
adjust = node;
}
}
}
if (reset && adjust) {
adjust.checked = 'checked';
}
});
});