wulkanowy.github.io/index.html
2018-05-04 11:42:01 +02:00

90 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico?v=1">
<title>Wulkanowy</title>
<link rel="stylesheet" href="app.css">
<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');
</script>
</head>
<body>
<section class="wrapper">
<header id="header" class="header">
<h1 class="header__title">Wulkanowy</h1>
</header>
<main id="main" class="main">
<a
id="beta-button"
title="Pobierz wersję beta"
href="https://github.com/wulkanowy/wulkanowy/releases"
class="button button--beta"
>Pobierz wersję beta<br>
<span id="beta-version">0.0.0</span>
</a>
<a
id="alfa-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>
<span id="alfa-version">000</span>
</a>
</main>
<footer id="footer" class="footer">
<a
title="Zobacz repozytorium na Githubie"
href="https://github.com/wulkanowy/wulkanowy"
class="github">
<img src="./github.svg" alt="Zobacz repozytorium na Githubie">
</a>
</footer>
</section>
<script>
var disableClick = function(e) {e.preventDefault()};
var betaButton = document.querySelector("#beta-button");
betaButton.addEventListener("click", disableClick);
var betaRes = new XMLHttpRequest();
betaRes.open('GET', 'https://api.github.com/repos/wulkanowy/wulkanowy/releases/latest', true);
betaRes.onloadend = function () {
if(betaRes.status === 200) {
var json = JSON.parse(betaRes.responseText);
betaButton.href = json.assets[0].browser_download_url;
document.querySelector("#beta-version").innerHTML = json.name;
} else {
console.log("Błąd podczas ładowania strony\n");
}
betaButton.removeEventListener("click", disableClick);
};
betaRes.send(null);
var alfaButton = document.querySelector("#alfa-button");
alfaButton.addEventListener("click", disableClick);
var alfaRes = new XMLHttpRequest();
alfaRes.open('GET', 'https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk/info', true);
alfaRes.onloadend = function () {
if(alfaRes.status === 200) {
var json = JSON.parse(alfaRes.responseText);
alfaButton.href = json.url;
document.querySelector("#alfa-version").innerHTML = json.latestVersionCode;
} else {
console.log("Błąd podczas ładowania strony\n");
}
alfaButton.removeEventListener("click", disableClick);
};
alfaRes.send(null);
</script>
</body>
</html>