|
|
|
|
@ -289,7 +289,12 @@
|
|
|
|
|
// Shift-click range selection for checkbox rows
|
|
|
|
|
var lastCheckedCb = null;
|
|
|
|
|
|
|
|
|
|
function statusClass(status) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Track checkbox state before click to avoid double-toggle issues across browsers
|
|
|
|
|
var lastMouseDownCb = null;
|
|
|
|
|
var lastMouseDownChecked = null;
|
|
|
|
|
function statusClass(status) {
|
|
|
|
|
var s = (status || "").toString().toLowerCase();
|
|
|
|
|
|
|
|
|
|
// Allow derived display strings like "Success (override)"
|
|
|
|
|
@ -376,10 +381,17 @@
|
|
|
|
|
table.addEventListener('mousedown', function (e) {
|
|
|
|
|
var t = e.target;
|
|
|
|
|
if (!t) return;
|
|
|
|
|
if (t.classList && t.classList.contains('rc_row_cb') && e.shiftKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (window.getSelection) {
|
|
|
|
|
try { window.getSelection().removeAllRanges(); } catch (err) {}
|
|
|
|
|
|
|
|
|
|
if (t.classList && t.classList.contains('rc_row_cb')) {
|
|
|
|
|
// Remember state before click so Shift-click logic can reliably compute the intended target state
|
|
|
|
|
lastMouseDownCb = t;
|
|
|
|
|
lastMouseDownChecked = t.checked;
|
|
|
|
|
|
|
|
|
|
if (e.shiftKey) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (window.getSelection) {
|
|
|
|
|
try { window.getSelection().removeAllRanges(); } catch (err) {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, true);
|
|
|
|
|
@ -395,9 +407,15 @@ table.addEventListener('click', function (e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
// The default action would toggle the checkbox; do it manually
|
|
|
|
|
var targetChecked = !t.checked;
|
|
|
|
|
// Use the remembered pre-click state to avoid double toggling in some browsers
|
|
|
|
|
var preChecked = (lastMouseDownCb === t ? lastMouseDownChecked : t.checked);
|
|
|
|
|
var targetChecked = !preChecked;
|
|
|
|
|
t.checked = targetChecked;
|
|
|
|
|
|
|
|
|
|
// Reset mousedown tracking once we've consumed it
|
|
|
|
|
lastMouseDownCb = null;
|
|
|
|
|
lastMouseDownChecked = null;
|
|
|
|
|
|
|
|
|
|
var cbs = Array.prototype.slice.call(table.querySelectorAll('tbody .rc_row_cb'));
|
|
|
|
|
var start = cbs.indexOf(lastCheckedCb);
|
|
|
|
|
var end = cbs.indexOf(t);
|
|
|
|
|
@ -422,7 +440,12 @@ table.addEventListener('click', function (e) {
|
|
|
|
|
// Normal click: let default toggle happen, but remember the last checkbox
|
|
|
|
|
lastCheckedCb = t;
|
|
|
|
|
|
|
|
|
|
// Defer update until after the checkbox state changes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset mousedown tracking
|
|
|
|
|
lastMouseDownCb = null;
|
|
|
|
|
lastMouseDownChecked = null;
|
|
|
|
|
// Defer update until after the checkbox state changes
|
|
|
|
|
setTimeout(updateButtons, 0);
|
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
|
|