53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
import {fill_charts} from "./chart_functions.js";
|
|
|
|
|
|
function debounce(func, delay) {
|
|
let timeoutId;
|
|
|
|
return function (...args) {
|
|
clearTimeout(timeoutId);
|
|
|
|
timeoutId = setTimeout(() => {
|
|
func.apply(this, args);
|
|
}, delay);
|
|
};
|
|
}
|
|
|
|
function register_nav_links() {
|
|
var navAnchors = document.querySelectorAll("nav a");
|
|
|
|
navAnchors.forEach(function (a_el) {
|
|
a_el.addEventListener("click", function(event) {
|
|
var active_anchor = document.querySelector("nav a.active");
|
|
active_anchor.classList.remove("active");
|
|
|
|
var clicked = event.target;
|
|
clicked.classList.add("active");
|
|
});
|
|
});
|
|
}
|
|
|
|
function register_handlers() {
|
|
register_nav_links();
|
|
}
|
|
|
|
|
|
function load_in_table() {
|
|
var rows = Array.from(document.querySelectorAll(".row_awaiting_processing"));
|
|
rows.sort((a, b) => b.dataset.rcntTransactionRowPos - a.dataset.rcntTransactionRowPos);
|
|
|
|
const processElement = (element, index) => {
|
|
element.classList.remove('row_awaiting_processing');
|
|
setTimeout(() => {
|
|
if (index < rows.length - 1) {
|
|
processElement(rows[index + 1], index + 1);
|
|
}
|
|
}, 25); // 1000 milliseconds (1 second) delay, adjust as needed
|
|
};
|
|
|
|
processElement(rows[0], 0);
|
|
}
|
|
|
|
const trigger_table_animation = debounce(load_in_table, 100);
|
|
|
|
export {register_handlers, trigger_table_animation, fill_charts};
|