Update directory structure

This commit is contained in:
foxster-mp4
2023-11-23 23:08:55 -08:00
parent 326de11f38
commit 22e3bcec0f
40 changed files with 364 additions and 272 deletions

View File

@@ -0,0 +1,30 @@
<!--
version-history/index.html
altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
Copyright (c) 2023 Foxster.
MIT License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../../common/style.css">
<link rel="stylesheet" href="version-history.css">
</head>
<body class="loading">
<div id="loading">
<img src="../../../common/assets/img/loading.gif" alt="loading">
<p>Loading</p>
</div>
<!-- Add to AltStore banner & navigation bar -->
<div id="top"></div>
<div id="main">
<div id="versions"></div>
</div>
<script src="version-history.js" type="module"></script>
</body>
</html>

View File

@@ -0,0 +1,69 @@
/*
version-history.css
altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
Copyright (c) 2023 Foxster.
MIT License.
*/
#main {
padding-top: 8rem;
}
a {
color: var(--app-tint-color);
}
#versions {
padding: 0 1rem;
display: flex;
flex-direction: column;
/* gap: 1em; */
}
.version {
display: flex;
flex-direction: column;
border-bottom: 0.1px solid var(--color-separator);
padding: 1.25em 0;
}
.version:first-of-type {
padding-top: 0;
}
@media (prefers-color-scheme: dark) {
.version {
border-color: var(--color-separator-dark) !important;
}
}
.version-header, .version-options {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 0.5em;
}
.version-options {
color: var(--app-tint-color);
}
.version-number {
font-weight: 600;
}
.version-date {
opacity: 0.5;
}
.version-description {
-webkit-line-clamp: 3;
line-clamp: 3;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
position: relative;
word-wrap: break-word;
/* line-height: 1.5em; */
}

View 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));
});
}, "../../../");