From cb07e37ed72182af33a992d7e0b44f7c7ee4af04 Mon Sep 17 00:00:00 2001 From: jwansek Date: Sun, 7 May 2023 22:16:38 +0100 Subject: Finished filtering client side --- static/scripts.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'static/scripts.js') diff --git a/static/scripts.js b/static/scripts.js index 6fec221..01196d3 100644 --- a/static/scripts.js +++ b/static/scripts.js @@ -1,5 +1,11 @@ -function collapseTogglePress(elem) { - console.log("elem"); +function collapseTogglePress(elem, a_elem, num_hidden) { + if (getComputedStyle(document.getElementById(elem)).display === "none") { + document.getElementById(elem).style.display = "block"; + document.getElementById(a_elem).innerText = `Hide ${num_hidden} filters` + } else { + document.getElementById(elem).style.display = "none"; + document.getElementById(a_elem).innerText =`Un-hide ${num_hidden} hidden filters` + } } const PLOT_FUNC_MAPPINGS = { @@ -7,7 +13,7 @@ const PLOT_FUNC_MAPPINGS = { } $(document).ready(function() { - console.log("ready!"); + document.getElementById("filterform").action = window.location.pathname + "/apply_click"; fetch("/api/charts.json").then((resp) => { resp.json().then((body) => { -- cgit v1.2.3