Merge pull request #1600 from Camc314/migrate-to-ES6-39
Migration of itemDetails/index, browser and itemHelper to ES6 module
This commit is contained in:
commit
4aaab833a3
5 changed files with 742 additions and 705 deletions
|
@ -119,6 +119,7 @@
|
||||||
"src/components/imageUploader/imageUploader.js",
|
"src/components/imageUploader/imageUploader.js",
|
||||||
"src/components/indicators/indicators.js",
|
"src/components/indicators/indicators.js",
|
||||||
"src/components/itemContextMenu.js",
|
"src/components/itemContextMenu.js",
|
||||||
|
"src/components/itemHelper.js",
|
||||||
"src/components/itemidentifier/itemidentifier.js",
|
"src/components/itemidentifier/itemidentifier.js",
|
||||||
"src/components/itemMediaInfo/itemMediaInfo.js",
|
"src/components/itemMediaInfo/itemMediaInfo.js",
|
||||||
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
||||||
|
@ -199,6 +200,7 @@
|
||||||
"src/controllers/dashboard/users/userparentalcontrol.js",
|
"src/controllers/dashboard/users/userparentalcontrol.js",
|
||||||
"src/controllers/dashboard/users/userpasswordpage.js",
|
"src/controllers/dashboard/users/userpasswordpage.js",
|
||||||
"src/controllers/dashboard/users/userprofilespage.js",
|
"src/controllers/dashboard/users/userprofilespage.js",
|
||||||
|
"src/controllers/itemDetails/index.js",
|
||||||
"src/controllers/playback/queue/index.js",
|
"src/controllers/playback/queue/index.js",
|
||||||
"src/controllers/playback/video/index.js",
|
"src/controllers/playback/video/index.js",
|
||||||
"src/controllers/searchpage.js",
|
"src/controllers/searchpage.js",
|
||||||
|
@ -248,6 +250,7 @@
|
||||||
"src/plugins/youtubePlayer/plugin.js",
|
"src/plugins/youtubePlayer/plugin.js",
|
||||||
"src/scripts/alphanumericshortcuts.js",
|
"src/scripts/alphanumericshortcuts.js",
|
||||||
"src/scripts/autoBackdrops.js",
|
"src/scripts/autoBackdrops.js",
|
||||||
|
"src/scripts/browser.js",
|
||||||
"src/scripts/datetime.js",
|
"src/scripts/datetime.js",
|
||||||
"src/scripts/deleteHelper.js",
|
"src/scripts/deleteHelper.js",
|
||||||
"src/scripts/dfnshelper.js",
|
"src/scripts/dfnshelper.js",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
define(['apphost', 'globalize'], function (appHost, globalize) {
|
import appHost from 'apphost';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
|
||||||
function getDisplayName(item, options = {}) {
|
export function getDisplayName(item, options = {}) {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
throw new Error('null item passed into getDisplayName');
|
throw new Error('null item passed into getDisplayName');
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
item = item.ProgramInfo || item;
|
item = item.ProgramInfo || item;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = ((item.Type === 'Program' || item.Type === 'Recording') && (item.IsSeries || item.EpisodeTitle) ? item.EpisodeTitle : item.Name) || '';
|
let name = ((item.Type === 'Program' || item.Type === 'Recording') && (item.IsSeries || item.EpisodeTitle) ? item.EpisodeTitle : item.Name) || '';
|
||||||
|
|
||||||
if (item.Type === 'TvChannel') {
|
if (item.Type === 'TvChannel') {
|
||||||
if (item.ChannelNumber) {
|
if (item.ChannelNumber) {
|
||||||
|
@ -21,10 +21,10 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
if (item.Type === 'Episode' && item.ParentIndexNumber === 0) {
|
if (item.Type === 'Episode' && item.ParentIndexNumber === 0) {
|
||||||
name = globalize.translate('ValueSpecialEpisodeName', name);
|
name = globalize.translate('ValueSpecialEpisodeName', name);
|
||||||
} else if ((item.Type === 'Episode' || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null && options.includeIndexNumber !== false) {
|
} else if ((item.Type === 'Episode' || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null && options.includeIndexNumber !== false) {
|
||||||
var displayIndexNumber = item.IndexNumber;
|
let displayIndexNumber = item.IndexNumber;
|
||||||
|
|
||||||
var number = displayIndexNumber;
|
let number = displayIndexNumber;
|
||||||
var nameSeparator = ' - ';
|
let nameSeparator = ' - ';
|
||||||
|
|
||||||
if (options.includeParentInfo !== false) {
|
if (options.includeParentInfo !== false) {
|
||||||
number = 'S' + item.ParentIndexNumber + ':E' + number;
|
number = 'S' + item.ParentIndexNumber + ':E' + number;
|
||||||
|
@ -45,8 +45,8 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsAddingToCollection(item) {
|
export function supportsAddingToCollection(item) {
|
||||||
var invalidTypes = ['Genre', 'MusicGenre', 'Studio', 'UserView', 'CollectionFolder', 'Audio', 'Program', 'Timer', 'SeriesTimer'];
|
const invalidTypes = ['Genre', 'MusicGenre', 'Studio', 'UserView', 'CollectionFolder', 'Audio', 'Program', 'Timer', 'SeriesTimer'];
|
||||||
|
|
||||||
if (item.Type === 'Recording') {
|
if (item.Type === 'Recording') {
|
||||||
if (item.Status !== 'Completed') {
|
if (item.Status !== 'Completed') {
|
||||||
|
@ -57,7 +57,7 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return !item.CollectionType && invalidTypes.indexOf(item.Type) === -1 && item.MediaType !== 'Photo' && !isLocalItem(item);
|
return !item.CollectionType && invalidTypes.indexOf(item.Type) === -1 && item.MediaType !== 'Photo' && !isLocalItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsAddingToPlaylist(item) {
|
export function supportsAddingToPlaylist(item) {
|
||||||
if (item.Type === 'Program') {
|
if (item.Type === 'Program') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,8 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return item.MediaType || item.IsFolder || item.Type === 'Genre' || item.Type === 'MusicGenre' || item.Type === 'MusicArtist';
|
return item.MediaType || item.IsFolder || item.Type === 'Genre' || item.Type === 'MusicGenre' || item.Type === 'MusicArtist';
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEdit(user, item) {
|
export function canEdit(user, item) {
|
||||||
var itemType = item.Type;
|
const itemType = item.Type;
|
||||||
|
|
||||||
if (itemType === 'UserRootFolder' || itemType === 'UserView') {
|
if (itemType === 'UserRootFolder' || itemType === 'UserView') {
|
||||||
return false;
|
return false;
|
||||||
|
@ -122,7 +122,7 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return user.Policy.IsAdministrator;
|
return user.Policy.IsAdministrator;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLocalItem(item) {
|
export function isLocalItem(item) {
|
||||||
if (item && item.Id && item.Id.indexOf('local') === 0) {
|
if (item && item.Id && item.Id.indexOf('local') === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +130,8 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export function canIdentify (user, item) {
|
||||||
getDisplayName: getDisplayName,
|
const itemType = item.Type;
|
||||||
supportsAddingToCollection: supportsAddingToCollection,
|
|
||||||
supportsAddingToPlaylist: supportsAddingToPlaylist,
|
|
||||||
isLocalItem: isLocalItem,
|
|
||||||
|
|
||||||
canIdentify: function (user, item) {
|
|
||||||
var itemType = item.Type;
|
|
||||||
|
|
||||||
if (itemType === 'Movie' ||
|
if (itemType === 'Movie' ||
|
||||||
itemType === 'Trailer' ||
|
itemType === 'Trailer' ||
|
||||||
|
@ -156,12 +150,10 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
|
|
||||||
canEdit: canEdit,
|
export function canEditImages (user, item) {
|
||||||
|
const itemType = item.Type;
|
||||||
canEditImages: function (user, item) {
|
|
||||||
var itemType = item.Type;
|
|
||||||
|
|
||||||
if (item.MediaType === 'Photo') {
|
if (item.MediaType === 'Photo') {
|
||||||
return false;
|
return false;
|
||||||
|
@ -182,9 +174,9 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item);
|
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item);
|
||||||
},
|
}
|
||||||
|
|
||||||
canSync: function (user, item) {
|
export function canSync (user, item) {
|
||||||
if (user && !user.Policy.EnableContentDownloading) {
|
if (user && !user.Policy.EnableContentDownloading) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -194,9 +186,9 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return item.SupportsSync;
|
return item.SupportsSync;
|
||||||
},
|
}
|
||||||
|
|
||||||
canShare: function (item, user) {
|
export function canShare (item, user) {
|
||||||
if (item.Type === 'Program') {
|
if (item.Type === 'Program') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -218,13 +210,13 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return user.Policy.EnablePublicSharing && appHost.supports('sharing');
|
return user.Policy.EnablePublicSharing && appHost.supports('sharing');
|
||||||
},
|
}
|
||||||
|
|
||||||
enableDateAddedDisplay: function (item) {
|
export function enableDateAddedDisplay (item) {
|
||||||
return !item.IsFolder && item.MediaType && item.Type !== 'Program' && item.Type !== 'TvChannel' && item.Type !== 'Trailer';
|
return !item.IsFolder && item.MediaType && item.Type !== 'Program' && item.Type !== 'TvChannel' && item.Type !== 'Trailer';
|
||||||
},
|
}
|
||||||
|
|
||||||
canMarkPlayed: function (item) {
|
export function canMarkPlayed (item) {
|
||||||
if (item.Type === 'Program') {
|
if (item.Type === 'Program') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -251,9 +243,9 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
|
|
||||||
canRate: function (item) {
|
export function canRate (item) {
|
||||||
if (item.Type === 'Program'
|
if (item.Type === 'Program'
|
||||||
|| item.Type === 'Timer'
|
|| item.Type === 'Timer'
|
||||||
|| item.Type === 'SeriesTimer'
|
|| item.Type === 'SeriesTimer'
|
||||||
|
@ -265,9 +257,9 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
|
|
||||||
canConvert: function (item, user) {
|
export function canConvert (item, user) {
|
||||||
if (!user.Policy.EnableMediaConversion) {
|
if (!user.Policy.EnableMediaConversion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -276,17 +268,17 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mediaType = item.MediaType;
|
const mediaType = item.MediaType;
|
||||||
if (mediaType === 'Book' || mediaType === 'Photo' || mediaType === 'Audio') {
|
if (mediaType === 'Book' || mediaType === 'Photo' || mediaType === 'Audio') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionType = item.CollectionType;
|
const collectionType = item.CollectionType;
|
||||||
if (collectionType === 'livetv') {
|
if (collectionType === 'livetv') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var type = item.Type;
|
const type = item.Type;
|
||||||
if (type === 'Channel' || type === 'Person' || type === 'Year' || type === 'Program' || type === 'Timer' || type === 'SeriesTimer') {
|
if (type === 'Channel' || type === 'Person' || type === 'Year' || type === 'Program' || type === 'Timer' || type === 'SeriesTimer') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -300,11 +292,11 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
|
|
||||||
canRefreshMetadata: function (item, user) {
|
export function canRefreshMetadata (item, user) {
|
||||||
if (user.Policy.IsAdministrator) {
|
if (user.Policy.IsAdministrator) {
|
||||||
var collectionType = item.CollectionType;
|
const collectionType = item.CollectionType;
|
||||||
if (collectionType === 'livetv') {
|
if (collectionType === 'livetv') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -317,9 +309,9 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
|
|
||||||
supportsMediaSourceSelection: function (item) {
|
export function supportsMediaSourceSelection (item) {
|
||||||
if (item.MediaType !== 'Video') {
|
if (item.MediaType !== 'Video') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -338,5 +330,21 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getDisplayName: getDisplayName,
|
||||||
|
supportsAddingToCollection: supportsAddingToCollection,
|
||||||
|
supportsAddingToPlaylist: supportsAddingToPlaylist,
|
||||||
|
isLocalItem: isLocalItem,
|
||||||
|
canIdentify: canIdentify,
|
||||||
|
canEdit: canEdit,
|
||||||
|
canEditImages: canEditImages,
|
||||||
|
canSync: canSync,
|
||||||
|
canShare: canShare,
|
||||||
|
enableDateAddedDisplay: enableDateAddedDisplay,
|
||||||
|
canMarkPlayed: canMarkPlayed,
|
||||||
|
canRate: canRate,
|
||||||
|
canConvert: canConvert,
|
||||||
|
canRefreshMetadata: canRefreshMetadata,
|
||||||
|
supportsMediaSourceSelection: supportsMediaSourceSelection
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -222,7 +222,7 @@ export class BookPlayer {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
import('epubjs').then(({default: epubjs}) => {
|
import('epubjs').then(({default: epubjs}) => {
|
||||||
let downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
let downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
||||||
let book = epubjs.default(downloadHref, {openAs: 'epub'});
|
let book = epubjs(downloadHref, {openAs: 'epub'});
|
||||||
let rendition = book.renderTo(elem, {width: '100%', height: '97%'});
|
let rendition = book.renderTo(elem, {width: '100%', height: '97%'});
|
||||||
|
|
||||||
this._currentSrc = downloadHref;
|
this._currentSrc = downloadHref;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
define([], function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function isTv() {
|
function isTv() {
|
||||||
// This is going to be really difficult to get right
|
// This is going to be really difficult to get right
|
||||||
var userAgent = navigator.userAgent.toLowerCase();
|
const userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
|
||||||
if (userAgent.indexOf('tv') !== -1) {
|
if (userAgent.indexOf('tv') !== -1) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,7 +22,7 @@ define([], function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMobile(userAgent) {
|
function isMobile(userAgent) {
|
||||||
var terms = [
|
const terms = [
|
||||||
'mobi',
|
'mobi',
|
||||||
'ipad',
|
'ipad',
|
||||||
'iphone',
|
'iphone',
|
||||||
|
@ -37,9 +34,9 @@ define([], function () {
|
||||||
'opera mini'
|
'opera mini'
|
||||||
];
|
];
|
||||||
|
|
||||||
var lower = userAgent.toLowerCase();
|
const lower = userAgent.toLowerCase();
|
||||||
|
|
||||||
for (var i = 0, length = terms.length; i < length; i++) {
|
for (let i = 0, length = terms.length; i < length; i++) {
|
||||||
if (lower.indexOf(terms[i]) !== -1) {
|
if (lower.indexOf(terms[i]) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -79,13 +76,13 @@ define([], function () {
|
||||||
// MacIntel: Apple iPad Pro 11 iOS 13.1
|
// MacIntel: Apple iPad Pro 11 iOS 13.1
|
||||||
if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) {
|
if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) {
|
||||||
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
|
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
|
||||||
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
|
const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||||
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _supportsCssAnimation;
|
let _supportsCssAnimation;
|
||||||
var _supportsCssAnimationWithPrefix;
|
let _supportsCssAnimationWithPrefix;
|
||||||
function supportsCssAnimation(allowPrefix) {
|
function supportsCssAnimation(allowPrefix) {
|
||||||
// TODO: Assess if this is still needed, as all of our targets should natively support CSS animations.
|
// TODO: Assess if this is still needed, as all of our targets should natively support CSS animations.
|
||||||
if (allowPrefix) {
|
if (allowPrefix) {
|
||||||
|
@ -98,16 +95,16 @@ define([], function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var animation = false;
|
let animation = false;
|
||||||
var domPrefixes = ['Webkit', 'O', 'Moz'];
|
const domPrefixes = ['Webkit', 'O', 'Moz'];
|
||||||
var elm = document.createElement('div');
|
const elm = document.createElement('div');
|
||||||
|
|
||||||
if (elm.style.animationName !== undefined) {
|
if (elm.style.animationName !== undefined) {
|
||||||
animation = true;
|
animation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation === false && allowPrefix) {
|
if (animation === false && allowPrefix) {
|
||||||
for (var i = 0; i < domPrefixes.length; i++) {
|
for (let i = 0; i < domPrefixes.length; i++) {
|
||||||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
||||||
animation = true;
|
animation = true;
|
||||||
break;
|
break;
|
||||||
|
@ -124,10 +121,10 @@ define([], function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var uaMatch = function (ua) {
|
const uaMatch = function (ua) {
|
||||||
ua = ua.toLowerCase();
|
ua = ua.toLowerCase();
|
||||||
|
|
||||||
var match = /(edg)[ \/]([\w.]+)/.exec(ua) ||
|
const match = /(edg)[ \/]([\w.]+)/.exec(ua) ||
|
||||||
/(edga)[ \/]([\w.]+)/.exec(ua) ||
|
/(edga)[ \/]([\w.]+)/.exec(ua) ||
|
||||||
/(edgios)[ \/]([\w.]+)/.exec(ua) ||
|
/(edgios)[ \/]([\w.]+)/.exec(ua) ||
|
||||||
/(edge)[ \/]([\w.]+)/.exec(ua) ||
|
/(edge)[ \/]([\w.]+)/.exec(ua) ||
|
||||||
|
@ -139,15 +136,15 @@ define([], function () {
|
||||||
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||||
[];
|
[];
|
||||||
|
|
||||||
var versionMatch = /(version)[ \/]([\w.]+)/.exec(ua);
|
const versionMatch = /(version)[ \/]([\w.]+)/.exec(ua);
|
||||||
|
|
||||||
var platform_match = /(ipad)/.exec(ua) ||
|
let platform_match = /(ipad)/.exec(ua) ||
|
||||||
/(iphone)/.exec(ua) ||
|
/(iphone)/.exec(ua) ||
|
||||||
/(windows)/.exec(ua) ||
|
/(windows)/.exec(ua) ||
|
||||||
/(android)/.exec(ua) ||
|
/(android)/.exec(ua) ||
|
||||||
[];
|
[];
|
||||||
|
|
||||||
var browser = match[1] || '';
|
let browser = match[1] || '';
|
||||||
|
|
||||||
if (browser === 'edge') {
|
if (browser === 'edge') {
|
||||||
platform_match = [''];
|
platform_match = [''];
|
||||||
|
@ -157,14 +154,14 @@ define([], function () {
|
||||||
browser = 'opera';
|
browser = 'opera';
|
||||||
}
|
}
|
||||||
|
|
||||||
var version;
|
let version;
|
||||||
if (versionMatch && versionMatch.length > 2) {
|
if (versionMatch && versionMatch.length > 2) {
|
||||||
version = versionMatch[2];
|
version = versionMatch[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
version = version || match[2] || '0';
|
version = version || match[2] || '0';
|
||||||
|
|
||||||
var versionMajor = parseInt(version.split('.')[0]);
|
let versionMajor = parseInt(version.split('.')[0]);
|
||||||
|
|
||||||
if (isNaN(versionMajor)) {
|
if (isNaN(versionMajor)) {
|
||||||
versionMajor = 0;
|
versionMajor = 0;
|
||||||
|
@ -178,10 +175,10 @@ define([], function () {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var userAgent = navigator.userAgent;
|
const userAgent = navigator.userAgent;
|
||||||
|
|
||||||
var matched = uaMatch(userAgent);
|
const matched = uaMatch(userAgent);
|
||||||
var browser = {};
|
const browser = {};
|
||||||
|
|
||||||
if (matched.browser) {
|
if (matched.browser) {
|
||||||
browser[matched.browser] = true;
|
browser[matched.browser] = true;
|
||||||
|
@ -220,7 +217,7 @@ define([], function () {
|
||||||
if (!browser.tizen) {
|
if (!browser.tizen) {
|
||||||
browser.orsay = userAgent.toLowerCase().indexOf('smarthub') !== -1;
|
browser.orsay = userAgent.toLowerCase().indexOf('smarthub') !== -1;
|
||||||
} else {
|
} else {
|
||||||
var v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
const v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
||||||
browser.tizenVersion = parseInt(v[1]);
|
browser.tizenVersion = parseInt(v[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,5 +253,4 @@ define([], function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return browser;
|
export default browser;
|
||||||
});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue