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

Add new paperfilter

parent 300efbda
Pipeline #8736 passed with stage
in 10 seconds
var state2020 = 0;
var state2021 = 0;
var state2022 = 0;
var state2023 = 0;
var state2019 = 0;
var stateall = 0;
var state = 0;
var count = 0;
function filter(year) {
var new_row = document.getElementById("cont_paper");
new_row.innerHTML = "";
document.getElementById("nextblock").style.display = "none";
if (year == "All") {
state = stateall;
} else if (year == "2019") {
state = state2019;
} else if (year == "2020") {
state = state2020;
} else if (year == "2021") {
state = state2021;
} else if (year == "2022") {
state = state2022;
} else if (year == "2023") {
state = state2023;
}
if (state == 0) {
console.log("filter");
for (var j = 0; j < jsonContent.length; j++) {
var filterString = jsonContent[j].item.conference.date.toString();
if (year === "All" || filterString.includes(year) || jsonContent[j].item.journal.year == year) {
addpaper(jsonContent[j]);
count += 1;
}
}
state = 1;
document.getElementById("filter" + year).style.backgroundColor = "grey";
// Reset other filter buttons
var years = ["2019", "2020", "2021", "2022", "2023"];
for (var i = 0; i < years.length; i++) {
if (years[i] !== year) {
document.getElementById("filter" + years[i]).style.backgroundColor = "lightgrey";
}
}
document.getElementById("filter" + year).innerHTML = year + " (" + count + ")";
count = 0;
} else if (state == 1) {
// Handle state == 1
console.log("State is 1");
// You can add code here to handle state 1 as needed
// Reset state and other UI elements
state = 0;
document.getElementById("filter" + year).style.backgroundColor = "lightgrey";
document.getElementById("nextblock").style.display = "block";
// Load some content, adjust as needed
for (var j = 0; j < 6; j++) {
addpaper(jsonContent[j]);
// Do something
}
}
}
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