watchyourlan/internal/web/public/js/hist-html.js
2025-03-18 22:04:12 +07:00

24 lines
No EOL
488 B
JavaScript

function getHistHTML(hist) {
let html = '', col, title;
for (let h of hist) {
if (h.Now != 0) {
col = `my-box-on`;
} else {
col = `my-box-off`;
}
title = `title="Date: ${h.Date}\nIface: ${h.Iface}\nIP: ${h.IP}\nKnown: ${h.Known}"`;
html = html + `<i ${title} class="${col}"></i>`;
}
return html;
}
function sortHistByDate(hist) {
hist.sort((a, b) => (a.Date < b.Date ? 1 : -1));
return hist;
}