BlueGit

timfa bluegit

Files

bluegit / internal / server / static / repo.js

repo.js

feat: toon repositories en groepen op het profiel
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
Passed 69db8c2f History
repo.js 1.3 KiB Download Raw
1(function () {
2 document.querySelectorAll("select[data-rev]").forEach(function (sel) {
3 sel.addEventListener("change", function () {
4 var url = new URL(window.location.href);
5 url.searchParams.set("rev", sel.value);
6 window.location = url.toString();
7 });
8 });
9 var filter = document.querySelector("[data-tree-filter]");
10 if (filter) {
11 var items = document.querySelectorAll(".treelist li");
12 filter.addEventListener("input", function () {
13 var q = filter.value.trim().toLowerCase();
14 var paths = [];
15 items.forEach(function (li) {
16 paths.push((li.getAttribute("data-path") || "").toLowerCase());
17 });
18 items.forEach(function (li, i) {
19 if (q === "") {
20 li.hidden = false;
21 return;
22 }
23 var path = paths[i];
24 if (path.indexOf(q) !== -1) {
25 li.hidden = false;
26 return;
27 }
28 var prefix = path + "/";
29 var child = false;
30 for (var j = 0; j < paths.length; j++) {
31 if (paths[j].indexOf(prefix) === 0 && paths[j].indexOf(q) !== -1) {
32 child = true;
33 break;
34 }
35 }
36 li.hidden = !child;
37 });
38 });
39 if (new URLSearchParams(window.location.search).get("focus") === "1") {
40 filter.focus();
41 }
42 }
43})();