mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2025-12-23 12:33:40 +00:00
Update directory structure
This commit is contained in:
66
view/app/version-history/version-history.js
Normal file
66
view/app/version-history/version-history.js
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// version-history.js
|
||||
// altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
|
||||
//
|
||||
// Copyright (c) 2023 Foxster.
|
||||
// MIT License.
|
||||
//
|
||||
|
||||
import { urlSearchParams, sourceURL } from "../../../common/modules/constants.js";
|
||||
import { insertNavigationBar, formatVersionDate, formatString, open } from "../../../common/modules/utilities.js";
|
||||
import { main } from "../../../common/modules/main.js";
|
||||
import { MoreButton } from "../../../common/components/MoreButton.js";
|
||||
import { VersionHistoryItem } from "../../../common/components/VersionHistoryItem.js";
|
||||
|
||||
const fallbackURL = `../../?source=${sourceURL}`;
|
||||
|
||||
if (!urlSearchParams.has('id')) open(fallbackURL);
|
||||
const bundleId = urlSearchParams.get('id');
|
||||
|
||||
insertNavigationBar("Version History");
|
||||
|
||||
main(json => {
|
||||
const app = getAppWithBundleId(bundleId);
|
||||
if (!app) {
|
||||
open(fallbackURL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set tab title
|
||||
document.title = `Version History - ${app.name}`;
|
||||
|
||||
// Set tint color
|
||||
const tintColor = `#${app.tintColor?.replaceAll("#", "")}`;
|
||||
if (tintColor) document.querySelector(':root').style.setProperty("--app-tint-color", `${tintColor}`);
|
||||
document.getElementById("back").style.color = tintColor;
|
||||
|
||||
const versionsContainer = document.getElementById("versions");
|
||||
if (app.versions) {
|
||||
app.versions.forEach((version, i) => {
|
||||
versionsContainer.insertAdjacentHTML("beforeend",
|
||||
VersionHistoryItem(
|
||||
version.version,
|
||||
formatVersionDate(version.date),
|
||||
formatString(version.localizedDescription),
|
||||
version.downloadURL,
|
||||
i
|
||||
)
|
||||
);
|
||||
});
|
||||
} else {
|
||||
versionsContainer.insertAdjacentHTML("beforeend",
|
||||
VersionHistoryItem(
|
||||
app.version,
|
||||
formatVersionDate(app.versionDate),
|
||||
formatString(app.versionDescription),
|
||||
app.downloadURL,
|
||||
0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
document.querySelectorAll(".version-description").forEach(element => {
|
||||
if (element.scrollHeight > element.clientHeight)
|
||||
element.insertAdjacentHTML("beforeend", MoreButton(tintColor));
|
||||
});
|
||||
}, "../../../");
|
||||
Reference in New Issue
Block a user