add radio input for sorting tags,features by name or numThemes

This commit is contained in:
2021-08-11 19:36:41 -07:00
parent df506a49aa
commit e22858894e
6 changed files with 194 additions and 67 deletions

View File

@@ -7,6 +7,24 @@ function getSortBy() {
}
}
function getTagSortBy() {
let tagSortByNumThemes = document.getElementById('tagSortByNumThemes');
if (tagSortByNumThemes === null) {
return 'numThemes';
} else {
return tagSortByNumThemes.checked ? 'numThemes' : 'name';
}
}
function getFeatureSortBy() {
let featureSortByNumThemes = document.getElementById('featureSortByNumThemes');
if (featureSortByNumThemes === null) {
return 'numThemes';
} else {
return featureSortByNumThemes.checked ? 'numThemes' : 'name';
}
}
function getSortedThemes(themeList, sortedBy) {
if (sortedBy === 'date') {
return themeList.sort((a, b) => b.date_in_seconds - a.date_in_seconds);