Listing website (#2)

* Listing website

* landing page

* move button next to entry

* bump minimum tachiyomi version
This commit is contained in:
beerpsi 2024-01-09 23:20:43 +07:00 committed by GitHub
parent 228641d311
commit ec57d18e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 641 additions and 0 deletions

109
extensions/extensions.js Normal file
View File

@ -0,0 +1,109 @@
!function () {
const ENGLISH_DISPLAY_NAMES = new Intl.DisplayNames(["en"], { type: "language" });
function simpleLanguageName(language) {
return language === "all" ? "All" : ENGLISH_DISPLAY_NAMES.of(language);
}
function languageName(language) {
if (language === "all") {
return "All";
}
if (language === "en") {
return "English"
}
const localDisplayNames = new Intl.DisplayNames([language], { type: "language" });
return `${ENGLISH_DISPLAY_NAMES.of(language)} - ${localDisplayNames.of(language)}`;
}
const LoadingStatus = {
Loading: "loading",
Loaded: "loaded",
Error: "error",
}
const NsfwOption = {
All: "all",
Safe: "safe",
Nsfw: "nsfw",
}
document.addEventListener("alpine:init", () => {
Alpine.data("extensionList", () => ({
LoadingStatus,
NsfwOption,
simpleLanguageName,
languageName,
extensions: [],
languages: [],
loading: LoadingStatus.Loading,
filtered: [],
query: "",
selectedLanguages: [],
nsfw: NsfwOption.All,
async init() {
try {
const index = await fetch("/index.min.json").then((e) => e.json());
this.extensions = index.sort((a, b) => {
if ("all" === a.lang && "all" !== b.lang) {
return -1;
}
if ("all" !== a.lang && "all" === b.lang) {
return 1;
}
if ("en" === a.lang && "en" !== b.lang) {
return -1
}
if ("en" === b.lang && "en" !== a.lang) {
return 1;
}
const langA = simpleLanguageName(a.lang);
const langB = simpleLanguageName(b.lang);
return langA.localeCompare(langB) || a.name.localeCompare(b.name);
});
this.languages = [...new Set(this.extensions.map((e) => e.lang))];
this.loading = LoadingStatus.Loaded;
} catch (e) {
console.error(e);
this.loading = LoadingStatus.Error;
}
if (this.filtered.length === 0) {
this.updateFilteredList();
}
this.$nextTick(() => {
window.location.hash && window.location.replace(window.location.hash);
});
},
updateFilteredList() {
this.filtered = this.extensions
.filter(
(e) => !this.query
|| e.name.toLowerCase().includes(this.query.toLowerCase())
|| e.pkg.toLowerCase().includes(this.query.toLowerCase()),
)
.filter(
(e) => this.nsfw === NsfwOption.All
|| (this.nsfw === NsfwOption.Nsfw ? e.nsfw : !e.nsfw),
)
.filter(
(e) =>
!this.selectedLanguages.length || this.selectedLanguages.includes(e.lang)
);
},
}))
});
}()

107
extensions/index.html Normal file
View File

@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex">
<title>Keiyoushi</title>
<meta name="description" content="A repository of unofficial Tachiyomi extensions.">
<meta property="og:title" content="Keiyoushi">
<meta property="og:description" content="A repository of unofficial Tachiyomi extensions.">
<meta property="og:image" content="https://avatars.githubusercontent.com/u/113362897?v=4">
<meta property="og:url" content="https://keiyoushi.github.io/extensions/">
<meta name="theme-color" content="#2e84bf">
<link
rel="stylesheet"
media="(prefers-color-scheme:light)"
href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/themes/light.css"
integrity="sha384-0usmJJJTG5wZwRFlxdECle5gNAqtRYVm8rHBHjGO0+Cpgp83KTGEANVIFUYafjaO"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
media="(prefers-color-scheme:dark)"
href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/themes/dark.css"
onload="document.documentElement.classList.add('sl-theme-dark');"
integrity="sha384-2HpI1Tt4Zv7emgrwKyetd6ouDie+RKolEtNHOdD+KCVHLj1V2fjxryG48h50f0Rw"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="/index.css">
<script async type="module"
src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/shoelace-autoloader.js"
integrity="sha384-ILzDiPYY4je5i95gGzpVe0e88rFqVnoz3i7HPBsRbtEHxfkA7wR8E+PwjCgt1Bin"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.3/dist/cdn.min.js"
integrity="sha384-mPO6U7t0sNHfI1UIWNf5U6FDzprqWgAMKfOGW86JVGCKoU/7HPdy6DwBaWOsi4eV"
crossorigin="anonymous"></script>
<script src="extensions.js"></script>
</head>
<body>
<header class="header">
<p class="header__title">Keiyoushi</p>
<sl-button variant="primary" href="tachiyomi://add-repo?url=https://keiyoushi.github.io/extensions/index.min.json">Add to Tachiyomi</sl-button>
</header>
<div class="description">
Join the <a class="description__anchor" href="https://discord.gg/3FbCpdKbdY">Discord server</a> for support. Make sure to star <a class="description__anchor" href="https://github.com/keiyoushi/extensions">the GitHub repo</a>.
</div>
<div class="sources" x-data="extensionList">
<h1 class="sources__title">Extensions</h1>
<template x-if="loading === LoadingStatus.Loading">
<sl-spinner class="sources__status" style="font-size:3rem"></sl-spinner>
</template>
<template x-if="loading === LoadingStatus.Error">
<div class="sources__status">Could not load extension list.</div>
</template>
<template x-if="loading === LoadingStatus.Loaded">
<div>
<div class="source-search" x-effect="updateFilteredList">
<div class="source-search__nsfw-wrapper">
<span class="source-search__nsfw-label">Show NSFW extensions</span>
<sl-radio-group size="small" name="nsfw" value="all" @sl-change="nsfw = $event.target.value">
<sl-radio-button value="nsfw">Yes</sl-radio-button>
<sl-radio-button value="safe">No</sl-radio-button>
<sl-radio-button value="all">Don't care</sl-radio-button>
</sl-radio-group>
</div>
<sl-input class="source-search__title" placeholder="Search by name or ID..."
x-model="query"></sl-input>
<sl-select class="source-search__language" multiple clearable placeholder="Filter by languages"
@sl-change="selectedLanguages = event.target.value">
<template x-for="(language, index) in languages" :key="index">
<sl-option :value="language" x-text="languageName(language)"></sl-option>
</template>
</sl-select>
</div>
<template x-for="extension in filtered" :key="extension.pkg">
<div class="source" :id="extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')">
<a :href="`#${extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')}`"
class="source__anchor">#</a> <img class="source__icon" :alt="`Icon for ${extension.name}`"
:src="`/icon/${extension.pkg}.png`" loading="lazy" width="42" height="42">
<div class="source__info">
<div class="source__name">
<span x-text="extension.name.split(': ')[1]"></span> <span class="source__version"
x-text="`v${extension.version}`"></span>
<sl-tag x-cloak size="small" variant="danger"
class="content-rating content-rating--nsfw"
x-show="extension.nsfw === 1">18+</sl-tag>
</div>
<div class="source__version" x-text="simpleLanguageName(extension.lang)"></div>
</div>
<sl-button pill size="small" download class="download-button"
:href="`/apk/${extension.apk}`"><sl-icon name="download"></sl-icon></sl-button>
</div>
</template>
</div>
</template>
</div>
<script>
Promise.allSettled(
["sl-button", "sl-select"].map((e) => customElements.whenDefined(e))
)
.then(() => document.body.classList.add("ready"))
</script>
</body>
</html>

347
index.css Normal file
View File

@ -0,0 +1,347 @@
* {
font-family: var(--sl-font-sans)
}
:root {
--sl-color-primary-50: #e2f4fc;
--sl-color-primary-100: #b6e4f6;
--sl-color-primary-200: #88d2f0;
--sl-color-primary-300: #60c0e9;
--sl-color-primary-400: #48b2e5;
--sl-color-primary-500: #3aa5e1;
--sl-color-primary-600: #3598d3;
--sl-color-primary-700: #2e85bf;
--sl-color-primary-800: #2a74ab;
--sl-color-primary-900: #215588;
--sl-input-focus-ring-color: var(--sl-color-primary-200)
}
[x-cloak] {
display: none !important
}
body {
margin: .85rem auto;
max-width: 42rem;
visibility: hidden
}
body.ready {
visibility: visible
}
@media only screen and (max-width:767px) {
body {
max-width: 22rem
}
}
@media only screen and (max-width:376px) {
body {
max-width: 20rem
}
}
.header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
font-size: 1.25rem;
line-height: 1.75rem
}
.header__title {
color: #2e84bf;
font-weight: 600;
padding-bottom: .5rem;
margin-top: .5rem;
margin-bottom: .5rem
}
.description {
padding-top: 0.5rem;
margin-top: 0.25rem;
text-align: center;
}
.description__anchor {
color: #2e84bf;
text-decoration: none
}
.base-url {
margin: .75rem auto;
padding: .75rem 1rem;
border-style: solid;
border-radius: .125rem;
border-width: 1px;
border-color: #60a5fa;
background-color: #eff6ff
}
.base-url__title {
font-weight: 600;
margin: 0;
margin-bottom: .5rem
}
.base-url__url {
margin: 0
}
.sources {
margin: .75rem auto
}
.sources__title {
font-weight: 600;
font-size: 1.875rem;
line-height: 2.25rem;
padding-bottom: 1rem;
margin: 0
}
.sources__status {
display: flex;
align-items: center;
justify-content: center
}
.source-search {
display: flex;
flex-direction: column;
row-gap: .5rem;
margin-bottom: .5rem
}
.source-search__nsfw-wrapper {
display: flex;
flex-direction: row;
align-items: center;
column-gap: .5rem
}
.source-search__nsfw-label {
display: inline-flex;
align-items: center
}
.source {
display: flex;
align-items: center;
padding: .3rem .3rem
}
@media only screen and (min-width:1024px) {
.source {
padding-left: 1.5rem;
padding-right: 1.5rem
}
}
.source:target {
background-color: rgba(46, 132, 191, .25);
border-radius: .5rem;
transition: background-color .5s
}
.source:hover .source__anchor {
opacity: 1
}
.source__anchor {
opacity: 0;
float: left;
margin-top: auto;
margin-bottom: auto;
margin-left: -1.5rem;
padding-left: .5rem;
padding-right: .5rem;
font-size: 1.25rem;
font-weight: 400;
line-height: 1.75rem;
color: #2e84bf
}
.source__anchor:hover {
text-decoration-line: underline
}
.source__icon {
margin-top: auto;
margin-bottom: auto;
display: block;
max-width: 100%;
margin-right: .5rem;
border-radius: .5rem
}
.source__info {
display: flex;
flex: 1 1 0%;
flex-direction: column
}
.source__name {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
gap: .25rem;
font-weight: 600
}
.source__version {
font-size: .875rem;
line-height: 1.25rem;
}
.content-rating::part(base) {
padding: .2rem .26rem;
font-size: .7rem;
width: 1.77rem;
height: 1.18rem;
border-radius: .375rem
}
@media (prefers-color-scheme: light) {
.source__version {
color: rgba(60, 60, 67, .6);
}
.content-rating::part(base) {
color: rgba(60, 60, 67, .6);
}
.content-rating--suggestive::part(base) {
background-color: rgba(255, 204, 0, .3);
}
.content-rating--nsfw::part(base) {
background-color: rgba(255, 59, 48, .3);
}
}
@media (prefers-color-scheme: dark) {
.source__version {
color: rgba(235, 235, 245, .6);
}
.content-rating::part(base) {
color: rgba(235, 235, 245, .6);
}
.content-rating--suggestive::part(base) {
background-color: rgba(255, 214, 10, .3);
}
.content-rating--nsfw::part(base) {
background-color: rgba(255, 69, 58, .3);
}
}
.download-button {
margin: auto auto
}
.download-button::part(base) {
background: rgba(118, 118, 128, .1176470588);
border: none
}
.download-button::part(base):hover {
background: rgba(118, 118, 128, .18)
}
.download-button::part(base):active {
background: rgba(118, 118, 128, .26)
}
.download-button::part(label) {
color: #2e84bf
}
@keyframes fade {
from {
opacity: 1
}
to {
opacity: .25
}
}
.spinner {
position: relative;
display: inline-block;
height: 3.5rem;
width: 3.5rem
}
.spinner>div {
position: absolute;
left: 49%;
top: 43%;
height: 16%;
width: 6%;
border-radius: 50px;
background-color: #78787a;
opacity: 0;
box-shadow: 0 0 3px rgba(0, 0, 0, .2);
animation: fade 1s linear infinite
}
.spinner>div.bar0 {
transform: rotate(0) translate(0, -130%);
animation-delay: 0 s
}
.spinner>div.bar1 {
transform: rotate(45deg) translate(0, -130%);
animation-delay: .125 s
}
.spinner>div.bar2 {
transform: rotate(90deg) translate(0, -130%);
animation-delay: .25 s
}
.spinner>div.bar3 {
transform: rotate(135deg) translate(0, -130%);
animation-delay: .375 s
}
.spinner>div.bar4 {
transform: rotate(180deg) translate(0, -130%);
animation-delay: .5 s
}
.spinner>div.bar5 {
transform: rotate(225deg) translate(0, -130%);
animation-delay: .625 s
}
.spinner>div.bar6 {
transform: rotate(270deg) translate(0, -130%);
animation-delay: .75 s
}
.spinner>div.bar7 {
transform: rotate(315deg) translate(0, -130%);
animation-delay: .875 s
}
code {
font-family: var(--sl-font-mono);
font-size: 0.9125em;
background-color: rgba(0 0 0 / 0.025);
background-blend-mode: darken;
border-radius: var(--docs-border-radius);
padding: 0.125em 0.25em;
}
.sl-theme-dark code {
background-color: rgba(255 255 255 / 0.03);
}

78
index.html Normal file
View File

@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex">
<title>Keiyoushi</title>
<meta name="description" content="A repository of unofficial Tachiyomi extensions.">
<meta property="og:title" content="Keiyoushi">
<meta property="og:description" content="A repository of unofficial Tachiyomi extensions.">
<meta property="og:image" content="https://avatars.githubusercontent.com/u/113362897?v=4">
<meta property="og:url" content="https://keiyoushi.github.io/extensions/">
<meta name="theme-color" content="#2e84bf">
<link
rel="stylesheet"
media="(prefers-color-scheme:light)"
href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/themes/light.css"
integrity="sha384-0usmJJJTG5wZwRFlxdECle5gNAqtRYVm8rHBHjGO0+Cpgp83KTGEANVIFUYafjaO"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
media="(prefers-color-scheme:dark)"
href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/themes/dark.css"
onload="document.documentElement.classList.add('sl-theme-dark');"
integrity="sha384-2HpI1Tt4Zv7emgrwKyetd6ouDie+RKolEtNHOdD+KCVHLj1V2fjxryG48h50f0Rw"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="/index.css">
<script async type="module"
src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/shoelace-autoloader.js"
integrity="sha384-ILzDiPYY4je5i95gGzpVe0e88rFqVnoz3i7HPBsRbtEHxfkA7wR8E+PwjCgt1Bin"
crossorigin="anonymous"></script>
</head>
<body>
<header class="header">
<p class="header__title">Keiyoushi</p>
</header>
<div class="description">
Join the <a class="description__anchor" href="https://discord.gg/3FbCpdKbdY">Discord server</a> for support. Make sure to star <a class="description__anchor" href="https://github.com/keiyoushi/extensions">the GitHub repo</a>.
</div>
<h2 class="header">Guide</h2>
<div>
Tachiyomi v0.15.2+/Tachiyomi Preview r6404+:
<sl-button variant="primary" href="tachiyomi://add-repo?url=https://keiyoushi.github.io/extensions/index.min.json">Add to Tachiyomi</sl-button>
</div>
<div>
<p>TachiyomiSY:</p>
<ol>
<li>Go to More → Settings → Browse</li>
<li>Tap on "Edit repos" and then "Add" button at bottom</li>
<li>Input <code>keiyoushi/extensions</code></li>
<li>Enjoy!</li>
</ol>
</div>
<div>
<p>TachiyomiAZ:</p>
<ol>
<li>Go to Settings → Browse</li>
<li>Tap on "Edit repos" and then "Add" button at bottom</li>
<li>Input <code>keiyoushi/extensions</code></li>
<li>Enjoy!</li>
</ol>
</div>
<div>
<p>If you're not using any of the above, download and update extensions from <a class="description__anchor" href="/extensions">the listing page.</a></p>
</div>
<script>Promise.allSettled([customElements.whenDefined("sl-button")]).then((() => { document.body.classList.add("ready") }))</script>
</body>
</html>