mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2026-01-06 01:34:22 +00:00
Update directory structure
This commit is contained in:
24
view/news/news.js
Normal file
24
view/news/news.js
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// news.js
|
||||
// altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
|
||||
//
|
||||
// Copyright (c) 2023 Foxster.
|
||||
// MIT License.
|
||||
//
|
||||
|
||||
import { insertNavigationBar } from "../../common/modules/utilities.js";
|
||||
import { NewsItem } from "../../common/components/NewsItem.js";
|
||||
import { main } from "../../common/modules/main.js";
|
||||
|
||||
insertNavigationBar("All News");
|
||||
|
||||
main(json => {
|
||||
// Set tab title
|
||||
document.title = `News - ${json.name}`;
|
||||
|
||||
// Sort news by latest
|
||||
json.news.sort((a, b) => (new Date(b.date)).valueOf() - (new Date(a.date)).valueOf());
|
||||
|
||||
// Create & insert news items
|
||||
json.news.forEach(news => document.getElementById("news").insertAdjacentHTML("beforeend", NewsItem(news)));
|
||||
});
|
||||
Reference in New Issue
Block a user