in assets/download/download_url.js [1049:1245]
DL.getPlatform = function() {
// For more help or data see: "http://www.useragentstring.com".
var av, os, ua, ve = "";
if( navigator.appVersion ) {
av = navigator.appVersion.toLowerCase(); // Get the application version in lower case.
}
if( navigator.platform ) {
os = navigator.platform.toLowerCase(); // Get the platform string in lower case.
}
if( navigator.userAgent ) {
ua = navigator.userAgent.toLowerCase(); // Get the user agent string in lower case.
}
if( navigator.vendor ) {
ve = navigator.vendor.toLowerCase(); // Get the vendor string in lower case.
}
DL.UI_PLATFORM = ""; // Delete previously set string.
DL.UI_PLATFORM_NO_SUP = ""; // Delete previously set string.
DL.PLATFORM = ""; // Delete previously set string.
DL.EXTENSION = ""; // Delete previously set string.
// Add ECMA262-5 array methods if not supported natively.
// To workaround that MSIE 8 and older do not support this function.
if( !( 'indexOf' in Array.prototype ) ) {
Array.prototype.indexOf= function( find, i ) { // 'i' is an optional parameter.
if( i === undefined ) {
i = 0;
}
if( i < 0 ) {
i+= this.length;
}
if( i < 0 ) {
i = 0;
}
for( var n = this.length; i < n; i++ ) {
if( i in this && this[ i ] === find ) {
return i;
}
}
return -1;
};
}
// If the browser's user agent string is set with something, try to recognize its content.
if( ua !== "" ) {
// Recognized but *not supported* platforms/OS, set $DL.UI_PLATFORM_NO_SUP to show it to the user.
// Mobile devices.
if( ve ) {
if( ua.indexOf( "android" ) !== -1 )
if( ua.indexOf( "nexus" ) !== -1 &&
ve.indexOf( "google" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Google Nexus";
}
if( ua.indexOf( "android" ) !== -1 ) {
if( ua.indexOf( "mobile" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Devices (Android)";
}
if( os.indexOf( "arm" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Devices (ARM processor)";
if( ua.indexOf( "blackberry" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Blackberry Smartphones";
if( ua.indexOf( "brew" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Smartphones (BREW)";
if( ua.indexOf( "ce.net" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Windows CE)";
if( ua.indexOf( "galaxy" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Samsung Galaxy";
if( ua.indexOf( "hiptop" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Smartphones (Hiptop)";
if( ua.indexOf( "htc" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "HTC Mobile Devices";
if( ua.indexOf( "ipad" ) !== -1 ||
ua.indexOf( "iphone" ) !== -1 ||
ua.indexOf( "ipod" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Apple iPhone/iPad/iPod";
if( ua.indexOf( "kindle" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Amazon Kindle";
if( ua.indexOf( "lg" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "LG Mobile Devices";
if( ua.indexOf( "nokia" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Nokia)";
if( ua.indexOf( "palm" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Palm OS)";
if( ua.indexOf( "pike" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Pike)";
if( ua.indexOf( "s60" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (S60)";
if( ua.indexOf( "sonyericsson" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Sony/Ericsson Mobile Devices";
if( ua.indexOf( "symbian" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Symbian OS)";
if( ua.indexOf( "symbos" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Symbian OS)";
if( ua.indexOf( "webos" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (Palm webOS)";
if( ua.indexOf( "widerweb" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mobile Phones (WiderWeb)";
if( os.indexOf( "win" ) !== -1 ||
os.indexOf( "windows" ) !== -1 ) {
if( ua.indexOf( "mobile" ) !== -1 ||
ua.indexOf( "phone" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Smartphones (Windows Phone)";
}
// Other platforms.
if( os.indexOf( "aix" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "IBM AIX";
if( os.indexOf( "alphaserver" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "AlphaServer";
if( os.indexOf( "amiga" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "AmigaOS";
if( os.indexOf( "darwin" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Darwin";
if( os.indexOf( "dragonfly" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "DragonFly BSD";
if( os.indexOf( "freebsd" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "FreeBSD (PKG)";
if( os.indexOf( "irix" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "IRIX";
if( os.indexOf( "netbsd" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "NetBSD";
if( ua.indexOf( "nintendo" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Nintendo Game Console";
if( os.indexOf( "openbsd" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "OpenBSD";
if( os.indexOf( "os/2" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "OS/2";
if( os.indexOf( "pcbsd" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "PC-BSD";
if( ua.indexOf( "playstation" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Sony Playstation";
if( ua.indexOf( "psp" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Sony Playstation Portable";
if( os.indexOf( "qnx" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "QNX";
if( os.indexOf( "vms" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "OpenVMS";
if( ua.indexOf( "wii" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Nintendo Wii Game Console";
if( os.indexOf( "x11" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "unknown OS (X11 support)";
// Legacy, no longer supported platforms.
if( ua.indexOf( "power_pc" ) !== -1 ||
ua.indexOf( "ppc" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Mac OS PPC (DMG)";
if( ua.indexOf( "sun4u" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Solaris SPARC (PKG)";
if( os.indexOf( "sunos" ) !== -1 ) DL.UI_PLATFORM_NO_SUP = "Solaris x86 (PKG)";
// If $DL.UI_PLATFORM_NO_SUP is already filled, something was recognized and no more work is needed.
if( DL.UI_PLATFORM_NO_SUP !== "" ) {
ERROR = true;
return DL.UI_PLATFORM_NO_SUP;
}
// Recognized and *supported* platforms/OS, set $DL.UI_PLATFORM to show it to the user.
// Windows?
if( os.indexOf( "win" ) !== -1 ||
os.indexOf( "windows" ) !== -1 ) { DL.UI_PLATFORM = "Windows (EXE)";
DL.PLATFORM = "win32";
DL.EXTENSION = ".exe";
}
// Linux: x86 or x86-64, DEB or RPM?
if( os.indexOf( "linux" ) !== -1 ) {
// 32-bit: DEB or RPM?
if( os.indexOf( "x86" ) !== -1 ||
os.indexOf( "i686" ) !== -1 ||
os.indexOf( "i586" ) !== -1 ||
os.indexOf( "i486" ) !== -1 ||
os.indexOf( "i386" ) !== -1 ||
av.indexOf( "x86" ) !== -1 ||
av.indexOf( "i686" ) !== -1 ||
av.indexOf( "i586" ) !== -1 ||
av.indexOf( "i486" ) !== -1 ||
av.indexOf( "i386" ) !== -1 ) { DL.UI_PLATFORM = "Linux 32-bit (x86) (RPM)";
DL.PLATFORM = "lnx32r";
DL.EXTENSION = ".tar.gz";
if( ua.indexOf( "debian" ) !== -1 ||
ua.indexOf( "iceweasel" ) !== -1 ||
ua.indexOf( "ubuntu" ) !== -1 ) { DL.UI_PLATFORM = "Linux Debian 32-bit (x86) (DEB)";
DL.PLATFORM = "lnx32d";
DL.EXTENSION = ".tar.gz";
}
}
// 64-bit: DEB or RPM?
if( os.indexOf( "_64" ) !== -1 ||
os.indexOf( "-64" ) !== -1 ||
os.indexOf( "x64" ) !== -1 ||
os.indexOf( "amd64" ) !== -1 ||
av.indexOf( "_64" ) !== -1 ||
av.indexOf( "-64" ) !== -1 ||
av.indexOf( "x64" ) !== -1 ||
av.indexOf( "amd64" ) !== -1 ) { DL.UI_PLATFORM = "Linux 64-bit (x86-64) (RPM)";
DL.PLATFORM = "lnx64r";
DL.EXTENSION = ".tar.gz";
if( ua.indexOf( "debian" ) !== -1 ||
ua.indexOf( "iceweasel" ) !== -1 ||
ua.indexOf( "ubuntu" ) !== -1 ) { DL.UI_PLATFORM = "Linux Debian 64-bit (x86-64) (DEB)";
DL.PLATFORM = "lnx64d";
DL.EXTENSION = ".tar.gz";
}
}
}
// Mac OS X?
if( os.indexOf( "mac" ) !== -1 ) { DL.UI_PLATFORM = "OS X 64-bit (x86-64) (DMG)";
DL.PLATFORM = "mac64";
DL.EXTENSION = ".dmg";
// OS X: 10.6 or older?
if( ua.indexOf( "10.6" ) !== -1 ||
ua.indexOf( "10_6" ) !== -1 ||
ua.indexOf( "10.5" ) !== -1 ||
ua.indexOf( "10_5" ) !== -1 ||
ua.indexOf( "10.4" ) !== -1 ||
ua.indexOf( "10_4" ) !== -1 ||
ua.indexOf( "10.3" ) !== -1 ||
ua.indexOf( "10_3" ) !== -1 ) { DL.UI_PLATFORM = "Mac OS X (Version <= 10.6)";
DL.PLATFORM = "mac32";
}
}
}
// If nothing was recognized until now, set $DL.UI_PLATFORM_NO_SUP to show it to the user.
if( DL.UI_PLATFORM === "" ) {
DL.UI_PLATFORM_NO_SUP = l10n.dl_unknown_platform_text;
DL.ERROR = true;
}
return;
}