diff --git a/public/js/paperfiltersa.js b/public/js/paperfiltersa.js deleted file mode 100644 index 14f2209cd26df6dd408fd729c3e6b325930b9598..0000000000000000000000000000000000000000 --- a/public/js/paperfiltersa.js +++ /dev/null @@ -1,72 +0,0 @@ -var state = 0; - -// Object to store the state for each year -var yearStates = { - "2020": 0, - "2021": 0, - "2019": 0, - "2022": 0, - "2023": 0, -}; - -function filter(year) { - var new_row = document.getElementById("cont_paper"); - new_row.innerHTML = ""; - document.getElementById("nextblock").style.display = "none"; - - // Use the state from the yearStates object - state = yearStates[year]; - - if (state === 0) { - console.log("filter"); - - // Start loading/adding the paper content to the page here ..... - for (var j = 0; j < jsonContent.length; j++) { - var filterString = jsonContent[j].item.conference.date.toString(); - - // Check for the selected year - if (filterString.includes(year) || jsonContent[j].item.journal.year == year) { - addpaper(jsonContent[j]); - count += 1; - } - - state = 1; - } - - // Update the background color and count for the selected year - document.getElementById(`filter${year}`).style.backgroundColor = "grey"; - - // Reset other buttons - Object.keys(yearStates).forEach((otherYear) => { - if (otherYear !== year) { - yearStates[otherYear] = 0; - document.getElementById(`filter${otherYear}`).style.backgroundColor = "lightgrey"; - document.getElementById(`filter${otherYear}`).innerHTML = `${otherYear}`; - } - }); - - document.getElementById(`filter${year}`).innerHTML = `${year} (${count})`; - count = 0; - - // Update the state for the selected year - yearStates[year] = 1; - } else if (state === 1) { - // Reset the state and display the initial set of papers - yearStates[year] = 0; - document.getElementById(`filter${year}`).style.backgroundColor = "lightgrey"; - document.getElementById("nextblock").style.display = "block"; - - for (var j = 0; j < 6; j++) { - addpaper(jsonContent[j]); - } - - state = 0; - - // Reset the display for all years - Object.keys(yearStates).forEach((otherYear) => { - document.getElementById(`filter${otherYear}`).style.backgroundColor = "lightgrey"; - document.getElementById(`filter${otherYear}`).innerHTML = `${otherYear}`; - }); - } -} -