Add DEV download page

This commit is contained in:
Mikołaj Pich 2018-06-20 00:26:57 +02:00
parent 629796b128
commit 9088722024
4 changed files with 164 additions and 31 deletions

19
app.css
View file

@ -46,6 +46,10 @@ a {
text-shadow: #000 5px 5px 5px;
}
.header__link {
text-decoration: none;
}
.header__description {
text-shadow: #000 1px 1px 5px;
line-height: 1.7;
@ -135,15 +139,26 @@ a {
justify-content: space-between;
}
.button span[id$="date"] {
.button span[class$="date"] {
color: transparent;
transition: 0.3s color;
}
.button:hover span[id$="date"] {
.button:hover span[class$="date"] {
color: #fff;
}
.button-more__link {
text-decoration: none;
}
.button-more__link:hover,
.button-more__link:focus,
.button-more__link:active
{
text-decoration: underline;
}
.footer {
margin-top: 30px;
text-align: center;

75
app.js
View file

@ -1,11 +1,15 @@
var disableClick = function(e) {e.preventDefault()};
var addButtonInfo = function(url, prefix, cb) {
var buttonElement = document.querySelector("#" + prefix + "-button");
var buttonElement = document.querySelector("." + prefix + "-button");
if (null === buttonElement) {
return;
}
buttonElement.addEventListener("click", disableClick);
var versionElement = document.querySelector("#" + prefix + "-version");
var versionElement = document.querySelector("." + prefix + "-version");
versionElement.innerHTML = "Ładowanie…";
var dateElement = document.querySelector("#" + prefix + "-date");
var dateElement = document.querySelector("." + prefix + "-date");
var res = new XMLHttpRequest();
res.open("GET", url, true);
@ -20,24 +24,71 @@ var addButtonInfo = function(url, prefix, cb) {
res.send(null);
};
addButtonInfo("https://api.github.com/repos/wulkanowy/wulkanowy/releases/latest", "beta",
if (null === document.querySelector(".button-container--list")) {
addButtonInfo("https://api.github.com/repos/wulkanowy/wulkanowy/releases/latest", "beta",
function(res, button, version, date) {
var json = JSON.parse(res.responseText);
button.href = json.assets[0].browser_download_url;
version.innerHTML = "v" + json.name;
date.innerHTML = new Date(json.published_at).toLocaleString("pl-PL");
}
);
);
addButtonInfo("https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk/info", "dev",
addButtonInfo("https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk/info", "dev",
function(res, button, version, date) {
if (null !== document.querySelector(".button-container--list")) return;
var json = JSON.parse(res.responseText);
button.href = json.expiring_download_url;
version.innerHTML = "Build " + json.build_number;
date.innerHTML = new Date(json.finished_at).toLocaleString("pl-PL");
setTimeout(function() {
button.href = json.public_install_page_url;
}, 60 * 1000);
}
);
);
}
(function (d) {
var list = d.querySelector(".button-container--list");
var base = d.querySelector(".button-container--list .button");
if (null === base) return;
var baseCopy = base.cloneNode(true);
base.style.display = "none";
var res = new XMLHttpRequest();
res.open("GET", "https://api.github.com/repos/wulkanowy/wulkanowy/branches", true);
res.onloadend = function () {
if(res.status === 200) {
JSON.parse(res.responseText).forEach(function (item) {
if ("master" === item.name) return;
var url = "https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/" + item.name
+ "/artifacts/app-debug-bitrise-signed.apk";
var branch = baseCopy.cloneNode(true);
branch.href = url;
branch.innerText = item.name;
var button_info = d.createElement("p");
button_info.setAttribute("class", "button__info");
var button_version = d.createElement("span");
button_version.setAttribute("class", "dev-version");
var button_date = d.createElement("span");
button_date.setAttribute("class", "dev-date");
button_info.appendChild(button_version);
button_info.appendChild(button_date);
addButtonInfo(url + "/info", "dev", function(res) {
var json = JSON.parse(res.responseText);
button_version.innerHTML = "Build " + json.build_number;
button_date.innerHTML = new Date(json.finished_at).toLocaleString("pl-PL");
});
branch.appendChild(button_info);
list.appendChild(branch);
})
}
};
res.send(null);
})(document);

60
dev.html Normal file
View file

@ -0,0 +1,60 @@
<!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>Wersje DEV - 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">
<div class="container">
<header class="header">
<h1 class="header__title">
<a class="header__link" href="https://wulkanowy.github.io/">Wulkanowy</a>
</h1>
<p class="header__description">Nieoficjalna aplikacja mobilna <br>ucznia i rodzica <br>dla dziennika VULCAN UONET+</p>
</header>
<main class="main">
<section class="section">
<div class="button-container button-container--list">
<a class="button button--dev dev-button"
title="Pobierz wersję DEV"
href="https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk">
master
<p class="button__info">
<span class="dev-version">Build 0000</span>
<span class="dev-date"></span>
</p>
</a>
</div>
</section>
</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>
<ul class="footer__nav">
<li class="footer__item">
<a class="footer__link" href="https://github.com/wulkanowy">Wszystkie projekty</a>
</li>
</ul>
</footer>
</div>
</section>
<script src="app.js"></script>
</body>
</html>

View file

@ -23,7 +23,9 @@
<section class="wrapper">
<div class="container">
<header class="header">
<h1 class="header__title">Wulkanowy</h1>
<h1 class="header__title">
<a class="header__link" href="https://wulkanowy.github.io/">Wulkanowy</a>
</h1>
<p class="header__description">Nieoficjalna aplikacja mobilna <br>ucznia i rodzica <br>dla dziennika VULCAN UONET+</p>
</header>
<main class="main">
@ -36,22 +38,27 @@
<a class="button button--beta" id="beta-button" title="Pobierz wersję beta" href="https://github.com/wulkanowy/wulkanowy/releases">
Pobierz wersję beta
<p class="button__info">
<span id="beta-version">v0.0.0</span>
<span id="beta-date"></span>
<span class="beta-version">v0.0.0</span>
<span class="beta-date"></span>
</p>
</a>
<p class="button-more">
<a class="button-more__link" href="https://github.com/wulkanowy/wulkanowy/releases">Więcej wersji</a>
</p>
</div>
<div class="button-container">
<a class="button button--dev"
id="dev-button"
<a class="button button--dev dev-button"
title="Pobierz wersję DEV"
href="https://bitrise-redirector.herokuapp.com/v0.1/apps/daeff1893f3c8128/builds/master/artifacts/app-debug-bitrise-signed.apk">
Pobierz wersję DEV
<p class="button__info">
<span id="dev-version">Build 0000</span>
<span id="dev-date"></span>
<span class="dev-version">Build 0000</span>
<span class="dev-date"></span>
</p>
</a>
<p class="button-more">
<a href="dev.html" class="button-more__link">Więcej wersji</a>
</p>
</div>
</section>
</main>