mirror of
https://github.com/Theodor-Springmann-Stiftung/jacoblenz.git
synced 2025-12-16 14:45:31 +00:00
Sortierung der Handschriften
This commit is contained in:
34
.eleventy.js
34
.eleventy.js
@@ -2,24 +2,6 @@ const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
|
|||||||
|
|
||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
|
|
||||||
config.addCollection("handschriften", function(collectionApi) {
|
|
||||||
return collectionApi
|
|
||||||
.getFilteredByGlob("**/lists/handschriften/*.html")
|
|
||||||
.sort(function(a, b) {
|
|
||||||
if (a.data.Jahr !== null && b.data.Jahr !== null &&
|
|
||||||
a.data.Jahr !== b.data.Jahr) {
|
|
||||||
return a.data.Jahr - b.data.Jahr;
|
|
||||||
} else if ( a.data.Autor !== null && b.data.Autor !== null &&
|
|
||||||
a.data.Autor !== b.data.Autor) {
|
|
||||||
return a.data.Autor.localeCompare(b.data.Autor);
|
|
||||||
} else if (a.data.Sort !== null && b.data.Sort !== null &&
|
|
||||||
a.data.Sort !== b.data.Sort) {
|
|
||||||
return a.data.Sort - b.data.Sort;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
config.addCollection("sekundaer", function(collectionApi) {
|
config.addCollection("sekundaer", function(collectionApi) {
|
||||||
return collectionApi
|
return collectionApi
|
||||||
.getFilteredByGlob("**/lists/sekundaerliteratur/*.html")
|
.getFilteredByGlob("**/lists/sekundaerliteratur/*.html")
|
||||||
@@ -86,6 +68,22 @@ module.exports = function (config) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
config.addCollection("handschriften", function(collectionApi) {
|
||||||
|
return collectionApi
|
||||||
|
.getFilteredByGlob("**/lists/handschriften/*.html")
|
||||||
|
.sort(function(a, b) {
|
||||||
|
if ( a.data.Ort !== null && b.data.Ort !== null &&
|
||||||
|
a.data.Ort !== b.data.Ort) {
|
||||||
|
return a.data.Ort.localeCompare(b.data.Ort);
|
||||||
|
} else if (a.data.Sort !== null && b.data.Sort !== null &&
|
||||||
|
a.data.Sort !== b.data.Sort) {
|
||||||
|
return a.data.Sort - b.data.Sort;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
config.setServerOptions({
|
config.setServerOptions({
|
||||||
// Default values are shown:
|
// Default values are shown:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
Ort: [Auzeville, zuletzt Privatbesitz]
|
Ort: Auzeville, zuletzt Privatbesitz
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="gruppe">
|
<div class="gruppe">
|
||||||
|
|||||||
@@ -125,39 +125,57 @@
|
|||||||
let found = dictionary;
|
let found = dictionary;
|
||||||
let sw = "";
|
let sw = "";
|
||||||
let swl = 0;
|
let swl = 0;
|
||||||
|
|
||||||
$("input[name='keyword']").keyup(function() {
|
$("input[name='keyword']").keyup(function() {
|
||||||
var term = $(this).val() || '';
|
var term = $(this).val().trim() || '';
|
||||||
|
|
||||||
if( term ) {
|
if( term ) {
|
||||||
|
// Hide everything tagged hideifseaching
|
||||||
$(".hideifsearching").each( (ind, el) => {
|
$(".hideifsearching").each( (ind, el) => {
|
||||||
$(el).hide();
|
$(el).hide();
|
||||||
});
|
});
|
||||||
if (sw.length > 1) {
|
|
||||||
|
// Unmark everything previously marked
|
||||||
|
if (sw.length > 0) {
|
||||||
for (let item of found) {
|
for (let item of found) {
|
||||||
$(item.element).unmark();
|
$(item.element).unmark();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only search in prior found elements if word starts the same
|
||||||
if (term.length > swl && term.startsWith(sw)) {
|
if (term.length > swl && term.startsWith(sw)) {
|
||||||
found = findWord( term, found );
|
found = findWord( term, found );
|
||||||
} else {
|
} else {
|
||||||
found = findWord( term, dictionary );
|
found = findWord( term, dictionary );
|
||||||
}
|
}
|
||||||
$("#list .category").hide();
|
|
||||||
|
// Hide all categories by default
|
||||||
|
requestAnimationFrame(function() {
|
||||||
|
$("#list .category").hide();
|
||||||
|
});
|
||||||
for (let item of dictionary) {
|
for (let item of dictionary) {
|
||||||
if (found.indexOf(item) !== -1) {
|
if (found.indexOf(item) !== -1) {
|
||||||
$(item.category).addClass("search-expanded").show();
|
requestAnimationFrame(function() {
|
||||||
$(item.element).show();
|
$(item.category).addClass("search-expanded").show();
|
||||||
if (term.length >= 3) {
|
$(item.element).show();
|
||||||
$(item.element).mark(term, {
|
if (term.length >= 3) {
|
||||||
"separateWordSearch": false
|
$(item.element).mark(term, {
|
||||||
});
|
"separateWordSearch": false,
|
||||||
}
|
"acrossElements": true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$(item.element).unmark().hide();
|
requestAnimationFrame(function() {
|
||||||
|
$(item.element).hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sw = term;
|
sw = term;
|
||||||
swl = term.length;
|
swl = term.length;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
$("#list .category").show().removeClass("search-expanded").unmark();
|
$("#list .category").show().removeClass("search-expanded").unmark();
|
||||||
$("#list .searchable").show();
|
$("#list .searchable").show();
|
||||||
found = dictionary;
|
found = dictionary;
|
||||||
|
|||||||
Reference in New Issue
Block a user