Skip to content

Commit

Permalink
Removed mi-5.0 from tree. It lives now in a subfolder beside public_html
Browse files Browse the repository at this point in the history
  • Loading branch information
cnoss committed Jun 25, 2024
1 parent bb8b371 commit 954f3b2
Show file tree
Hide file tree
Showing 1,002 changed files with 11,298 additions and 243,132 deletions.
57 changes: 37 additions & 20 deletions assets/js/news-aggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ function createNews() {
});
}

function cleanItems() {

const cleanData = [];

data.forEach(item => {
item.date = item.date.replace(/T.*/, '');
});
}

function sortItems() {
data.sort(function(a, b) {
console.log(a.date, b.date)
let aTime = new Date(a.date);
let bTime = new Date(b.date);
return bTime - aTime;
Expand All @@ -38,36 +48,43 @@ function createNews() {

function displayItems() {
// only show a couple items
data = data.slice(0, 116);

const news = data.sort(function(a, b) {
const aTime = new Date(a.date);
const bTime = new Date(b.date);
return aTime - bTime;
}).reverse().slice(0, 100);

console.log(news);

target.innerHTML = '';
data.forEach(function (item) {
news.forEach(function (item) {

let external = (!item.url.includes(getCurrentUrl())) ? '<i class="material-icons m-mi-pulse-teaser--external">open_in_new</i>' : '';
let teaserImageCode = '<div class="m-mi-pulse-teaser--image"><img src="' + item.bild + '" alt="'+item.title+'"></div>';
let teaserImage = (item.bild.match(/jpg|jpeg|png|webP|j2/)) ? teaserImageCode : "";
let external = (!item.url.includes(getCurrentUrl())) ? '<i class="material-icons m-mi-pulse-teaser--external">open_in_new</i>' : '';
let teaserImageCode = '<div class="m-mi-pulse-teaser--image"><img src="' + item.bild + '" alt="'+item.title+'"></div>';
let teaserImage = (item.bild.match(/jpg|jpeg|png|webP|j2/)) ? teaserImageCode : "";

target.innerHTML += `
<a href="${item.url}">
<div class="m-mi-pulse-teaser has-image">
${teaserImage}
<div class="m-mi-pulse-teaser--content">
${external}
<h2 class="title">${item.title}</h2>
</div>
<p class="m-mi-pulse-teaser--footer">
${item.termin}
</p>
</div>
</a>`;
});
target.innerHTML += `
<a href="${item.url}">
<div class="m-mi-pulse-teaser has-image">
${teaserImage}
<div class="m-mi-pulse-teaser--content">
${external}
<h2 class="title">${item.title}</h2>
</div>
<p class="m-mi-pulse-teaser--footer">
${item.termin}
</p>
</div>
</a>`;
});
}

newsUrls.forEach(function(url) {
promises.push(getResource(url));
});

Promise.all(promises)
.then(() => cleanItems())
.then(() => sortItems())
.then(() => displayItems());
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions content/events/2024-06-17-kloppe/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Kloppe
linkTitle: asas
termin: "12"
date: 2024-06-20T00:00:00
image: bildschirmfoto-2024-06-17-um-12.26.25.jpg
---
sasas
Loading

0 comments on commit 954f3b2

Please sign in to comment.