mreza brez praznih celic (samo polne vrstice po stiri) in relativni cas namesto ISO znacke v bloku Aktuelle Nachrichten
This commit is contained in:
@@ -888,8 +888,10 @@ export default function Home() {
|
||||
clankov += 1;
|
||||
return clankov <= NA_NASLOVNICI;
|
||||
});
|
||||
for (let i = 0; i < omejeno.length; i += 4) {
|
||||
rows.push(omejeno.slice(i, i + 4));
|
||||
// Zadnja vrstica ne sme biti nepopolna, sicer ostanejo prazne celice.
|
||||
const polne = omejeno.slice(0, omejeno.length - (omejeno.length % 4));
|
||||
for (let i = 0; i < polne.length; i += 4) {
|
||||
rows.push(polne.slice(i, i + 4));
|
||||
}
|
||||
return rows;
|
||||
}, [gridItems]);
|
||||
|
||||
+15
-1
@@ -1059,6 +1059,20 @@ export async function registerRoutes(
|
||||
}
|
||||
});
|
||||
|
||||
// Blok pricakuje ze izpisan relativni cas, kakrsnega je prej vracal RSS
|
||||
// parser; brez tega se izpise gola ISO znacka.
|
||||
function relativniCas(iso?: string): string {
|
||||
if (!iso) return "";
|
||||
const t = new Date(iso).getTime();
|
||||
if (!t) return "";
|
||||
const min = Math.max(0, Math.floor((Date.now() - t) / 60000));
|
||||
if (min < 2) return "Gerade eben";
|
||||
if (min < 60) return `vor ${min} Min.`;
|
||||
const ur = Math.floor(min / 60);
|
||||
if (ur < 24) return `vor ${ur} Std.`;
|
||||
return `vor ${Math.floor(ur / 24)} T.`;
|
||||
}
|
||||
|
||||
app.get("/api/breaking-news", async (_req, res) => {
|
||||
// 31. 8. 2026: blok Aktuelle Nachrichten je vodil na tagesschau, n-tv, ORF
|
||||
// in Welt, torej smo obiskovalce posiljali s strani. Zdaj kaze nase novice
|
||||
@@ -1102,7 +1116,7 @@ export async function registerRoutes(
|
||||
title: String(a.title),
|
||||
link: `https://news.folx.tv/${a.slug}`,
|
||||
source: String(a.category || "FOLX NEWS"),
|
||||
pubDate: String(a.publishedAt || ""),
|
||||
pubDate: relativniCas(a.publishedAt),
|
||||
}));
|
||||
if (items.length > 0) setCache(cacheKey, items);
|
||||
res.json(items);
|
||||
|
||||
Reference in New Issue
Block a user