|
59 | 59 | VIERA = 'Viera',
|
60 | 60 | XIAOMI = 'Xiaomi',
|
61 | 61 | ZEBRA = 'Zebra',
|
62 |
| - FACEBOOK = 'Facebook'; |
| 62 | + FACEBOOK = 'Facebook', |
| 63 | + CHROMIUM_OS = 'Chromium OS', |
| 64 | + MAC_OS = 'Mac OS'; |
63 | 65 |
|
64 | 66 | ///////////
|
65 | 67 | // Helper
|
|
715 | 717 | ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
|
716 | 718 | /(mac os x) ?([\w\. ]*)/i,
|
717 | 719 | /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
|
718 |
| - ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ |
| 720 | + ], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [ |
719 | 721 |
|
720 | 722 | // Mobile OSes
|
721 | 723 | /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
|
|
739 | 741 | /crkey\/([\d\.]+)/i // Google Chromecast
|
740 | 742 | ], [VERSION, [NAME, CHROME+'cast']], [
|
741 | 743 | /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
|
742 |
| - ], [[NAME, 'Chromium OS'], VERSION],[ |
| 744 | + ], [[NAME, CHROMIUM_OS], VERSION],[ |
743 | 745 |
|
744 | 746 | // Smart TVs
|
745 | 747 | /panasonic;(viera)/i, // Panasonic Viera
|
|
818 | 820 | if (!_device[TYPE] && _uach && _uach.mobile) {
|
819 | 821 | _device[TYPE] = MOBILE;
|
820 | 822 | }
|
| 823 | + // iPadOS-specific detection: identified as Mac, but has some iOS-only properties |
| 824 | + if (_device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) { |
| 825 | + _device[MODEL] = 'iPad'; |
| 826 | + _device[TYPE] = TABLET; |
| 827 | + } |
821 | 828 | return _device;
|
822 | 829 | };
|
823 | 830 | this.getEngine = function () {
|
|
833 | 840 | _os[VERSION] = undefined;
|
834 | 841 | rgxMapper.call(_os, _ua, _rgxmap.os);
|
835 | 842 | if (!_os[NAME] && _uach && _uach.platform != 'Unknown') {
|
836 |
| - _os[NAME] = _uach.platform.replace(/chrome/i, 'Chromium').replace(/mac/i, 'Mac '); |
| 843 | + _os[NAME] = _uach.platform |
| 844 | + .replace(/chrome os/i, CHROMIUM_OS) |
| 845 | + .replace(/macos/i, MAC_OS); // backward compatibility |
837 | 846 | }
|
838 | 847 | return _os;
|
839 | 848 | };
|
|
0 commit comments