Merge pull request #3983 from thornbill/sonar-no-collapsible-if

Fix sonarjs no-collapsible-if
This commit is contained in:
Bill Thornton 2022-10-04 09:30:13 -04:00 committed by GitHub
commit 8d28297a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 330 additions and 473 deletions

View File

@ -73,7 +73,6 @@ module.exports = {
'sonarjs/cognitive-complexity': ['warn'], 'sonarjs/cognitive-complexity': ['warn'],
// TODO: Enable the following rules and fix issues // TODO: Enable the following rules and fix issues
'sonarjs/max-switch-cases': ['off'], 'sonarjs/max-switch-cases': ['off'],
'sonarjs/no-collapsible-if': ['off'],
'sonarjs/no-duplicate-string': ['off'], 'sonarjs/no-duplicate-string': ['off'],
'sonarjs/no-duplicated-branches': ['off'], 'sonarjs/no-duplicated-branches': ['off'],
'sonarjs/no-gratuitous-expressions': ['off'], 'sonarjs/no-gratuitous-expressions': ['off'],

View File

@ -87,13 +87,11 @@ class AppRouter {
path = path.replace(this.baseUrl(), ''); path = path.replace(this.baseUrl(), '');
if (this.currentRouteInfo && this.currentRouteInfo.path === path) {
// can't use this with home right now due to the back menu // can't use this with home right now due to the back menu
if (this.currentRouteInfo.route.type !== 'home') { if (this.currentRouteInfo?.path === path && this.currentRouteInfo.route.type !== 'home') {
loading.hide(); loading.hide();
return Promise.resolve(); return Promise.resolve();
} }
}
this.promiseShow = new Promise((resolve) => { this.promiseShow = new Promise((resolve) => {
this.resolveOnNextShow = resolve; this.resolveOnNextShow = resolve;
@ -351,8 +349,7 @@ class AppRouter {
onRequestFail(_e, data) { onRequestFail(_e, data) {
const apiClient = this; const apiClient = this;
if (data.status === 403) { if (data.status === 403 && data.errorCode === 'ParentalControl') {
if (data.errorCode === 'ParentalControl') {
const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true; const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true;
// Bounce to the login screen, but not if a password entry fails, obviously // Bounce to the login screen, but not if a password entry fails, obviously
@ -362,7 +359,6 @@ class AppRouter {
} }
} }
} }
}
#authenticate(ctx, route, callback) { #authenticate(ctx, route, callback) {
const firstResult = this.firstConnectionResult; const firstResult = this.firstConnectionResult;

View File

@ -790,11 +790,9 @@ import { appRouter } from '../appRouter';
const showOtherText = isOuterFooter ? !overlayText : overlayText; const showOtherText = isOuterFooter ? !overlayText : overlayText;
if (isOuterFooter && options.cardLayout && layoutManager.mobile) { if (isOuterFooter && options.cardLayout && layoutManager.mobile && options.cardFooterAside !== 'none') {
if (options.cardFooterAside !== 'none') {
html += `<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu" title="${globalize.translate('ButtonMore')}"><span class="material-icons more_vert" aria-hidden="true"></span></button>`; html += `<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu" title="${globalize.translate('ButtonMore')}"><span class="material-icons more_vert" aria-hidden="true"></span></button>`;
} }
}
const cssClass = options.centerText ? 'cardText cardTextCentered' : 'cardText'; const cssClass = options.centerText ? 'cardText cardTextCentered' : 'cardText';
const serverId = item.ServerId || options.serverId; const serverId = item.ServerId || options.serverId;
@ -803,8 +801,7 @@ import { appRouter } from '../appRouter';
const parentTitleUnderneath = item.Type === 'MusicAlbum' || item.Type === 'Audio' || item.Type === 'MusicVideo'; const parentTitleUnderneath = item.Type === 'MusicAlbum' || item.Type === 'Audio' || item.Type === 'MusicVideo';
let titleAdded; let titleAdded;
if (showOtherText) { if (showOtherText && (options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) { if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
if (item.SeriesId) { if (item.SeriesId) {
lines.push(getTextActionButton({ lines.push(getTextActionButton({
@ -833,7 +830,6 @@ import { appRouter } from '../appRouter';
} }
} }
} }
}
let showMediaTitle = (showTitle && !titleAdded) || (options.showParentTitleOrTitle && !lines.length); let showMediaTitle = (showTitle && !titleAdded) || (options.showParentTitleOrTitle && !lines.length);
if (!showMediaTitle && !titleAdded && (showTitle || forceName)) { if (!showMediaTitle && !titleAdded && (showTitle || forceName)) {
@ -986,12 +982,10 @@ import { appRouter } from '../appRouter';
} }
} }
if (options.showPersonRoleOrType) { if (options.showPersonRoleOrType && item.Role) {
if (item.Role) {
lines.push(globalize.translate('PersonRole', escapeHtml(item.Role))); lines.push(globalize.translate('PersonRole', escapeHtml(item.Role)));
} }
} }
}
if ((showTitle || !imgUrl) && forceName && overlayText && lines.length === 1) { if ((showTitle || !imgUrl) && forceName && overlayText && lines.length === 1) {
lines = []; lines = [];
@ -1009,14 +1003,12 @@ import { appRouter } from '../appRouter';
html += progressHtml; html += progressHtml;
} }
if (html) { if (html && (!isOuterFooter || logoUrl || options.cardLayout)) {
if (!isOuterFooter || logoUrl || options.cardLayout) {
html = '<div class="' + footerClass + '">' + html; html = '<div class="' + footerClass + '">' + html;
//cardFooter //cardFooter
html += '</div>'; html += '</div>';
} }
}
return html; return html;
} }

View File

@ -34,11 +34,9 @@ import ServerConnections from '../ServerConnections';
let shape = (options.backdropShape || 'backdrop'); let shape = (options.backdropShape || 'backdrop');
if (videoStream.Width && videoStream.Height) { if (videoStream.Width && videoStream.Height && (videoStream.Width / videoStream.Height) <= 1.2) {
if ((videoStream.Width / videoStream.Height) <= 1.2) {
shape = (options.squareShape || 'square'); shape = (options.squareShape || 'square');
} }
}
className += ` ${shape}Card`; className += ` ${shape}Card`;

View File

@ -384,12 +384,13 @@ import scrollManager from './scrollManager';
// See if there's a focusable container, and if so, send the focus command to that // See if there's a focusable container, and if so, send the focus command to that
if (activeElement) { if (activeElement) {
const nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable'); const nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) { if (nearestElementFocusableParent
if (focusableContainer !== nearestElementFocusableParent) { && nearestElementFocusableParent !== nearestElement
&& focusableContainer !== nearestElementFocusableParent
) {
nearestElement = nearestElementFocusableParent; nearestElement = nearestElementFocusableParent;
} }
} }
}
focus(nearestElement); focus(nearestElement);
} }
} }

View File

@ -72,27 +72,26 @@ import toast from './toast/toast';
} }
} }
if (item.IsFolder || item.Type === 'MusicArtist' || item.Type === 'MusicGenre') { if ((item.IsFolder || item.Type === 'MusicArtist' || item.Type === 'MusicGenre')
if (item.CollectionType !== 'livetv') { && item.CollectionType !== 'livetv'
if (options.shuffle !== false) { && options.shuffle !== false
) {
commands.push({ commands.push({
name: globalize.translate('Shuffle'), name: globalize.translate('Shuffle'),
id: 'shuffle', id: 'shuffle',
icon: 'shuffle' icon: 'shuffle'
}); });
} }
}
}
if (item.MediaType === 'Audio' || item.Type === 'MusicAlbum' || item.Type === 'MusicArtist' || item.Type === 'MusicGenre') { if ((item.MediaType === 'Audio' || item.Type === 'MusicAlbum' || item.Type === 'MusicArtist' || item.Type === 'MusicGenre')
if (options.instantMix !== false && !itemHelper.isLocalItem(item)) { && options.instantMix !== false && !itemHelper.isLocalItem(item)
) {
commands.push({ commands.push({
name: globalize.translate('InstantMix'), name: globalize.translate('InstantMix'),
id: 'instantmix', id: 'instantmix',
icon: 'explore' icon: 'explore'
}); });
} }
}
if (commands.length) { if (commands.length) {
commands.push({ commands.push({
@ -180,8 +179,7 @@ import toast from './toast/toast';
} }
const canEdit = itemHelper.canEdit(user, item); const canEdit = itemHelper.canEdit(user, item);
if (canEdit) { if (canEdit && options.edit !== false && item.Type !== 'SeriesTimer') {
if (options.edit !== false && item.Type !== 'SeriesTimer') {
const text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata'); const text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata');
commands.push({ commands.push({
name: text, name: text,
@ -189,49 +187,42 @@ import toast from './toast/toast';
icon: 'edit' icon: 'edit'
}); });
} }
}
if (itemHelper.canEditImages(user, item)) { if (itemHelper.canEditImages(user, item) && options.editImages !== false) {
if (options.editImages !== false) {
commands.push({ commands.push({
name: globalize.translate('EditImages'), name: globalize.translate('EditImages'),
id: 'editimages', id: 'editimages',
icon: 'image' icon: 'image'
}); });
} }
}
if (canEdit) { if (canEdit && item.MediaType === 'Video' && item.Type !== 'TvChannel' && item.Type !== 'Program'
if (item.MediaType === 'Video' && item.Type !== 'TvChannel' && item.Type !== 'Program' && item.LocationType !== 'Virtual' && !(item.Type === 'Recording' && item.Status !== 'Completed')) { && item.LocationType !== 'Virtual'
if (options.editSubtitles !== false) { && !(item.Type === 'Recording' && item.Status !== 'Completed')
&& options.editSubtitles !== false
) {
commands.push({ commands.push({
name: globalize.translate('EditSubtitles'), name: globalize.translate('EditSubtitles'),
id: 'editsubtitles', id: 'editsubtitles',
icon: 'closed_caption' icon: 'closed_caption'
}); });
} }
}
}
if (options.identify !== false) { if (options.identify !== false && itemHelper.canIdentify(user, item)) {
if (itemHelper.canIdentify(user, item)) {
commands.push({ commands.push({
name: globalize.translate('Identify'), name: globalize.translate('Identify'),
id: 'identify', id: 'identify',
icon: 'edit' icon: 'edit'
}); });
} }
}
if (item.MediaSources) { if (item.MediaSources && options.moremediainfo !== false) {
if (options.moremediainfo !== false) {
commands.push({ commands.push({
name: globalize.translate('MoreMediaInfo'), name: globalize.translate('MoreMediaInfo'),
id: 'moremediainfo', id: 'moremediainfo',
icon: 'info' icon: 'info'
}); });
} }
}
if (item.Type === 'Program' && options.record !== false) { if (item.Type === 'Program' && options.record !== false) {
if (item.TimerId) { if (item.TimerId) {
@ -240,11 +231,7 @@ import toast from './toast/toast';
id: 'record', id: 'record',
icon: 'fiber_manual_record' icon: 'fiber_manual_record'
}); });
} } else {
}
if (item.Type === 'Program' && options.record !== false) {
if (!item.TimerId) {
commands.push({ commands.push({
name: globalize.translate('Record'), name: globalize.translate('Record'),
id: 'record', id: 'record',
@ -277,27 +264,21 @@ import toast from './toast/toast';
}); });
} }
if (!restrictOptions) { if (!restrictOptions && options.share === true && itemHelper.canShare(item, user)) {
if (options.share === true) {
if (itemHelper.canShare(item, user)) {
commands.push({ commands.push({
name: globalize.translate('Share'), name: globalize.translate('Share'),
id: 'share', id: 'share',
icon: 'share' icon: 'share'
}); });
} }
}
}
if (options.sync !== false) { if (options.sync !== false && itemHelper.canSync(user, item)) {
if (itemHelper.canSync(user, item)) {
commands.push({ commands.push({
name: globalize.translate('Sync'), name: globalize.translate('Sync'),
id: 'sync', id: 'sync',
icon: 'sync' icon: 'sync'
}); });
} }
}
if (options.openAlbum !== false && item.AlbumId && item.MediaType !== 'Photo') { if (options.openAlbum !== false && item.AlbumId && item.MediaType !== 'Photo') {
commands.push({ commands.push({

View File

@ -48,11 +48,9 @@ export function getDisplayName(item, options = {}) {
export function supportsAddingToCollection(item) { export function supportsAddingToCollection(item) {
const 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' && item.Status !== 'Completed') {
if (item.Status !== 'Completed') {
return false; return false;
} }
}
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);
} }
@ -74,11 +72,9 @@ export function supportsAddingToPlaylist(item) {
return false; return false;
} }
if (item.Type === 'Recording') { if (item.Type === 'Recording' && item.Status !== 'Completed') {
if (item.Status !== 'Completed') {
return false; return false;
} }
}
if (isLocalItem(item)) { if (isLocalItem(item)) {
return false; return false;
@ -109,11 +105,9 @@ export function canEdit(user, item) {
return false; return false;
} }
if (item.Type === 'Recording') { if (item.Type === 'Recording' && item.Status !== 'Completed') {
if (item.Status !== 'Completed') {
return false; return false;
} }
}
if (isLocalItem(item)) { if (isLocalItem(item)) {
return false; return false;
@ -133,23 +127,17 @@ export function isLocalItem(item) {
export function canIdentify (user, item) { export function canIdentify (user, item) {
const itemType = item.Type; const itemType = item.Type;
if (itemType === 'Movie' || return (itemType === 'Movie'
itemType === 'Trailer' || || itemType === 'Trailer'
itemType === 'Series' || || itemType === 'Series'
itemType === 'BoxSet' || || itemType === 'BoxSet'
itemType === 'Person' || || itemType === 'Person'
itemType === 'Book' || || itemType === 'Book'
itemType === 'MusicAlbum' || || itemType === 'MusicAlbum'
itemType === 'MusicArtist' || || itemType === 'MusicArtist'
itemType === 'MusicVideo') { || itemType === 'MusicVideo')
if (user.Policy.IsAdministrator) { && user.Policy.IsAdministrator
if (!isLocalItem(item)) { && !isLocalItem(item);
return true;
}
}
}
return false;
} }
export function canEditImages (user, item) { export function canEditImages (user, item) {
@ -167,11 +155,9 @@ export function canEditImages (user, item) {
return false; return false;
} }
if (item.Type === 'Recording') { if (item.Type === 'Recording' && item.Status !== 'Completed') {
if (item.Status !== 'Completed') {
return false; return false;
} }
}
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item); return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item);
} }
@ -201,11 +187,9 @@ export function canShare (item, user) {
if (item.Type === 'SeriesTimer') { if (item.Type === 'SeriesTimer') {
return false; return false;
} }
if (item.Type === 'Recording') { if (item.Type === 'Recording' && item.Status !== 'Completed') {
if (item.Status !== 'Completed') {
return false; return false;
} }
}
if (isLocalItem(item)) { if (isLocalItem(item)) {
return false; return false;
} }
@ -301,11 +285,10 @@ export function canRefreshMetadata (item, user) {
return false; return false;
} }
if (item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program' && item.Type !== 'TvChannel' && !(item.Type === 'Recording' && item.Status !== 'Completed')) { return item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program'
if (!isLocalItem(item)) { && item.Type !== 'TvChannel'
return true; && !(item.Type === 'Recording' && item.Status !== 'Completed')
} && !isLocalItem(item);
}
} }
return false; return false;

View File

@ -94,17 +94,15 @@ function onPlaybackStopped(e, stopInfo) {
const state = stopInfo.state; const state = stopInfo.state;
const eventsToMonitor = getEventsToMonitor(instance); const eventsToMonitor = getEventsToMonitor(instance);
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') { if (state.NowPlayingItem?.MediaType === 'Video') {
if (eventsToMonitor.indexOf('videoplayback') !== -1) { if (eventsToMonitor.indexOf('videoplayback') !== -1) {
instance.notifyRefreshNeeded(true); instance.notifyRefreshNeeded(true);
return; return;
} }
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') { } else if (state.NowPlayingItem?.MediaType === 'Audio' && eventsToMonitor.indexOf('audioplayback') !== -1) {
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
instance.notifyRefreshNeeded(true); instance.notifyRefreshNeeded(true);
return; return;
} }
}
} }
function addNotificationEvent(instance, name, handler, owner) { function addNotificationEvent(instance, name, handler, owner) {

View File

@ -328,11 +328,9 @@ import ServerConnections from '../ServerConnections';
textlines.push(datetime.getDisplayTime(datetime.parseISO8601Date(item.StartDate))); textlines.push(datetime.getDisplayTime(datetime.parseISO8601Date(item.StartDate)));
} }
if (options.showChannel) { if (options.showChannel && item.ChannelName) {
if (item.ChannelName) {
textlines.push(item.ChannelName); textlines.push(item.ChannelName);
} }
}
let parentTitle = null; let parentTitle = null;
@ -370,11 +368,9 @@ import ServerConnections from '../ServerConnections';
} }
if (item.IsFolder) { if (item.IsFolder) {
if (options.artist !== false) { if (options.artist !== false && item.AlbumArtist && item.Type === 'MusicAlbum') {
if (item.AlbumArtist && item.Type === 'MusicAlbum') {
textlines.push(item.AlbumArtist); textlines.push(item.AlbumArtist);
} }
}
} else { } else {
if (options.artist) { if (options.artist) {
const artistItems = item.ArtistItems; const artistItems = item.ArtistItems;
@ -386,11 +382,9 @@ import ServerConnections from '../ServerConnections';
} }
} }
if (item.Type === 'TvChannel') { if (item.Type === 'TvChannel' && item.CurrentProgram) {
if (item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram)); textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
} }
}
cssClass = 'listItemBody'; cssClass = 'listItemBody';
if (!clickEntireItem) { if (!clickEntireItem) {
@ -405,8 +399,7 @@ import ServerConnections from '../ServerConnections';
html += getTextLinesHtml(textlines, isLargeStyle); html += getTextLinesHtml(textlines, isLargeStyle);
if (options.mediaInfo !== false) { if (options.mediaInfo !== false && !enableSideMediaInfo) {
if (!enableSideMediaInfo) {
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText'; const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
html += `<div class="${mediaInfoClass}">`; html += `<div class="${mediaInfoClass}">`;
@ -418,7 +411,6 @@ import ServerConnections from '../ServerConnections';
}); });
html += '</div>'; html += '</div>';
} }
}
if (enableOverview && item.Overview) { if (enableOverview && item.Overview) {
html += '<div class="secondary listItem-overview listItemBodyText">'; html += '<div class="secondary listItem-overview listItemBodyText">';
@ -428,8 +420,7 @@ import ServerConnections from '../ServerConnections';
html += '</div>'; html += '</div>';
if (options.mediaInfo !== false) { if (options.mediaInfo !== false && enableSideMediaInfo) {
if (enableSideMediaInfo) {
html += '<div class="secondary listItemMediaInfo">'; html += '<div class="secondary listItemMediaInfo">';
html += mediaInfo.getPrimaryMediaInfoHtml(item, { html += mediaInfo.getPrimaryMediaInfoHtml(item, {
@ -442,7 +433,6 @@ import ServerConnections from '../ServerConnections';
}); });
html += '</div>'; html += '</div>';
} }
}
if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) { if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) {
html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside'); html += indicators.getTimerIndicator(item).replace('indicatorIcon', 'indicatorIcon listItemAside');

View File

@ -129,8 +129,10 @@ import '../../elements/emby-button/emby-button';
} }
} }
if ((item.Type === 'Episode' || item.MediaType === 'Photo') && options.originalAirDate !== false) { if ((item.Type === 'Episode' || item.MediaType === 'Photo')
if (item.PremiereDate) { && options.originalAirDate !== false
&& item.PremiereDate
) {
try { try {
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog //don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
date = datetime.parseISO8601Date(item.PremiereDate, item.Type !== 'Episode'); date = datetime.parseISO8601Date(item.PremiereDate, item.Type !== 'Episode');
@ -141,7 +143,6 @@ import '../../elements/emby-button/emby-button';
console.error('error parsing date:', item.PremiereDate); console.error('error parsing date:', item.PremiereDate);
} }
} }
}
if (item.Type === 'SeriesTimer') { if (item.Type === 'SeriesTimer') {
if (item.RecordAnyTime) { if (item.RecordAnyTime) {
@ -239,8 +240,9 @@ import '../../elements/emby-button/emby-button';
} }
} }
if (options.year !== false) { if (options.year !== false && item.Type !== 'Series' && item.Type !== 'Episode' && item.Type !== 'Person'
if (item.Type !== 'Series' && item.Type !== 'Episode' && item.Type !== 'Person' && item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season') { && item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season'
) {
if (item.ProductionYear) { if (item.ProductionYear) {
miscInfo.push(item.ProductionYear); miscInfo.push(item.ProductionYear);
} else if (item.PremiereDate) { } else if (item.PremiereDate) {
@ -252,7 +254,6 @@ import '../../elements/emby-button/emby-button';
} }
} }
} }
}
if (item.RunTimeTicks && item.Type !== 'Series' && item.Type !== 'Program' && item.Type !== 'Book' && !showFolderRuntime && options.runtime !== false) { if (item.RunTimeTicks && item.Type !== 'Series' && item.Type !== 'Program' && item.Type !== 'Book' && !showFolderRuntime && options.runtime !== false) {
if (item.Type === 'Audio') { if (item.Type === 'Audio') {
@ -314,15 +315,13 @@ import '../../elements/emby-button/emby-button';
} }
export function getEndsAt(item) { export function getEndsAt(item) {
if (item.MediaType === 'Video' && item.RunTimeTicks) { if (item.MediaType === 'Video' && item.RunTimeTicks && !item.StartDate) {
if (!item.StartDate) {
let endDate = new Date().getTime() + (item.RunTimeTicks / 10000); let endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
endDate = new Date(endDate); endDate = new Date(endDate);
const displayTime = datetime.getDisplayTime(endDate); const displayTime = datetime.getDisplayTime(endDate);
return globalize.translate('EndsAtValue', displayTime); return globalize.translate('EndsAtValue', displayTime);
} }
}
return null; return null;
} }

View File

@ -444,13 +444,11 @@ import { appRouter } from '../appRouter';
options = options || {}; options = options || {};
options.type = options.type || 'Primary'; options.type = options.type || 'Primary';
if (options.type === 'Primary') { if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
if (item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return ServerConnections.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return ServerConnections.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
}
if (options.type === 'Thumb') { if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {

View File

@ -44,11 +44,9 @@ function triggerPlayerChange(playbackManagerInstance, newPlayer, newTarget, prev
return; return;
} }
if (newTarget && previousTargetInfo) { if (newTarget && previousTargetInfo && newTarget.id === previousTargetInfo.id) {
if (newTarget.id === previousTargetInfo.id) {
return; return;
} }
}
Events.trigger(playbackManagerInstance, 'playerchange', [newPlayer, newTarget, previousPlayer]); Events.trigger(playbackManagerInstance, 'playerchange', [newPlayer, newTarget, previousPlayer]);
} }
@ -501,11 +499,11 @@ function getPlaybackInfo(player,
} }
// lastly, enforce player overrides for special situations // lastly, enforce player overrides for special situations
if (query.EnableDirectStream !== false) { if (query.EnableDirectStream !== false
if (player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)) { && player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)
) {
query.EnableDirectStream = false; query.EnableDirectStream = false;
} }
}
if (player.getDirectPlayProtocols) { if (player.getDirectPlayProtocols) {
query.DirectPlayProtocols = player.getDirectPlayProtocols(); query.DirectPlayProtocols = player.getDirectPlayProtocols();
@ -569,11 +567,11 @@ function getLiveStream(player, apiClient, item, playSessionId, deviceProfile, ma
} }
// lastly, enforce player overrides for special situations // lastly, enforce player overrides for special situations
if (query.EnableDirectStream !== false) { if (query.EnableDirectStream !== false
if (player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)) { && player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)
) {
query.EnableDirectStream = false; query.EnableDirectStream = false;
} }
}
return apiClient.ajax({ return apiClient.ajax({
url: apiClient.getUrl('LiveStreams/Open', query), url: apiClient.getUrl('LiveStreams/Open', query),
@ -963,11 +961,9 @@ class PlaybackManager {
self.isPlaying = function (player) { self.isPlaying = function (player) {
player = player || self._currentPlayer; player = player || self._currentPlayer;
if (player) { if (player?.isPlaying) {
if (player.isPlaying) {
return player.isPlaying(); return player.isPlaying();
} }
}
return player != null && player.currentSrc() != null; return player != null && player.currentSrc() != null;
}; };
@ -975,11 +971,9 @@ class PlaybackManager {
self.isPlayingMediaType = function (mediaType, player) { self.isPlayingMediaType = function (mediaType, player) {
player = player || self._currentPlayer; player = player || self._currentPlayer;
if (player) { if (player?.isPlaying) {
if (player.isPlaying) {
return player.isPlaying(mediaType); return player.isPlaying(mediaType);
} }
}
if (self.isPlaying(player)) { if (self.isPlaying(player)) {
const playerData = getPlayerData(player); const playerData = getPlayerData(player);
@ -1027,11 +1021,9 @@ class PlaybackManager {
return true; return true;
} }
if (item.LocationType === 'Virtual') { if (item.LocationType === 'Virtual' && itemType !== 'Program') {
if (itemType !== 'Program') {
return false; return false;
} }
}
if (itemType === 'Program') { if (itemType === 'Program') {
if (!item.EndDate || !item.StartDate) { if (!item.EndDate || !item.StartDate) {
@ -3300,13 +3292,13 @@ class PlaybackManager {
reportPlayback(self, state, player, reportPlaylist, serverId, 'reportPlaybackProgress', progressEventName); reportPlayback(self, state, player, reportPlaylist, serverId, 'reportPlaybackProgress', progressEventName);
} }
if (streamInfo && streamInfo.liveStreamId) { if (streamInfo?.liveStreamId
if (new Date().getTime() - (streamInfo.lastMediaInfoQuery || 0) >= 600000) { && (new Date().getTime() - (streamInfo.lastMediaInfoQuery || 0) >= 600000)
) {
getLiveStreamMediaInfo(player, streamInfo, self.currentMediaSource(player), streamInfo.liveStreamId, serverId); getLiveStreamMediaInfo(player, streamInfo, self.currentMediaSource(player), streamInfo.liveStreamId, serverId);
} }
} }
} }
}
function getLiveStreamMediaInfo(player, streamInfo, mediaSource, liveStreamId, serverId) { function getLiveStreamMediaInfo(player, streamInfo, mediaSource, liveStreamId, serverId) {
console.debug('getLiveStreamMediaInfo'); console.debug('getLiveStreamMediaInfo');
@ -3568,11 +3560,9 @@ class PlaybackManager {
} }
getBufferedRanges(player = this._currentPlayer) { getBufferedRanges(player = this._currentPlayer) {
if (player) { if (player?.getBufferedRanges) {
if (player.getBufferedRanges) {
return player.getBufferedRanges(); return player.getBufferedRanges();
} }
}
return []; return [];
} }
@ -3842,21 +3832,17 @@ class PlaybackManager {
removeActivePlayer(name) { removeActivePlayer(name) {
const playerInfo = this.getPlayerInfo(); const playerInfo = this.getPlayerInfo();
if (playerInfo) { if (playerInfo?.name === name) {
if (playerInfo.name === name) {
this.setDefaultPlayerActive(); this.setDefaultPlayerActive();
} }
} }
}
removeActiveTarget(id) { removeActiveTarget(id) {
const playerInfo = this.getPlayerInfo(); const playerInfo = this.getPlayerInfo();
if (playerInfo) { if (playerInfo?.id === id) {
if (playerInfo.id === id) {
this.setDefaultPlayerActive(); this.setDefaultPlayerActive();
} }
} }
}
sendCommand(cmd, player) { sendCommand(cmd, player) {
console.debug('MediaController received command: ' + cmd.Name); console.debug('MediaController received command: ' + cmd.Name);

View File

@ -29,12 +29,10 @@ function mirrorIfEnabled(info) {
if (info && playbackManager.enableDisplayMirroring()) { if (info && playbackManager.enableDisplayMirroring()) {
const getPlayerInfo = playbackManager.getPlayerInfo(); const getPlayerInfo = playbackManager.getPlayerInfo();
if (getPlayerInfo) { if (getPlayerInfo && !getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
if (!getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
mirrorItem(info, playbackManager.getCurrentPlayer()); mirrorItem(info, playbackManager.getCurrentPlayer());
} }
} }
}
} }
function emptyCallback() { function emptyCallback() {
@ -85,12 +83,10 @@ function getIcon(target) {
export function show(button) { export function show(button) {
const currentPlayerInfo = playbackManager.getPlayerInfo(); const currentPlayerInfo = playbackManager.getPlayerInfo();
if (currentPlayerInfo) { if (currentPlayerInfo && !currentPlayerInfo.isLocalPlayer) {
if (!currentPlayerInfo.isLocalPlayer) {
showActivePlayerMenu(currentPlayerInfo); showActivePlayerMenu(currentPlayerInfo);
return; return;
} }
}
const currentPlayerId = currentPlayerInfo ? currentPlayerInfo.id : null; const currentPlayerId = currentPlayerInfo ? currentPlayerInfo.id : null;

View File

@ -106,11 +106,9 @@ function getIndicatorIcon(item) {
return 'fiber_manual_record'; return 'fiber_manual_record';
} }
if (item.SeriesTimerId) { if (item.SeriesTimerId && status !== 'Cancelled') {
if (status !== 'Cancelled') {
return 'fiber_smart_record'; return 'fiber_smart_record';
} }
}
return 'fiber_manual_record'; return 'fiber_manual_record';
} }

View File

@ -63,16 +63,11 @@ function onTimerChangedExternally(e, apiClient, data) {
const options = this.options; const options = this.options;
let refresh = false; let refresh = false;
if (data.Id) { if (data.Id && this.TimerId === data.Id) {
if (this.TimerId === data.Id) {
refresh = true; refresh = true;
} } else if (data.ProgramId && options && options.programId === data.ProgramId) {
}
if (data.ProgramId && options) {
if (options.programId === data.ProgramId) {
refresh = true; refresh = true;
} }
}
if (refresh) { if (refresh) {
this.refresh(); this.refresh();
@ -83,16 +78,12 @@ function onSeriesTimerChangedExternally(e, apiClient, data) {
const options = this.options; const options = this.options;
let refresh = false; let refresh = false;
if (data.Id) { if (data.Id && this.SeriesTimerId === data.Id) {
if (this.SeriesTimerId === data.Id) {
refresh = true; refresh = true;
} }
} if (data.ProgramId && options && options.programId === data.ProgramId) {
if (data.ProgramId && options) {
if (options.programId === data.ProgramId) {
refresh = true; refresh = true;
} }
}
if (refresh) { if (refresh) {
this.refresh(); this.refresh();

View File

@ -46,12 +46,10 @@ function getImageUrl(item, options, apiClient) {
return apiClient.getScaledImageUrl(item.Id, options); return apiClient.getScaledImageUrl(item.Id, options);
} }
if (options.type === 'Primary') { if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
return apiClient.getScaledImageUrl(item.AlbumId, options); return apiClient.getScaledImageUrl(item.AlbumId, options);
} }
}
return null; return null;
} }

View File

@ -114,11 +114,9 @@ function fillSubtitleList(context, item) {
itemHtml += '</a>'; itemHtml += '</a>';
itemHtml += '</div>'; itemHtml += '</div>';
if (!layoutManager.tv) { if (!layoutManager.tv && s.Path) {
if (s.Path) {
itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete" aria-hidden="true"></span></button>'; itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete" aria-hidden="true"></span></button>';
} }
}
itemHtml += '</' + tagName + '>'; itemHtml += '</' + tagName + '>';

View File

@ -800,14 +800,12 @@ import confirm from '../../components/confirm/confirm';
}); });
} }
if (ApiClient.isMinServerVersion('3.4.1.25')) {
if (!page.serverActivityLog) { if (!page.serverActivityLog) {
page.serverActivityLog = new ActivityLog({ page.serverActivityLog = new ActivityLog({
serverId: ApiClient.serverId(), serverId: ApiClient.serverId(),
element: page.querySelector('.serverActivityItems') element: page.querySelector('.serverActivityItems')
}); });
} }
}
refreshActiveRecordings(view, apiClient); refreshActiveRecordings(view, apiClient);
loading.hide(); loading.hide();

View File

@ -85,14 +85,10 @@ import 'webcomponents.js/webcomponents-lite';
passive: true passive: true
}); });
if (browser.orsay) {
if (this === document.activeElement) {
//Make sure the IME pops up if this is the first/default element on the page //Make sure the IME pops up if this is the first/default element on the page
if (document.attachIME) { if (browser.orsay && this === document.activeElement && document.attachIME) {
document.attachIME(this); document.attachIME(this);
} }
}
}
}; };
function onChange() { function onChange() {

View File

@ -21,11 +21,9 @@ import Sortable from 'sortablejs';
const itemsContainer = this; const itemsContainer = this;
const multiSelect = itemsContainer.multiSelect; const multiSelect = itemsContainer.multiSelect;
if (multiSelect) { if (multiSelect?.onContainerClick.call(itemsContainer, e) === false) {
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
return; return;
} }
}
itemShortcuts.onClick.call(itemsContainer, e); itemShortcuts.onClick.call(itemsContainer, e);
} }
@ -259,13 +257,11 @@ import Sortable from 'sortablejs';
itemsContainer.notifyRefreshNeeded(true); itemsContainer.notifyRefreshNeeded(true);
return; return;
} }
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') { } else if (state.NowPlayingItem?.MediaType === 'Audio' && eventsToMonitor.indexOf('audioplayback') !== -1) {
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
itemsContainer.notifyRefreshNeeded(true); itemsContainer.notifyRefreshNeeded(true);
return; return;
} }
} }
}
function addNotificationEvent(instance, name, handler, owner) { function addNotificationEvent(instance, name, handler, owner) {
const localHandler = handler.bind(instance); const localHandler = handler.bind(instance);
@ -298,11 +294,9 @@ import Sortable from 'sortablejs';
} }
} }
if (layoutManager.desktop || layoutManager.mobile) { if (layoutManager.desktop || layoutManager.mobile && this.getAttribute('data-multiselect') !== 'false') {
if (this.getAttribute('data-multiselect') !== 'false') {
this.enableMultiSelect(true); this.enableMultiSelect(true);
} }
}
if (layoutManager.tv) { if (layoutManager.tv) {
this.classList.add('itemsContainer-tv'); this.classList.add('itemsContainer-tv');

View File

@ -443,11 +443,9 @@ import '../emby-input/emby-input';
} }
for (const range of ranges) { for (const range of ranges) {
if (position != null) { if (position != null && position >= range.end) {
if (position >= range.end) {
continue; continue;
} }
}
setRange(elem, range.start, range.end); setRange(elem, range.start, range.end);
return; return;

View File

@ -272,11 +272,9 @@ import '../../assets/css/scrollstyles.scss';
let sibling = elem[method]; let sibling = elem[method];
while (sibling) { while (sibling) {
if (sibling.classList.contains(buttonClass)) { if (sibling.classList.contains(buttonClass) && !sibling.classList.contains('hide')) {
if (!sibling.classList.contains('hide')) {
return sibling; return sibling;
} }
}
sibling = sibling[method]; sibling = sibling[method];
} }

View File

@ -79,11 +79,11 @@ function init() {
} }
function onGlobalizeInit() { function onGlobalizeInit() {
if (window.appMode === 'android') { if (window.appMode === 'android'
if (window.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) { && window.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1
) {
return onAppReady(); return onAppReady();
} }
}
document.title = globalize.translateHtml(document.title, 'core'); document.title = globalize.translateHtml(document.title, 'core');

View File

@ -289,8 +289,7 @@ class NavDrawer {
setEdgeSwipeEnabled(enabled) { setEdgeSwipeEnabled(enabled) {
const options = this.options; const options = this.options;
if (!options.disableEdgeSwipe) { if (!options.disableEdgeSwipe && browser.touch) {
if (browser.touch) {
if (enabled) { if (enabled) {
if (!this._edgeSwipeEnabled) { if (!this._edgeSwipeEnabled) {
this._edgeSwipeEnabled = true; this._edgeSwipeEnabled = true;
@ -320,7 +319,6 @@ class NavDrawer {
} }
} }
} }
}
initialize() { initialize() {
const options = Object.assign({}, this.defaults, this.options || {}); const options = Object.assign({}, this.defaults, this.options || {});

View File

@ -279,11 +279,9 @@ const scrollerFactory = function (frame, options) {
const now = new Date().getTime(); const now = new Date().getTime();
if (o.autoImmediate) { if (o.autoImmediate && !immediate && (now - (lastAnimate || 0)) <= 50) {
if (!immediate && (now - (lastAnimate || 0)) <= 50) {
immediate = true; immediate = true;
} }
}
if (!immediate && o.skipSlideToWhenVisible && fullItemPos && fullItemPos.isVisible) { if (!immediate && o.skipSlideToWhenVisible && fullItemPos && fullItemPos.isVisible) {
return; return;
@ -787,16 +785,14 @@ const scrollerFactory = function (frame, options) {
passive: true passive: true
}); });
} }
} else if (o.horizontal) { } else if (o.horizontal && o.mouseWheel) {
// Don't bind to mouse events with vertical scroll since the mouse wheel can handle this natively // Don't bind to mouse events with vertical scroll since the mouse wheel can handle this natively
if (o.mouseWheel) {
// Scrolling navigation // Scrolling navigation
dom.addEventListener(scrollSource, wheelEvent, scrollHandler, { dom.addEventListener(scrollSource, wheelEvent, scrollHandler, {
passive: true passive: true
}); });
} }
}
dom.addEventListener(frame, 'click', onFrameClick, { dom.addEventListener(frame, 'click', onFrameClick, {
passive: true, passive: true,

View File

@ -452,12 +452,10 @@ function normalizeImages(state) {
if (state && state.NowPlayingItem) { if (state && state.NowPlayingItem) {
const item = state.NowPlayingItem; const item = state.NowPlayingItem;
if (!item.ImageTags || !item.ImageTags.Primary) { if ((!item.ImageTags || !item.ImageTags.Primary) && item.PrimaryImageTag) {
if (item.PrimaryImageTag) {
item.ImageTags = item.ImageTags || {}; item.ImageTags = item.ImageTags || {};
item.ImageTags.Primary = item.PrimaryImageTag; item.ImageTags.Primary = item.PrimaryImageTag;
} }
}
if (item.BackdropImageTag && item.BackdropItemId === item.Id) { if (item.BackdropImageTag && item.BackdropItemId === item.Id) {
item.BackdropImageTags = [item.BackdropImageTag]; item.BackdropImageTags = [item.BackdropImageTag];
} }

View File

@ -67,17 +67,13 @@ function tryRemoveElement(elem) {
} }
function enableNativeTrackSupport(currentSrc, track) { function enableNativeTrackSupport(currentSrc, track) {
if (track) { if (track?.DeliveryMethod === 'Embed') {
if (track.DeliveryMethod === 'Embed') {
return true; return true;
} }
}
if (browser.firefox) { if (browser.firefox && (currentSrc || '').toLowerCase().includes('.m3u8')) {
if ((currentSrc || '').toLowerCase().includes('.m3u8')) {
return false; return false;
} }
}
if (browser.ps4) { if (browser.ps4) {
return false; return false;
@ -92,12 +88,10 @@ function tryRemoveElement(elem) {
return false; return false;
} }
if (browser.iOS) { if (browser.iOS && (browser.iosVersion || 10) < 10) {
// works in the browser but not the native app // works in the browser but not the native app
if ((browser.iosVersion || 10) < 10) {
return false; return false;
} }
}
if (track) { if (track) {
const format = (track.Codec || '').toLowerCase(); const format = (track.Codec || '').toLowerCase();
@ -1500,11 +1494,12 @@ function tryRemoveElement(elem) {
|| document.pictureInPictureEnabled || document.pictureInPictureEnabled
) { ) {
list.push('PictureInPicture'); list.push('PictureInPicture');
} else if (window.Windows) { } else if (window.Windows
if (Windows.UI.ViewManagement.ApplicationView.getForCurrentView().isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay)) { && Windows.UI.ViewManagement.ApplicationView.getForCurrentView()
.isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay)
) {
list.push('PictureInPicture'); list.push('PictureInPicture');
} }
}
if (browser.safari || browser.iOS || browser.iPad) { if (browser.safari || browser.iOS || browser.iPad) {
list.push('AirPlay'); list.push('AirPlay');
@ -1564,13 +1559,7 @@ function tryRemoveElement(elem) {
} }
const video = this.#mediaElement; const video = this.#mediaElement;
if (video) { return !!video?.audioTracks;
if (video.audioTracks) {
return true;
}
}
return false;
} }
static onPictureInPictureError(err) { static onPictureInPictureError(err) {

View File

@ -159,12 +159,10 @@ function normalizeImages(state, apiClient) {
if (state && state.NowPlayingItem) { if (state && state.NowPlayingItem) {
const item = state.NowPlayingItem; const item = state.NowPlayingItem;
if (!item.ImageTags || !item.ImageTags.Primary) { if (!item.ImageTags || !item.ImageTags.Primary && item.PrimaryImageTag) {
if (item.PrimaryImageTag) {
item.ImageTags = item.ImageTags || {}; item.ImageTags = item.ImageTags || {};
item.ImageTags.Primary = item.PrimaryImageTag; item.ImageTags.Primary = item.PrimaryImageTag;
} }
}
if (item.BackdropImageTag && item.BackdropItemId === item.Id) { if (item.BackdropImageTag && item.BackdropItemId === item.Id) {
item.BackdropImageTags = [item.BackdropImageTag]; item.BackdropImageTags = [item.BackdropImageTag];
} }

View File

@ -333,12 +333,10 @@ class YoutubePlayer {
setVolume(val) { setVolume(val) {
const currentYoutubePlayer = this.currentYoutubePlayer; const currentYoutubePlayer = this.currentYoutubePlayer;
if (currentYoutubePlayer) { if (currentYoutubePlayer && val != null) {
if (val != null) {
currentYoutubePlayer.setVolume(val); currentYoutubePlayer.setVolume(val);
} }
} }
}
getVolume() { getVolume() {
const currentYoutubePlayer = this.currentYoutubePlayer; const currentYoutubePlayer = this.currentYoutubePlayer;

View File

@ -324,11 +324,9 @@ if (browser.mobile || browser.tv) {
browser.slow = true; browser.slow = true;
} }
if (typeof document !== 'undefined') { /* eslint-disable-next-line compat/compat */
/* eslint-disable-next-line compat/compat */ if (typeof document !== 'undefined' && ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
browser.touch = true; browser.touch = true;
}
} }
browser.keyboard = hasKeyboard(browser); browser.keyboard = hasKeyboard(browser);

View File

@ -822,13 +822,13 @@ import browser from './browser';
maxH264Level = 52; maxH264Level = 52;
} }
if (browser.tizen || if ((browser.tizen ||
videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, '')) { videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, ''))
// These tests are passing in safari, but playback is failing // These tests are passing in safari, but playback is failing
if (!browser.safari && !browser.iOS && !browser.web0s && !browser.edge && !browser.mobile) { && !browser.safari && !browser.iOS && !browser.web0s && !browser.edge && !browser.mobile
) {
h264Profiles += '|high 10'; h264Profiles += '|high 10';
} }
}
let maxHevcLevel = 120; let maxHevcLevel = 120;
let hevcProfiles = 'main'; let hevcProfiles = 'main';

View File

@ -68,12 +68,10 @@ export function showLayoutMenu (button, currentLayout, views) {
cancelable: false cancelable: false
})); }));
if (!dispatchEvent) { if (!dispatchEvent && window.$) {
if (window.$) {
$(button).trigger('layoutchange', [id]); $(button).trigger('layoutchange', [id]);
} }
} }
}
}); });
}); });
} }

View File

@ -88,15 +88,13 @@ import dom from '../scripts/dom';
function onPointerEnter(e) { function onPointerEnter(e) {
const pointerType = e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse'); const pointerType = e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse');
if (pointerType === 'mouse') { if (pointerType === 'mouse' && !isMouseIdle) {
if (!isMouseIdle) {
const parent = focusManager.focusableParent(e.target); const parent = focusManager.focusableParent(e.target);
if (parent) { if (parent) {
focusManager.focus(parent); focusManager.focus(parent);
} }
} }
} }
}
function enableFocusWithMouse() { function enableFocusWithMouse() {
if (!layoutManager.tv) { if (!layoutManager.tv) {