This commit is contained in:
Pupil
2020-02-04 14:47:54 +09:00
parent b7c6735975
commit 95922b1fce
5 changed files with 63 additions and 10 deletions

View File

@@ -12,10 +12,7 @@ google_analytics: UA-119938781-2
disqus_url: "https://pupil.disqus.com"
discord_url: "https://discord.gg/Stj4b5v"
github:
latest_url: "https://github.com/tom5079/Pupil/releases/download/4.3-hotfix1/Pupil-v4.3-hotfix1.apk"
release_url: "https://github.com/tom5079/Pupil/releases/"
issue_url: "https://github.com/tom5079/Pupil/issues/"
github_url: "https://github.com/tom5079/Pupil"
t:
en:

View File

@@ -2,6 +2,8 @@
<html lang="{{ site.lang | default: " en-US " }}">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://kit.fontawesome.com/695c47bd28.js" crossorigin="anonymous"></script>
{% if site.google_analytics %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
@@ -46,16 +48,33 @@
})();
</script>
<script type='text/javascript' src='/Pupil/assets/js/pupil.js'></script>
<script>
Promise.resolve()
.then(getLatestRelease)
.then(result => {
let url = result["assets"][0]["browser_download_url"];
$("#download-btn").attr("href", url)
})
.catch(err => {
console.log(err)
})
</script>
</head>
<body>
<header class="page-header" role="banner">
<a href="https://tom5079.github.io/Pupil" style="text-decoration:none; color:inherit;"><h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1></a>
<h2 class="project-tagline">{{ site.t[page.lang].header.description }}</h2>
<a href="{{ site.github.latest_url }}" class="btn">{{ site.t[page.lang].header.download }}</a>
<a href="{{ site.github.issue_url }}" target="_blank" class="btn">{{ site.t[page.lang].header.issue }}</a> {{ site.t[page.lang].header.or }}
<a href="mailto:pupil.hentai@gmail.com" class="btn">{{ site.t[page.lang].header.email }}</a>
<a href="{{ site.discord_url }}" class="btn">{{ site.t[page.lang].header.discord }}</a>
<a id="download-btn" class="btn">{{ site.t[page.lang].header.download }}</a>
<p/>
<div class="wrap">
<a href="{{ site.github_url }}"><i class="fab fa-github"></i></a>
<a href="mailto:pupil.hentai@gmail.com"><i class="fas fa-envelope"></i></a>
<a href="{{ site.discord_url }}"><i class="fab fa-discord"></i></a>
</div>
</header>
<main id="content" class="main-content" role="main">

View File

@@ -10,6 +10,21 @@ img + br + em {
}
.center {
display: block;
margin: auto;
display: block;
margin: auto;
}
.wrap {
display: flex;
justify-content: center;
align-items: center;
}
.wrap > * {
margin: 0 1rem;
}
.fab, .fas {
font-size: 32px;
color: white;
}

BIN
assets/images/github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

22
assets/js/pupil.js Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
const LATEST_URL = "https://api.github.com/repos/tom5079/Pupil/releases/latest";
function getLatestRelease() {
return new Promise(function(resolve, reject) {
const xhr = new XMLHttpRequest();
xhr.open("GET", LATEST_URL)
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
resolve(JSON.parse(xhr.responseText))
} else {
reject(new Error('XHR failed on getLAtestRelease() with status ' + xhr.status))
}
}
};
xhr.send();
})
}