[www-doc] [Git][VideoLAN.org/websites][master] Fixup for macOS M1 detection

Jean-Baptiste Kempf gitlab at videolan.org
Mon Jan 18 12:29:07 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN organization / websites


Commits:
b8d757d0 by Jean-Baptiste Kempf at 2021-01-18T13:28:56+01:00
Fixup for macOS M1 detection

- - - - -


1 changed file:

- www.videolan.org/include/os-specific.php


Changes:

=====================================
www.videolan.org/include/os-specific.php
=====================================
@@ -43,7 +43,7 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
     function getOS() {
         var OS="windows"; //Default
 
-       if (navigator.appVersion.indexOf("Win")!=-1) {
+        if (navigator.appVersion.indexOf("Win")!=-1) {
            if (navigator.userAgent.indexOf('Windows NT 5.0') == -1 &&
                navigator.userAgent.indexOf('Windows NT 5.1') == -1 &&
                  (navigator.userAgent.indexOf('Win64')>-1 ||
@@ -72,16 +72,19 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
                    } catch (e) { }
                }
            }
-       }
-       if (navigator.appVersion.indexOf("Mac")!=-1) {
+        }
+
+        //MacOS, MacOS X, macOS
+        if (navigator.appVersion.indexOf("Mac")!=-1) {
           if (navigator.platform.indexOf("MacPPC")!= -1 || navigator.platform.indexOf("PowerPC") != -1 ) {
               OS="osxPPC";
-          } else if (navigator.userAgent.indexOf("OS X 10.5")!=-1) {
+          } else if (navigator.userAgent.indexOf("OS X 10.5")!=-1 ||
+                     navigator.userAgent.indexOf("OS X 10.6")!=-1) {
               OS="osx32";
           } else {
               var glcontext = document.createElement("canvas").getContext("webgl");
               var debugrenderer = glcontext.getExtension('WEBGL_debug_renderer_info');
-              var renderername = d && glcontext.getParameter(d.UNMASKED_RENDERER_WEBGL) || "";
+              var renderername = debugrenderer && glcontext.getParameter(d.UNMASKED_RENDERER_WEBGL) || "";
               if (renderername.match(/Apple/) && !renderername.match(/Apple GPU/)) {
                   OS="osxarm64";
               } else {
@@ -94,7 +97,6 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
               }
           }
        }
-       if (navigator.platform.indexOf("BeOS") !=-1) OS="beos";
        if (navigator.platform.indexOf("Linux")!=-1) {
             if((navigator.userAgent.indexOf("Ubuntu") != -1) ||
                 (navigator.userAgent.indexOf("ubuntu") != -1)) OS="ubuntu";
@@ -107,11 +109,13 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
             else if(navigator.userAgent.indexOf("Gentoo") != -1) OS="gentoo";
             else OS="linux";
        }
+
+      if (navigator.userAgent.indexOf("iPad") != -1 || navigator.userAgent.indexOf("iPhone") != -1 || navigator.userAgent.indexOf("iPod") != -1) {
+            OS="ios";
+      }
+       if (navigator.platform.indexOf("BeOS") !=-1) OS="beos";
        if (navigator.platform.indexOf("freebsd") != -1) OS="freebsd";
        if (navigator.platform.indexOf("FreeBSD") != -1) OS="freebsd";
-       if (navigator.userAgent.indexOf("iPad") != -1 || navigator.userAgent.indexOf("iPhone") != -1 || navigator.userAgent.indexOf("iPod") != -1) {
-            OS="ios";
-       }
        return OS;
     }
 



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/b8d757d08b56b006c884cedd3bde06970d649c6d

-- 
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/b8d757d08b56b006c884cedd3bde06970d649c6d
You're receiving this email because of your account on code.videolan.org.




More information about the www-doc mailing list