Add google play download button

This commit is contained in:
Mikołaj Pich 2018-05-08 17:14:30 +02:00
parent 3fd228fe77
commit 82343ec0e6
4 changed files with 89 additions and 95 deletions

42
app.css
View file

@ -34,8 +34,11 @@ body {
padding: 30px 0;
}
.container {
padding: 10px 20px;
}
.header__title {
font-size: 60px;
font-size: calc(50px + 16 * (100vw - 320px) / (960 - 320));
font-weight: normal;
margin-bottom: 20px;
@ -51,37 +54,26 @@ body {
}
.main {
margin: 0 0 50px;
padding: 0 10px;
width: 800px;
max-width: 100%;
text-align: center;
}
.main p {
line-height: 1.7;
text-align: left;
.section {
margin-top: 40px;
}
.section__header {
text-shadow: #000 1px 1px 5px;
font-weight: normal;
}
.main--fluid {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
.play-button {
display: inline-block;
}
.main--background {
background: rgba(255, 255, 255, 0.8);
}
.main--background p {
color: #333;
text-shadow: none;
}
.container {
margin: 0 auto;
max-width: 700px;
padding: 10px 20px;
.play-image {
max-width: 300px;
}
.button {
@ -94,6 +86,7 @@ body {
display: inline-block;
font-size: 20px;
padding: 15px 25px;
text-align: left;
text-decoration: none;
transition: background 0.3s;
}
@ -133,7 +126,6 @@ body {
margin-top: 30px;
list-style: none;
padding: 0;
display: flex;
}
.footer__item {

40
app.js Normal file
View file

@ -0,0 +1,40 @@
var disableClick = function(e) {e.preventDefault()};
var addButtonInfo = function(url, button, version, cb) {
var buttonElement = document.querySelector(button);
buttonElement.addEventListener("click", disableClick);
var versionElement = document.querySelector(version);
versionElement.innerHTML = "Ładowanie…";
var res = new XMLHttpRequest();
res.open("GET", url, true);
res.onloadend = function () {
if(res.status === 200) {
cb(buttonElement, versionElement, res);
} else {
versionElement.innerHTML = "wersja nieznana";
}
buttonElement.removeEventListener("click", disableClick);
};
res.send(null);
};
addButtonInfo("https://api.github.com/repos/wulkanowy/wulkanowy/releases/latest", "#alfa-button", "#alfa-version",
function(button, version, res) {
var json = JSON.parse(res.responseText);
button.href = json.assets[0].browser_download_url;
version.innerHTML = "v" + json.name;
}
);
addButtonInfo("https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk/info", "#nightly-button", "#nightly-version",
function(button, version, res) {
var json = JSON.parse(res.responseText);
button.href = json.expiring_download_url;
version.innerHTML = "v" + json.build_number;
setTimeout(function() {
button.href = json.public_install_page_url;
}, 60 * 1000);
}
);

BIN
google-play-badge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -10,41 +10,43 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-99646499-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-99646499-3');
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-99646499-3");
</script>
</head>
<body>
<section class="wrapper">
<header id="header" class="header">
<div class="container">
<header class="header">
<h1 class="header__title">Wulkanowy</h1>
<p class="header__description">Nieoficjalna aplikacja mobilna dla dziennika <br>VULCAN UONET+</p>
</header>
<main id="main" class="main">
<a
id="alfa-button"
title="Pobierz wersję alfa"
href="https://github.com/wulkanowy/wulkanowy/releases"
class="button button--alfa"
>Pobierz wersję alfa<br>
<main class="main">
<a class="play-button" href="https://play.google.com/store/apps/details?id=io.github.wulkanowy&amp;utm_source=homepage">
<img class="play-image" alt="pobierz z Google Play" src="google-play-badge.png">
</a>
<section class="section">
<h3 class="section__header">Więcej opcji</h3>
<a class="button button--alfa" id="alfa-button" title="Pobierz wersję alfa" href="https://github.com/wulkanowy/wulkanowy/releases">
Pobierz wersję alfa<br>
<span id="alfa-version">v0.0.0</span>
</a>
<a
<a class="button button--nightly"
id="nightly-button"
title="Pobierz wersję nightly"
href="https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk"
class="button button--nightly"
>Pobierz wersję nightly<br>
href="https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk">
Pobierz wersję nightly<br>
<span id="nightly-version">v000</span>
</a>
</section>
</main>
<footer id="footer" class="footer">
<a
title="Zobacz repozytorium na Githubie"
href="https://github.com/wulkanowy/wulkanowy"
class="github">
<a title="Zobacz repozytorium na Githubie" href="https://github.com/wulkanowy/wulkanowy" class="github">
<img src="./github.svg" alt="Zobacz repozytorium na Githubie">
</a>
<ul class="footer__nav">
@ -53,48 +55,8 @@
</li>
</ul>
</footer>
</div>
</section>
<script>
var disableClick = function(e) {e.preventDefault()};
var addButtonInfo = function(url, button, version, cb) {
var buttonElement = document.querySelector(button);
buttonElement.addEventListener("click", disableClick);
var versionElement = document.querySelector(version);
versionElement.innerHTML = "Ładowanie…";
var res = new XMLHttpRequest();
res.open('GET', url, true);
res.onloadend = function () {
if(res.status === 200) {
cb(buttonElement, versionElement, res);
} else {
versionElement.innerHTML = 'wersja nieznana';
}
buttonElement.removeEventListener("click", disableClick);
};
res.send(null);
};
addButtonInfo("https://api.github.com/repos/wulkanowy/wulkanowy/releases/latest", "#alfa-button", "#alfa-version",
function(button, version, res) {
var json = JSON.parse(res.responseText);
button.href = json.assets[0].browser_download_url;
version.innerHTML = "v" + json.name;
}
);
addButtonInfo("https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk/info", "#nightly-button", "#nightly-version",
function(button, version, res) {
var json = JSON.parse(res.responseText);
button.href = json.expiring_download_url;
version.innerHTML = "v" + json.build_number;
setTimeout(function() {
button.href = json.public_install_page_url;
}, 60 * 1000);
}
)
</script>
<script src="app.js"></script>
</body>
</html>