From 203173b62173ca761fae55090412f0443247fd41 Mon Sep 17 00:00:00 2001 From: "bcoles@gmail.com" Date: Fri, 2 Sep 2011 10:56:41 +0000 Subject: [PATCH] Added BlackBerry and Nokia (Symbian/Maemo) OS detection from useragent git-svn-id: https://beef.googlecode.com/svn/trunk@1253 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- core/main/client/os.js | 23 +++++++++++++++++- core/main/constants/os.rb | 4 +++ .../media/images/icons/blackberry.png | Bin 0 -> 372 bytes .../initialization/models/browserdetails.rb | 3 ++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 extensions/admin_ui/media/images/icons/blackberry.png diff --git a/core/main/client/os.js b/core/main/client/os.js index 0318645d0..7d153db26 100644 --- a/core/main/client/os.js +++ b/core/main/client/os.js @@ -81,6 +81,14 @@ beef.os = { return (this.ua.indexOf('iPad') != -1) ? true : false; }, + isNokia: function() { + return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false; + }, + + isBlackBerry: function() { + return (this.ua.indexOf('BlackBerry')) ? true : false; + }, + isQNX: function() { return (this.ua.indexOf('QNX')) ? true : false; }, @@ -102,7 +110,20 @@ beef.os = { if(this.isWinServer2003()) return 'Windows Server 2003'; if(this.isWinVista()) return 'Windows Vista'; if(this.isWin7()) return 'Windows 7'; - + + //Nokia + if(this.isNokia()) { + + if (this.ua.indexOf('Maemo Browser') != -1) return 'Maemo'; + if (this.ua.match('(SymbianOS)|(Symbian OS)')) return 'SymbianOS'; + if (this.ua.indexOf('Symbian') != -1) return 'Symbian'; + + //return 'Nokia'; + } + + // BlackBerry + if(this.isBlackBerry()) return 'BlackBerry OS'; + //linux if(this.isLinux()) return 'Linux'; if(this.isSunOS()) return 'Sun OS'; diff --git a/core/main/constants/os.rb b/core/main/constants/os.rb index 5754c2ac1..ed97f9d4a 100644 --- a/core/main/constants/os.rb +++ b/core/main/constants/os.rb @@ -29,6 +29,8 @@ module Constants OS_MAC_IMG = 'mac.png' OS_IPHONE_UA_STR = 'iPhone' OS_IPHONE_IMG = 'iphone.png' + OS_BLACKBERRY_UA_STR = 'BlackBerry' + OS_BLACKBERRY_IMG = 'blackberry.png' OS_ALL_UA_STR = 'All' def self.match_os(name) @@ -41,6 +43,8 @@ module Constants OS_MAC_UA_STR when /iphone/ OS_IPHONE_UA_STR + when /blackberry/ + OS_BLACKBERRY_UA_STR else 'ALL' end diff --git a/extensions/admin_ui/media/images/icons/blackberry.png b/extensions/admin_ui/media/images/icons/blackberry.png new file mode 100644 index 0000000000000000000000000000000000000000..17c8de66916d68a11305b9397b240ec6ccf261a2 GIT binary patch literal 372 zcmV-)0gL{LP)r(#{h?pbZm|{VM`t9Ia9PJlH&%;<*W3uvp-ALo&Fx6uXRWm$8LSETJZYkqF9% z|6>eDwvfjs_M_@SVoa4 SiXWT+0000