fune/tools/tryselect/selectors/chooser/static/select.js
Andrew Halberstadt 0c56961d92 Bug 1499822 - [tryselect] Implement |mach try chooser| r=sclements
Usage:

  $ ./mach try chooser

Will start a local flask server and server a "trychooser-like" page
that is dynamically generated from the taskgraph.

Differential Revision: https://phabricator.services.mozilla.com/D14903

--HG--
extra : moz-landing-system : lando
2019-01-08 16:46:57 +00:00

38 lines
1 KiB
JavaScript

const labels = $("label.multiselect");
const boxes = $("label.multiselect input:checkbox");
var lastChecked = {};
// implements shift+click
labels.click(function(e) {
if (e.target.tagName === "INPUT")
return;
let box = $("#" + this.htmlFor)[0];
let activeSection = $("div.tab-pane.active")[0].id;
if (activeSection in lastChecked) {
// Bug 559506 - In Firefox shift/ctrl/alt+clicking a label doesn't check the box.
let isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
if (e.shiftKey) {
if (isFirefox)
box.checked = !box.checked;
let start = boxes.index(box);
let end = boxes.index(lastChecked[activeSection]);
boxes.slice(Math.min(start, end), Math.max(start, end) + 1).prop("checked", box.checked);
apply();
}
}
lastChecked[activeSection] = box;
});
function selectAll(btn) {
let checked = !!btn.value;
$("div.active label.filter-label").each(function(index) {
$(this).find("input:checkbox")[0].checked = checked;
});
apply();
}