MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / enableGroupSelection

Function enableGroupSelection

html/js/base_ts.js:344–364  ·  view source on GitHub ↗
(selector)

Source from the content-addressed store, hash-verified

342 return;
343}
344function enableGroupSelection(selector) {
345 var lastcheck = null; // no checkboxes clicked yet
346 // get desired checkboxes
347 var checkboxes = document.querySelectorAll(selector);
348 // loop over checkboxes to add event listener
349 Array.prototype.forEach.call(checkboxes, function (cbx, idx) {
350 cbx.addEventListener('click', function (evt) {
351 // test for shift key, not first checkbox, and not same checkbox
352 if (evt.shiftKey && null !== lastcheck && idx !== lastcheck) {
353 // get range of checks between last-checkbox and shift-checkbox
354 // Math.min/max does our sorting for us
355 Array.prototype.slice.call(checkboxes, Math.min(lastcheck, idx), Math.max(lastcheck, idx))
356 // and loop over each
357 .forEach(function (ccbx) {
358 ccbx.checked = true;
359 });
360 }
361 lastcheck = idx; // set this checkbox as last-checked for later
362 });
363 });
364}
365function searchInMapping() {
366 var searchValue = document.getElementById("searchMapping").value;
367 var trs = document.getElementById("content_table").getElementsByTagName("TR");

Callers 1

openThisMenuFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected