2019-09-17 17:30:41 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div v-for="extensionGroup in extensions" :key="extensionGroup[0].lang">
|
2019-09-17 22:07:33 +02:00
|
|
|
<h3>{{ langName(extensionGroup[0].lang) }}</h3>
|
2019-09-17 17:30:41 +02:00
|
|
|
<div class="extension" v-for="extension in extensionGroup" :key="extension.apk">
|
|
|
|
<img :src="iconUrl(extension.apk)" width="42" height="42">
|
|
|
|
<div class="extension-text">
|
|
|
|
<div class="upper">
|
|
|
|
<span class="bold">{{ extension.name.split(': ')[1] }}</span>
|
|
|
|
<Badge :text="'v' + extension.version"/>
|
|
|
|
</div>
|
|
|
|
<div class="down">
|
|
|
|
{{ extension.pkg }}
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-25 00:56:23 +02:00
|
|
|
<a
|
|
|
|
:href="apkUrl(extension.apk)"
|
|
|
|
class="button"
|
|
|
|
title="Download APK"
|
|
|
|
download>
|
|
|
|
<font-awesome-icon icon="download" />
|
|
|
|
<span>Download</span>
|
|
|
|
</a>
|
2019-09-17 17:30:41 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-09-18 01:17:47 +02:00
|
|
|
import axios from 'axios';
|
|
|
|
import groupBy from 'lodash.groupby';
|
|
|
|
import sortBy from 'lodash.sortby';
|
|
|
|
import ISO6391 from 'iso-639-1';
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
const EXTENSION_JSON = 'https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/index.json';
|
2019-09-17 17:30:41 +02:00
|
|
|
|
|
|
|
export default {
|
2019-09-25 00:56:23 +02:00
|
|
|
data () {
|
2019-09-17 17:30:41 +02:00
|
|
|
return {
|
|
|
|
extensions: []
|
|
|
|
}
|
|
|
|
},
|
2019-09-25 00:56:23 +02:00
|
|
|
|
2019-09-17 17:30:41 +02:00
|
|
|
methods: {
|
2019-09-17 22:07:33 +02:00
|
|
|
langName: code => code === 'all' ? 'All' : `${ISO6391.getName(code)} (${ISO6391.getNativeName(code)})`,
|
2019-09-17 17:30:41 +02:00
|
|
|
iconUrl (pkg) {
|
2019-09-18 01:17:47 +02:00
|
|
|
const pkgName = pkg.substring(0, pkg.lastIndexOf('.'));
|
|
|
|
return `https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/icon/${pkgName}.png`;
|
2019-09-17 17:30:41 +02:00
|
|
|
},
|
|
|
|
apkUrl: apk => `https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/apk/${apk}`
|
|
|
|
},
|
2019-09-25 00:56:23 +02:00
|
|
|
|
2019-09-17 17:30:41 +02:00
|
|
|
async beforeMount () {
|
2019-09-18 01:17:47 +02:00
|
|
|
const { data } = await axios.get(EXTENSION_JSON);
|
|
|
|
const values = Object.values(groupBy(data, 'lang'));
|
|
|
|
this.$data.extensions = sortBy(values, [g => this.langName(g[0].lang)]);
|
2019-09-17 17:30:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
<style lang="scss">
|
2019-09-17 17:30:41 +02:00
|
|
|
.extension {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 0.4em 0.2em;
|
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
&:not(:last-child) {
|
|
|
|
border-bottom: 1px solid #eaecef;
|
|
|
|
}
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
img {
|
|
|
|
margin-right: 0.5em;
|
|
|
|
}
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
.extension-text {
|
|
|
|
flex: 1;
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
.down {
|
|
|
|
font-size: 0.8rem;
|
|
|
|
font-family: monospace;
|
|
|
|
color: #6c757d;
|
|
|
|
}
|
|
|
|
}
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
.button {
|
|
|
|
display: inline-block;
|
|
|
|
font-size: 0.8em;
|
|
|
|
color: #fff;
|
|
|
|
background-color: #2e84bf;
|
2019-09-25 00:56:23 +02:00
|
|
|
padding: 0.5rem;
|
2019-09-18 01:17:47 +02:00
|
|
|
border-radius: 4px;
|
|
|
|
transition: background-color 0.1s ease;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border-bottom: 1px solid #2977ac;
|
|
|
|
text-transform: uppercase;
|
2019-09-17 17:30:41 +02:00
|
|
|
|
2019-09-18 01:17:47 +02:00
|
|
|
&:hover {
|
|
|
|
background-color: #3992cf;
|
|
|
|
text-decoration: none !important;
|
|
|
|
}
|
2019-09-25 00:56:23 +02:00
|
|
|
|
|
|
|
svg + span {
|
|
|
|
margin-left: 0.25rem;
|
|
|
|
}
|
2019-09-18 01:17:47 +02:00
|
|
|
}
|
2019-09-17 17:30:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 767px) {
|
2019-09-25 00:56:23 +02:00
|
|
|
.extension {
|
|
|
|
.extension-text .down, .button span {
|
|
|
|
display: none;
|
|
|
|
}
|
2019-09-17 17:30:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|