Commit b70bea75 authored by Myriam Guedey's avatar Myriam Guedey
Browse files

Update paperfilter_new.js

parent 5a90bac7
Pipeline #8739 passed with stage
in 10 seconds
var state2018 = 0;
var state2019 = 0;
var state2020 = 0; var state2020 = 0;
var state2021 = 0; var state2021 = 0;
var state2022 = 0; var state2022 = 0;
var state2023 = 0; var state2023 = 0;
var state2019 = 0;
var stateall = 0; var stateall = 0;
var state = 0; var state = 0;
var count = 0; var count = 0;
...@@ -12,21 +13,23 @@ function filter(year) { ...@@ -12,21 +13,23 @@ function filter(year) {
new_row.innerHTML = ""; new_row.innerHTML = "";
document.getElementById("nextblock").style.display = "none"; document.getElementById("nextblock").style.display = "none";
if (year == "All") { if (year === "All") {
state = stateall; state = stateall;
} else if (year == "2019") { } else if (year === "2018") {
state = state2018;
} else if (year === "2019") {
state = state2019; state = state2019;
} else if (year == "2020") { } else if (year === "2020") {
state = state2020; state = state2020;
} else if (year == "2021") { } else if (year === "2021") {
state = state2021; state = state2021;
} else if (year == "2022") { } else if (year === "2022") {
state = state2022; state = state2022;
} else if (year == "2023") { } else if (year === "2023") {
state = state2023; state = state2023;
} }
if (state == 0) { if (state === 0 || year === "All") {
console.log("filter"); console.log("filter");
for (var j = 0; j < jsonContent.length; j++) { for (var j = 0; j < jsonContent.length; j++) {
...@@ -42,7 +45,7 @@ function filter(year) { ...@@ -42,7 +45,7 @@ function filter(year) {
document.getElementById("filter" + year).style.backgroundColor = "grey"; document.getElementById("filter" + year).style.backgroundColor = "grey";
// Reset other filter buttons // Reset other filter buttons
var years = ["2019", "2020", "2021", "2022", "2023"]; var years = ["2018", "2019", "2020", "2021", "2022", "2023"];
for (var i = 0; i < years.length; i++) { for (var i = 0; i < years.length; i++) {
if (years[i] !== year) { if (years[i] !== year) {
document.getElementById("filter" + years[i]).style.backgroundColor = "lightgrey"; document.getElementById("filter" + years[i]).style.backgroundColor = "lightgrey";
...@@ -51,8 +54,8 @@ function filter(year) { ...@@ -51,8 +54,8 @@ function filter(year) {
document.getElementById("filter" + year).innerHTML = year + " (" + count + ")"; document.getElementById("filter" + year).innerHTML = year + " (" + count + ")";
count = 0; count = 0;
} else if (state == 1) { } else if (state === 1) {
// Handle state == 1 // Handle state === 1
console.log("State is 1"); console.log("State is 1");
// You can add code here to handle state 1 as needed // You can add code here to handle state 1 as needed
...@@ -60,7 +63,7 @@ function filter(year) { ...@@ -60,7 +63,7 @@ function filter(year) {
// Reset state and other UI elements // Reset state and other UI elements
state = 0; state = 0;
document.getElementById("filter" + year).style.backgroundColor = "lightgrey"; document.getElementById("filter" + year).style.backgroundColor = "lightgrey";
document.getElementById("nextblock").style.display = "block"; document.getElementById("nextblock").style display = "block";
// Load some content, adjust as needed // Load some content, adjust as needed
for (var j = 0; j < 6; j++) { for (var j = 0; j < 6; j++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment