load ubuntu illustration in case of using Linux

This commit is contained in:
Nicolas Constant 2019-07-30 23:41:26 -04:00
parent d3eb7073f7
commit 801626df8d
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 31 additions and 1 deletions

View File

@ -20,7 +20,7 @@
<div class="row">
<div class="col-1-of-2">
<img class="header__image" src="images/sengi_image.png" />
<img id="main-illustration" class="header__image" src="images/sengi_image.png" />
</div>
<div class="col-1-of-2">
<div class="header__download-box">
@ -216,6 +216,29 @@
return myJson;
}
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
iosPlatforms = ['iPhone', 'iPad', 'iPod'],
os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = 'Mac OS';
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = 'iOS';
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = 'Windows';
} else if (/Android/.test(userAgent)) {
os = 'Android';
} else if (!os && /Linux/.test(platform)) {
os = 'Linux';
}
return os;
}
document.addEventListener('DOMContentLoaded', async function () {
let lastRelease = await getLastRelease();
let version = lastRelease.tag_name;
@ -233,6 +256,13 @@
document.getElementById('mac').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-mac.dmg`;
document.getElementById('deb').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-linux.deb`;
document.getElementById('appimage').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-linux.AppImage`;
let userOs = getOS();
if(userOs === 'Linux'){
var illustration = document.getElementById('main-illustration');
illustration.src = 'images/sengi_image_ubuntu.png';
}
}, false);
</script>
</body>