From 20732ed5714c839e148867fd53b644e11115fc32 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 3 Apr 2017 16:24:19 +0100 Subject: [PATCH] Add Safari user-agent detection in Ace useragent lib. --- services/web/public/js/ace-1.2.5/ace.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index 89bef3543d..dcac19be31 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -1350,6 +1350,11 @@ if (typeof navigator != "object") var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); var ua = navigator.userAgent; + +var safariRegex = /version\/([\w\.]+).+?(mobile\s?safari|safari)/i; +var safariResult = ua.match(safariRegex); +var safariVersion = safariResult ? parseFloat(safariResult[1]) : 0; + exports.isWin = (os == "win"); exports.isMac = (os == "mac"); exports.isLinux = (os == "linux"); @@ -1366,6 +1371,8 @@ exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined; +exports.isSafari = safariVersion || undefined; + exports.isAIR = ua.indexOf("AdobeAIR") >= 0; exports.isIPad = ua.indexOf("iPad") >= 0;