Add Safari user-agent detection in Ace useragent lib.

This commit is contained in:
Paulo Reis 2017-04-03 16:24:19 +01:00
parent 335f8f78f0
commit 20732ed571

View file

@ -1350,6 +1350,11 @@ if (typeof navigator != "object")
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
var ua = navigator.userAgent; 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.isWin = (os == "win");
exports.isMac = (os == "mac"); exports.isMac = (os == "mac");
exports.isLinux = (os == "linux"); 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.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
exports.isSafari = safariVersion || undefined;
exports.isAIR = ua.indexOf("AdobeAIR") >= 0; exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
exports.isIPad = ua.indexOf("iPad") >= 0; exports.isIPad = ua.indexOf("iPad") >= 0;