const yearSort = (a, b) =>
parseInt(a.getAttribute("sortyear")) - parseInt(b.getAttribute("sortyear"));
const authorSort = (a, b) => {
const aSort = a.getAttribute("sortauthor");
const bSort = b.getAttribute("sortauthor");
if (aSort > bSort) {
return 1;
}
if (aSort < bSort) {
return -1;
}
return 0;
};
const decimalSort = (a, b) => {
const aSort = a.$(".alexandrine").innerText;
const bSort = b.$(".alexandrine").innerText;
if (aSort > bSort) {
return 1;
}
if (aSort < bSort) {
return -1;
}
return 0;
};
function sortBy(func) {
$(`.biglist`).innerHTML = Array.from($$(`.biglist > li`))
.sort(func)
.map(x => x.outerHTML)
.join(``);
}