mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update apiclient
This commit is contained in:
parent
bba5791b88
commit
31a5eef8bc
10 changed files with 462 additions and 54 deletions
66
dashboard-ui/bower_components/emby-webcomponents/browser.js
vendored
Normal file
66
dashboard-ui/bower_components/emby-webcomponents/browser.js
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
define(['isMobile'], function (isMobile) {
|
||||
|
||||
var uaMatch = function (ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(edge)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opr)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(safari)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
var platform_match = /(ipad)/.exec(ua) ||
|
||||
/(iphone)/.exec(ua) ||
|
||||
/(android)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
var browser = match[1] || "";
|
||||
|
||||
if (ua.indexOf("windows phone") != -1 || ua.indexOf("iemobile") != -1) {
|
||||
|
||||
// http://www.neowin.net/news/ie11-fakes-user-agent-to-fool-gmail-in-windows-phone-81-gdr1-update
|
||||
browser = "msie";
|
||||
}
|
||||
else if (ua.indexOf("like gecko") != -1 && ua.indexOf('webkit') == -1 && ua.indexOf('opera') == -1 && ua.indexOf('chrome') == -1 && ua.indexOf('safari') == -1) {
|
||||
browser = "msie";
|
||||
}
|
||||
|
||||
if (browser == 'opr') {
|
||||
browser = 'opera';
|
||||
}
|
||||
|
||||
return {
|
||||
browser: browser,
|
||||
version: match[2] || "0",
|
||||
platform: platform_match[0] || ""
|
||||
};
|
||||
};
|
||||
|
||||
var userAgent = window.navigator.userAgent;
|
||||
var matched = uaMatch(userAgent);
|
||||
var browser = {};
|
||||
|
||||
if (matched.browser) {
|
||||
browser[matched.browser] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
if (matched.platform) {
|
||||
browser[matched.platform] = true;
|
||||
}
|
||||
|
||||
if (!browser.chrome && !browser.msie && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf("webkit") != -1) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
if (isMobile.any) {
|
||||
browser.mobile = true;
|
||||
}
|
||||
|
||||
browser.animate = document.documentElement.animate != null;
|
||||
|
||||
return browser;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue