Add google play download button
This commit is contained in:
parent
3fd228fe77
commit
82343ec0e6
4 changed files with 89 additions and 95 deletions
42
app.css
42
app.css
|
@ -34,8 +34,11 @@ body {
|
||||||
padding: 30px 0;
|
padding: 30px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.header__title {
|
.header__title {
|
||||||
font-size: 60px;
|
|
||||||
font-size: calc(50px + 16 * (100vw - 320px) / (960 - 320));
|
font-size: calc(50px + 16 * (100vw - 320px) / (960 - 320));
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
@ -51,37 +54,26 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
margin: 0 0 50px;
|
width: 800px;
|
||||||
padding: 0 10px;
|
max-width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main p {
|
.section {
|
||||||
line-height: 1.7;
|
margin-top: 40px;
|
||||||
text-align: left;
|
}
|
||||||
|
|
||||||
|
.section__header {
|
||||||
text-shadow: #000 1px 1px 5px;
|
text-shadow: #000 1px 1px 5px;
|
||||||
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main--fluid {
|
.play-button {
|
||||||
margin: 0;
|
display: inline-block;
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main--background {
|
.play-image {
|
||||||
background: rgba(255, 255, 255, 0.8);
|
max-width: 300px;
|
||||||
}
|
|
||||||
|
|
||||||
.main--background p {
|
|
||||||
color: #333;
|
|
||||||
text-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
margin: 0 auto;
|
|
||||||
max-width: 700px;
|
|
||||||
padding: 10px 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
|
@ -94,6 +86,7 @@ body {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
padding: 15px 25px;
|
padding: 15px 25px;
|
||||||
|
text-align: left;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: background 0.3s;
|
transition: background 0.3s;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +126,6 @@ body {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer__item {
|
.footer__item {
|
||||||
|
|
40
app.js
Normal file
40
app.js
Normal 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
BIN
google-play-badge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
86
index.html
86
index.html
|
@ -10,41 +10,43 @@
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-99646499-3"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-99646499-3"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
function gtag() {
|
||||||
gtag('config', 'UA-99646499-3');
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtag("js", new Date());
|
||||||
|
gtag("config", "UA-99646499-3");
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section class="wrapper">
|
<section class="wrapper">
|
||||||
<header id="header" class="header">
|
<div class="container">
|
||||||
|
<header class="header">
|
||||||
<h1 class="header__title">Wulkanowy</h1>
|
<h1 class="header__title">Wulkanowy</h1>
|
||||||
<p class="header__description">Nieoficjalna aplikacja mobilna dla dziennika <br>VULCAN UONET+</p>
|
<p class="header__description">Nieoficjalna aplikacja mobilna dla dziennika <br>VULCAN UONET+</p>
|
||||||
</header>
|
</header>
|
||||||
<main id="main" class="main">
|
<main class="main">
|
||||||
<a
|
<a class="play-button" href="https://play.google.com/store/apps/details?id=io.github.wulkanowy&utm_source=homepage">
|
||||||
id="alfa-button"
|
<img class="play-image" alt="pobierz z Google Play" src="google-play-badge.png">
|
||||||
title="Pobierz wersję alfa"
|
</a>
|
||||||
href="https://github.com/wulkanowy/wulkanowy/releases"
|
<section class="section">
|
||||||
class="button button--alfa"
|
<h3 class="section__header">Więcej opcji</h3>
|
||||||
>Pobierz wersję alfa<br>
|
<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>
|
<span id="alfa-version">v0.0.0</span>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a class="button button--nightly"
|
||||||
id="nightly-button"
|
id="nightly-button"
|
||||||
title="Pobierz wersję nightly"
|
title="Pobierz wersję nightly"
|
||||||
href="https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk"
|
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>
|
||||||
>Pobierz wersję nightly<br>
|
|
||||||
<span id="nightly-version">v000</span>
|
<span id="nightly-version">v000</span>
|
||||||
</a>
|
</a>
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
<footer id="footer" class="footer">
|
<footer id="footer" class="footer">
|
||||||
<a
|
<a title="Zobacz repozytorium na Githubie" href="https://github.com/wulkanowy/wulkanowy" class="github">
|
||||||
title="Zobacz repozytorium na Githubie"
|
|
||||||
href="https://github.com/wulkanowy/wulkanowy"
|
|
||||||
class="github">
|
|
||||||
<img src="./github.svg" alt="Zobacz repozytorium na Githubie">
|
<img src="./github.svg" alt="Zobacz repozytorium na Githubie">
|
||||||
</a>
|
</a>
|
||||||
<ul class="footer__nav">
|
<ul class="footer__nav">
|
||||||
|
@ -53,48 +55,8 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<script>
|
<script src="app.js"></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>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue