This commit is contained in:
j 2024-10-13 17:20:33 +01:00
parent f4bfe9294b
commit e7ede6ade0
2 changed files with 6 additions and 3 deletions

View file

@ -129,7 +129,10 @@ async function loadData(id, args) {
<span class="icon">${icon.down}</span> <span class="icon">${icon.down}</span>
${layerData.title} ${layerData.title}
</h3>`) </h3>`)
data.layers[layer] = sortBy(data.layers[layer], ["+in", "+created"]) data.layers[layer] = sortBy(data.layers[layer], [
{key: "in", operator: "+"},
{key: "created", operator: "+"}
])
data.layers[layer].forEach(annotation => { data.layers[layer].forEach(annotation => {
if (pandora.url) { if (pandora.url) {
annotation.value = annotation.value.replace( annotation.value = annotation.value.replace(

View file

@ -199,10 +199,10 @@ function sortBy(array, by, map) {
while (ret == 0 && index < by.length) { while (ret == 0 && index < by.length) {
key = by[index].key; key = by[index].key;
aValue = getSortValue( aValue = getSortValue(
map[key] ? map[key](a[key], a) : a[key] map && map[key] ? map[key](a[key], a) : a[key]
); );
bValue = getSortValue( bValue = getSortValue(
map[key] ? map[key](b[key], b) : b[key] map && map[key] ? map[key](b[key], b) : b[key]
); );
if ((aValue === null) != (bValue === null)) { if ((aValue === null) != (bValue === null)) {
ret = aValue === null ? 1 : -1; ret = aValue === null ? 1 : -1;