mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2025-12-20 03:13:57 +00:00
Refactor
This commit is contained in:
18
js/news.js
18
js/news.js
@@ -1,6 +1,18 @@
|
||||
//
|
||||
// news.js
|
||||
// altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
|
||||
//
|
||||
// Copyright (c) 2023 Foxster.
|
||||
// MIT License.
|
||||
//
|
||||
|
||||
import { insertNavigationBar } from "./utilities.js";
|
||||
import { NewsItem } from "./components/NewsItem.js";
|
||||
import { main } from "./main.js";
|
||||
|
||||
insertNavigationBar("All News");
|
||||
|
||||
function main(json) {
|
||||
main((json) => {
|
||||
// Set tab title
|
||||
document.title = `News - ${json.name}`;
|
||||
|
||||
@@ -8,5 +20,5 @@ function main(json) {
|
||||
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", newsItemHTML(news)));
|
||||
}
|
||||
json.news.forEach(news => document.getElementById("news").insertAdjacentHTML("beforeend", NewsItem(news)));
|
||||
});
|
||||
Reference in New Issue
Block a user