|
451 | 451 | 'Google': { 'Google TV': 1, 'Nexus': 1 }, |
452 | 452 | 'HP': { 'TouchPad': 1 }, |
453 | 453 | 'HTC': {}, |
| 454 | + 'Huawei': {}, |
| 455 | + 'Lenovo': {}, |
454 | 456 | 'LG': {}, |
455 | 457 | 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, |
456 | 458 | 'Motorola': { 'Xoom': 1 }, |
457 | 459 | 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, |
458 | 460 | 'Nokia': { 'Lumia': 1 }, |
| 461 | + 'Oppo': {}, |
459 | 462 | 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, |
460 | | - 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 } |
| 463 | + 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }, |
| 464 | + 'Xiaomi': { 'Mi': 1, 'Redmi': 1 } |
461 | 465 | }); |
462 | 466 |
|
463 | 467 | /* Detectable operating systems (order is important). */ |
|
624 | 628 | // Convert layout to an array so we can add extra details. |
625 | 629 | layout && (layout = [layout]); |
626 | 630 |
|
627 | | - // Detect product names that contain their manufacturer's name. |
628 | | - if (manufacturer && !product) { |
629 | | - product = getProduct([manufacturer]); |
630 | | - } |
631 | | - // Clean up Google TV. |
632 | | - if ((data = /\bGoogle TV\b/.exec(product))) { |
633 | | - product = data[0]; |
634 | | - } |
635 | | - // Detect simulators. |
636 | | - if (/\bSimulator\b/i.test(ua)) { |
637 | | - product = (product ? product + ' ' : '') + 'Simulator'; |
638 | | - } |
639 | 631 | // Detect Android products. |
640 | 632 | // Browsers on Android devices typically provide their product IDS after "Android;" |
641 | 633 | // up to "Build" or ") AppleWebKit". |
|
649 | 641 | .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') |
650 | 642 | || null; |
651 | 643 | } |
| 644 | + // Detect product names that contain their manufacturer's name. |
| 645 | + if (manufacturer && !product) { |
| 646 | + product = getProduct([manufacturer]); |
| 647 | + } else if (manufacturer && product) { |
| 648 | + product = product |
| 649 | + .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ') |
| 650 | + .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2'); |
| 651 | + } |
| 652 | + // Clean up Google TV. |
| 653 | + if ((data = /\bGoogle TV\b/.exec(product))) { |
| 654 | + product = data[0]; |
| 655 | + } |
| 656 | + // Detect simulators. |
| 657 | + if (/\bSimulator\b/i.test(ua)) { |
| 658 | + product = (product ? product + ' ' : '') + 'Simulator'; |
| 659 | + } |
652 | 660 | // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS. |
653 | 661 | if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) { |
654 | 662 | description.push('running in Turbo/Uncompressed mode'); |
|
0 commit comments