From 385146bd844683d0c12b358fee954d414ed88ba1 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Tue, 17 Nov 2020 20:14:55 +0100 Subject: [statistics] Add shift + click selection to the checkboxes --- modules-available/statistics/templates/clientlist.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index aeca368d..53db7c84 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -252,6 +252,22 @@ document.addEventListener("DOMContentLoaded", function () { }; var $boxes = $('.machine-checkbox'); $boxes.change($fn); + + // Shift click selection for the checkboxes + var lastChecked = null; + $boxes.click(function(e) { + if (!lastChecked) { + lastChecked = this; + return; + } + if (e.shiftKey) { + const start = $boxes.index(this); + const end = $boxes.index(lastChecked); + $boxes.slice(Math.min(start, end), Math.max(start, end) + 1).prop('checked', lastChecked.checked); + } + lastChecked = this; + }); + $("button[type=reset]").click(function() { setTimeout($fn, 1); }); if (window && window.opera && window.opera.version && Number(window.opera.version()) < 13) { $(document).ready(function () { -- cgit v1.2.3-55-g7522