[www] Make a distinction between unix, linux, mac, ...

This commit is contained in:
Julian Ospald 2019-03-23 11:23:28 +08:00
parent c902304793
commit 9b2cb028c5
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
3 changed files with 45 additions and 31 deletions

View File

@ -63,7 +63,7 @@ body#idx > * {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
text-align: center; text-align: center;
width: 30em; width: 31em;
} }
body#idx > #pitch { body#idx > #pitch {
@ -88,7 +88,7 @@ body#idx p.other-platforms-help {
background-color: rgb(250, 250, 250); background-color: rgb(250, 250, 250);
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
width: 46rem; width: 45rem;
text-align: center; text-align: center;
border-radius: 3px; border-radius: 3px;
border: 1px solid rgb(204, 204, 204); border: 1px solid rgb(204, 204, 204);
@ -96,7 +96,7 @@ body#idx p.other-platforms-help {
} }
.instructions > * { .instructions > * {
width: 43rem; width: 45rem;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
@ -106,7 +106,9 @@ hr {
margin-bottom: 2em; margin-bottom: 2em;
} }
#platform-instructions-unix > pre, #platform-instructions-linux > pre,
#platform-instructions-mac > pre,
#platform-instructions-freebsd > pre,
#platform-instructions-win32 > pre, #platform-instructions-win32 > pre,
#platform-instructions-win64 > pre, #platform-instructions-win64 > pre,
#platform-instructions-default > div > pre, #platform-instructions-default > div > pre,

View File

@ -1,4 +1,4 @@
var platforms = ["default", "unknown", "win32", "win64", "unix"]; var platforms = ["default", "unknown", "win32", "win64", "linux", "freebsd", "mac"];
var platform_override = null; var platform_override = null;
function detect_platform() { function detect_platform() {
@ -10,41 +10,41 @@ function detect_platform() {
var os = "unknown"; var os = "unknown";
if (navigator.platform == "Linux x86_64") {os = "unix";} if (navigator.platform == "Linux x86_64") {os = "linux";}
if (navigator.platform == "Linux i686") {os = "unix";} if (navigator.platform == "Linux i686") {os = "linux";}
if (navigator.platform == "Linux i686 on x86_64") {os = "unix";} if (navigator.platform == "Linux i686 on x86_64") {os = "linux";}
if (navigator.platform == "Linux aarch64") {os = "unix";} if (navigator.platform == "Linux aarch64") {os = "linux";}
if (navigator.platform == "Linux armv6l") {os = "unix";} if (navigator.platform == "Linux armv6l") {os = "linux";}
if (navigator.platform == "Linux armv7l") {os = "unix";} if (navigator.platform == "Linux armv7l") {os = "linux";}
if (navigator.platform == "Linux armv8l") {os = "unix";} if (navigator.platform == "Linux armv8l") {os = "linux";}
if (navigator.platform == "Linux ppc64") {os = "unix";} if (navigator.platform == "Linux ppc64") {os = "linux";}
if (navigator.platform == "Linux mips") {os = "unix";} if (navigator.platform == "Linux mips") {os = "linux";}
if (navigator.platform == "Linux mips64") {os = "unix";} if (navigator.platform == "Linux mips64") {os = "linux";}
if (navigator.platform == "Mac") {os = "unix";} if (navigator.platform == "Mac") {os = "mac";}
if (navigator.platform == "Win32") {os = "win32";} if (navigator.platform == "Win32") {os = "win32";}
if (navigator.platform == "Win64" || if (navigator.platform == "Win64" ||
navigator.userAgent.indexOf("WOW64") != -1 || navigator.userAgent.indexOf("WOW64") != -1 ||
navigator.userAgent.indexOf("Win64") != -1) { os = "win64"; } navigator.userAgent.indexOf("Win64") != -1) { os = "win64"; }
if (navigator.platform == "FreeBSD x86_64") {os = "unix";} if (navigator.platform == "FreeBSD x86_64") {os = "freebsd";}
if (navigator.platform == "FreeBSD amd64") {os = "unix";} if (navigator.platform == "FreeBSD amd64") {os = "freebsd";}
if (navigator.platform == "NetBSD x86_64") {os = "unix";} // if (navigator.platform == "NetBSD x86_64") {os = "unix";}
if (navigator.platform == "NetBSD amd64") {os = "unix";} // if (navigator.platform == "NetBSD amd64") {os = "unix";}
// I wish I knew by now, but I don't. Try harder. // I wish I knew by now, but I don't. Try harder.
if (os == "unknown") { if (os == "unknown") {
if (navigator.appVersion.indexOf("Win")!=-1) {os = "win32";} if (navigator.appVersion.indexOf("Win")!=-1) {os = "win32";}
if (navigator.appVersion.indexOf("Mac")!=-1) {os = "unix";} if (navigator.appVersion.indexOf("Mac")!=-1) {os = "mac";}
if (navigator.appVersion.indexOf("FreeBSD")!=-1) {os = "unix";} if (navigator.appVersion.indexOf("FreeBSD")!=-1) {os = "freebsd";}
} }
// Firefox Quantum likes to hide platform and appVersion but oscpu works // Firefox Quantum likes to hide platform and appVersion but oscpu works
if (navigator.oscpu) { if (navigator.oscpu) {
if (navigator.oscpu.indexOf("Win32")!=-1) {os = "win32";} if (navigator.oscpu.indexOf("Win32")!=-1) {os = "win32";}
if (navigator.oscpu.indexOf("Win64")!=-1) {os = "win64";} if (navigator.oscpu.indexOf("Win64")!=-1) {os = "win64";}
if (navigator.oscpu.indexOf("Mac")!=-1) {os = "unix";} if (navigator.oscpu.indexOf("Mac")!=-1) {os = "mac";}
if (navigator.oscpu.indexOf("Linux")!=-1) {os = "unix";} if (navigator.oscpu.indexOf("Linux")!=-1) {os = "linux";}
if (navigator.oscpu.indexOf("FreeBSD")!=-1) {os = "unix";} if (navigator.oscpu.indexOf("FreeBSD")!=-1) {os = "freebsd";}
if (navigator.oscpu.indexOf("NetBSD")!=-1) {os = "unix";} // if (navigator.oscpu.indexOf("NetBSD")!=-1) {os = "unix";}
} }
return os; return os;

View File

@ -24,10 +24,22 @@
the general purpose language <a href="https://www.haskell.org/">Haskell</a> the general purpose language <a href="https://www.haskell.org/">Haskell</a>
</p> </p>
<div id="platform-instructions-unix" class="instructions" style="display: none;"> <div id="platform-instructions-linux" class="instructions" style="display: none;">
<p>Run the following in your terminal, then follow the onscreen instructions.</p> <p>Run the following in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre> <pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
<p class="other-platforms-help">You appear to be running Unix. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p> <p class="other-platforms-help">You appear to be running Linux. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
</div>
<div id="platform-instructions-mac" class="instructions" style="display: none;">
<p>Run the following in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
<p class="other-platforms-help">You appear to be running Mac OS X. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
</div>
<div id="platform-instructions-freebsd" class="instructions" style="display: none;">
<p>Run the following in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
<p class="other-platforms-help">You appear to be running FreeBSD. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
</div> </div>
<div id="platform-instructions-win32" class="instructions"> <div id="platform-instructions-win32" class="instructions">
@ -65,7 +77,7 @@
<!-- duplicate the default cross-platform instructions --> <!-- duplicate the default cross-platform instructions -->
<div> <div>
<p>If you are running Unix,<br/>run the following in your terminal, then follow the onscreen instructions.</p> <p>If you are running Linux, Mac OS X or FreeBSD,<br/>run the following in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre> <pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
</div> </div>
@ -82,7 +94,7 @@
<div id="platform-instructions-default" class="instructions"> <div id="platform-instructions-default" class="instructions">
<div> <div>
<p>To install Haskell, if you are running Unix,<br/>run the following <p>To install Haskell, if you are running Linux, Mac OS X or FreeBSD,<br/>run the following
in your terminal, then follow the onscreen instructions.</p> in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre> <pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
</div> </div>
@ -126,7 +138,7 @@
<div id="platform-instructions-default" class="instructions"> <div id="platform-instructions-default" class="instructions">
<div> <div>
<p>To install Haskell, if you are running Unix,<br/>run the following <p>To install Haskell, if you are running Linux, Mac OS X or FreeBSD,<br/>run the following
in your terminal, then follow the onscreen instructions.</p> in your terminal, then follow the onscreen instructions.</p>
<pre>curl https://get-ghcup.haskell.org -sSf | sh</pre> <pre>curl https://get-ghcup.haskell.org -sSf | sh</pre>
</div> </div>