Commit 08e190b2 authored by Traboulsi's avatar Traboulsi
Browse files

Update public/js/paperfilter.js

parent 4d5dcde6
Pipeline #8756 passed with stage
in 9 seconds
......@@ -3,7 +3,6 @@ var state2021 = 0
var state2022 = 0
var state2023 = 0
var state2019 = 0
var stateall= 0
var state = 0
var count = 0
function filter(year){
......@@ -11,7 +10,6 @@ function filter(year){
new_row.innerHTML = "";
document.getElementById("nextblock").style.display = "none"
if (year == "2020") {
state = state2020
} else if (year == "2021"){
......@@ -22,12 +20,7 @@ function filter(year){
state = state2022
}else if (year == "2023"){
state = state2023
}else if(year == "All"){
state = stateall
}
if (state == 0){
console.log("filter")
// Start loading/adding the paper content to the page here .....
......@@ -53,7 +46,7 @@ function filter(year){
document.getElementById("filter2021").innerHTML = "2021"
document.getElementById("filter2019").innerHTML = "2019"
count = 0
}else if (year == "2021"){
} else if (year == "2021"){
for (var j = 0; j < jsonContent.length; j++) {
var filterString = jsonContent[j].item.conference.date.toString()
if ( filterString.includes('2021') || jsonContent[j].item.journal.year == 2021) {
......@@ -116,6 +109,7 @@ function filter(year){
document.getElementById("filter2019").style.backgroundColor = "lightgrey"
document.getElementById("filter2020").style.backgroundColor = "lightgrey"
document.getElementById("filter2022").style.backgroundColor = "lightgrey"
document.getElementById("filter2023").style.backgroundColor = "lightgrey"
document.getElementById("filter2022").innerHTML = "2022"
document.getElementById("filter2019").innerHTML = "2019"
document.getElementById("filter2023").innerHTML = "2023 (" + count +")"
......@@ -145,29 +139,7 @@ function filter(year){
document.getElementById("filter2020").innerHTML = "2020"
document.getElementById("filter2022").innerHTML = "2022 (" + count +")"
count = 0
}else if (year == "All"){
for (var j = 0; j < jsonContent.length; j++) {
addpaper(jsonContent[j]);
count += 1;
}
state = 1
document.getElementById("filterall").style.backgroundColor = "grey"
document.getElementById("filter2019").style.backgroundColor = "lightgrey"
document.getElementById("filter2021").style.backgroundColor = "lightgrey"
document.getElementById("filter2020").style.backgroundColor = "lightgrey"
document.getElementById("filter2023").style.backgroundColor = "lightgrey"
document.getElementById("filter2022").style.backgroundColor = "grey"
document.getElementById("filter2019").innerHTML = "2019"
document.getElementById("filter2021").innerHTML = "2021"
document.getElementById("filter2023").innerHTML = "2023"
document.getElementById("filter2020").innerHTML = "2020"
document.getElementById("filterall").innerHTML = "All (" + count +")"
count = 0
}
if (year == "2020") {
state2020 = 1
state2021 = 0
......@@ -201,13 +173,6 @@ function filter(year){
state2021 = 0
state2022 = 0
state2023 = 1
} else if (year == "All"){
state2019 = 0
state2020 = 0
state2021 = 0
state2022 = 0
state2023 = 0
stateall=1
}
} else if (state == 1) {
......@@ -236,12 +201,10 @@ function filter(year){
document.getElementById("filter2020").style.backgroundColor = "lightgrey"
document.getElementById("filter2022").style.backgroundColor = "lightgrey"
document.getElementById("filter2023").style.backgroundColor = "lightgrey"
document.getElementById("filterall").style.backgroundColor = "lightgrey"
document.getElementById("filter2019").innerHTML = "2019"
document.getElementById("filter2021").innerHTML = "2021"
document.getElementById("filter2020").innerHTML = "2020"
document.getElementById("filter2022").innerHTML = "2022"
document.getElementById("filter2023").innerHTML = "2023"
document.getElementById("filterall").innerHTML = "All"
}
}
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