From 801626df8da1ab70aa73f9977f9b10ed28866d69 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Tue, 30 Jul 2019 23:41:26 -0400 Subject: [PATCH] load ubuntu illustration in case of using Linux --- docs/index.html | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 7ca15493..ed1c43b7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,7 +20,7 @@
- +
@@ -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);