-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathscript.js
More file actions
35 lines (32 loc) · 863 Bytes
/
Copy pathscript.js
File metadata and controls
35 lines (32 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function mark() {
document.getElementById("result").innerHTML = "⏳ Scanning...";
fetch('/mark')
.then(res => res.json())
.then(data => {
document.getElementById("result").innerHTML =
`✅ <b>${data.name}</b><br><small>${data.time}</small>`;
});
}
// SEARCH
document.addEventListener("DOMContentLoaded", ()=>{
let input = document.getElementById("search");
if(input){
input.addEventListener("keyup", ()=>{
let val = input.value.toLowerCase();
document.querySelectorAll("table tr").forEach(row=>{
row.style.display = row.innerText.toLowerCase().includes(val) ? "" : "none";
});
});
}
// CHART
fetch('/stats')
.then(res=>res.json())
.then(data=>{
let names = data.map(d=>d[0]);
let count = data.map(d=>d[1]);
new Chart(document.getElementById("chart"),{
type:'bar',
data:{labels:names,datasets:[{data:count}]}
});
});
});