|
58 | 58 | SONY = 'Sony',
|
59 | 59 | XIAOMI = 'Xiaomi',
|
60 | 60 | ZEBRA = 'Zebra',
|
61 |
| - FACEBOOK = 'Facebook'; |
| 61 | + FACEBOOK = 'Facebook', |
| 62 | + CHROMIUM_OS = 'Chromium OS', |
| 63 | + MAC_OS = 'Mac OS'; |
62 | 64 |
|
63 | 65 | ///////////
|
64 | 66 | // Helper
|
|
721 | 723 | ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
|
722 | 724 | /(mac os x) ?([\w\. ]*)/i,
|
723 | 725 | /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
|
724 |
| - ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ |
| 726 | + ], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [ |
725 | 727 |
|
726 | 728 | // Mobile OSes
|
727 | 729 | /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
|
|
745 | 747 | /crkey\/([\d\.]+)/i // Google Chromecast
|
746 | 748 | ], [VERSION, [NAME, CHROME+'cast']], [
|
747 | 749 | /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
|
748 |
| - ], [[NAME, 'Chromium OS'], VERSION],[ |
| 750 | + ], [[NAME, CHROMIUM_OS], VERSION],[ |
749 | 751 |
|
750 | 752 | // Smart TVs
|
751 | 753 | /panasonic;(viera)/i, // Panasonic Viera
|
|
887 | 889 | if (!_device[TYPE] && _uach && _uach.mobile) {
|
888 | 890 | _device[TYPE] = MOBILE;
|
889 | 891 | }
|
| 892 | + // iPadOS-specific detection: identified as Mac, but has some iOS-only properties |
| 893 | + if (_device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) { |
| 894 | + _device[MODEL] = 'iPad'; |
| 895 | + _device[TYPE] = TABLET; |
| 896 | + } |
890 | 897 | return _device;
|
891 | 898 | };
|
892 | 899 | this.getEngine = function () {
|
|
899 | 906 | rgxMapper.call(_os, _ua, _rgxmap.os);
|
900 | 907 | if (!_os[NAME] && _uach && _uach.platform != 'Unknown') {
|
901 | 908 | _os[NAME] = _uach.platform
|
902 |
| - .replace(/chrome os/i, 'Chromium OS') |
903 |
| - .replace(/macos/i, 'Mac OS'); // backward compatibility |
| 909 | + .replace(/chrome os/i, CHROMIUM_OS) |
| 910 | + .replace(/macos/i, MAC_OS); // backward compatibility |
904 | 911 | }
|
905 | 912 | return _os;
|
906 | 913 | };
|
|
0 commit comments