From 518a0323253b7eeeeab4c3019d61b43b022eea64 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 11 Jul 2012 16:30:31 +0200 Subject: [PATCH] detect and support webkit/ios, fixes #96 --- source/Ox.UI/Ox.UI.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/Ox.UI.js b/source/Ox.UI/Ox.UI.js index 2a7ff527..1a0ff6da 100644 --- a/source/Ox.UI/Ox.UI.js +++ b/source/Ox.UI/Ox.UI.js @@ -16,7 +16,7 @@ Ox.load.UI = function(options, callback) { }, { name: 'Chrome', - regexp: /(Chrome|CriOS)\/(\d+)\./, + regexp: /Chrome\/(\d+)\./, url: 'http://www.google.com/chrome/', version: 10 }, @@ -32,6 +32,11 @@ Ox.load.UI = function(options, callback) { url: 'http://www.apple.com/safari/', version: 5 }, + { + name: 'WebKit', + regexp: /AppleWebKit\/(\d+)\./, + version: 534 + }, { name: 'Internet Explorer', url: 'http://windows.microsoft.com/en-US/internet-explorer/products/ie/home', @@ -46,7 +51,7 @@ Ox.load.UI = function(options, callback) { browsers.forEach(function(browser) { var match = browser.regexp && browser.regexp.exec(navigator.userAgent); - if (match && match[match.length - 1] >= browser.version) { + if (match && match[1] >= browser.version) { browserSupported = true; } }); @@ -153,7 +158,10 @@ Ox.load.UI = function(options, callback) { }).join(' '); */ div.addClass('OxError'); - isInternetExplorer ? browsers.pop() : browsers.shift(); + browsers = browsers.filter(function(browser) { + return browser.url; + }); + isInternetExplorer ? browsers.pop() : browsers.shift(); browsers.forEach(function(browser) { browser.src = Ox.PATH + 'Ox.UI/png/browser' + browser.name.replace(' ', '') + '128.png'; Ox.getFile(browser.src, function() {