1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #1333 from MrTimscampi/another-lint-bites-the-dust

Kill Yoda
This commit is contained in:
dkanada 2020-07-31 21:48:18 +09:00 committed by GitHub
commit f430518d45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 442 additions and 441 deletions

View file

@ -22,18 +22,18 @@ import 'css!assets/css/videoosd';
/* eslint-disable indent */
function seriesImageUrl(item, options) {
if ('Episode' !== item.Type) {
if (item.Type !== 'Episode') {
return null;
}
options = options || {};
options.type = options.type || 'Primary';
if ('Primary' === options.type && item.SeriesPrimaryImageTag) {
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
}
if ('Thumb' === options.type) {
if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
@ -57,7 +57,7 @@ import 'css!assets/css/videoosd';
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
}
if ('Primary' === options.type && item.AlbumId && item.AlbumPrimaryImageTag) {
if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
}
@ -104,7 +104,7 @@ import 'css!assets/css/videoosd';
function onDoubleClick(e) {
const clientX = e.clientX;
if (null != clientX) {
if (clientX != null) {
if (clientX < dom.getWindowSize().innerWidth / 2) {
playbackManager.rewind(currentPlayer);
} else {
@ -117,7 +117,7 @@ import 'css!assets/css/videoosd';
}
function getDisplayItem(item) {
if ('TvChannel' === item.Type) {
if (item.Type === 'TvChannel') {
const apiClient = connectionManager.getApiClient(item.ServerId);
return apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (refreshedItem) {
return {
@ -133,7 +133,7 @@ import 'css!assets/css/videoosd';
}
function updateRecordingButton(item) {
if (!item || 'Program' !== item.Type) {
if (!item || item.Type !== 'Program') {
if (recordingButtonManager) {
recordingButtonManager.destroy();
recordingButtonManager = null;
@ -176,8 +176,8 @@ import 'css!assets/css/videoosd';
const osdTitle = view.querySelector('.osdTitle');
titleElement = osdTitle;
let displayName = itemHelper.getDisplayName(displayItem, {
includeParentInfo: 'Program' !== displayItem.Type,
includeIndexNumber: 'Program' !== displayItem.Type
includeParentInfo: displayItem.Type !== 'Program',
includeIndexNumber: displayItem.Type !== 'Program'
});
if (!displayName) {
@ -198,8 +198,8 @@ import 'css!assets/css/videoosd';
tomatoes: false,
endsAt: false,
episodeTitle: false,
originalAirDate: 'Program' !== displayItem.Type,
episodeTitleIndexNumber: 'Program' !== displayItem.Type,
originalAirDate: displayItem.Type !== 'Program',
episodeTitleIndexNumber: displayItem.Type !== 'Program',
programIndicator: false
});
const osdMediaInfo = view.querySelector('.osdMediaInfo');
@ -271,7 +271,7 @@ import 'css!assets/css/videoosd';
}
function shouldEnableProgressByTimeOfDay(item) {
return !('TvChannel' !== item.Type || !item.CurrentProgram);
return !(item.Type !== 'TvChannel' || !item.CurrentProgram);
}
function updateNowPlayingInfo(player, state) {
@ -372,7 +372,7 @@ import 'css!assets/css/videoosd';
}
function toggleOsd() {
if ('osd' === currentVisibleMenu) {
if (currentVisibleMenu === 'osd') {
hideOsd();
} else if (!currentVisibleMenu) {
showOsd();
@ -433,7 +433,7 @@ import 'css!assets/css/videoosd';
}
function hideMainOsdControls() {
if ('osd' === currentVisibleMenu) {
if (currentVisibleMenu === 'osd') {
const elem = osdBottomElement;
clearHideAnimationEventListeners(elem);
elem.classList.add('videoOsdBottom-hidden');
@ -463,7 +463,7 @@ import 'css!assets/css/videoosd';
}
function onPointerMove(e) {
if ('mouse' === (e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse'))) {
if ((e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse')) === 'mouse') {
const eventX = e.screenX || 0;
const eventY = e.screenY || 0;
const obj = lastPointerMoveData;
@ -491,7 +491,7 @@ import 'css!assets/css/videoosd';
switch (e.detail.command) {
case 'left':
if ('osd' === currentVisibleMenu) {
if (currentVisibleMenu === 'osd') {
showOsd();
} else {
if (!currentVisibleMenu) {
@ -503,7 +503,7 @@ import 'css!assets/css/videoosd';
break;
case 'right':
if ('osd' === currentVisibleMenu) {
if (currentVisibleMenu === 'osd') {
showOsd();
} else if (!currentVisibleMenu) {
e.preventDefault();
@ -618,7 +618,7 @@ import 'css!assets/css/videoosd';
resetUpNextDialog();
console.debug('nowplaying event: ' + e.type);
if ('Video' !== state.NextMediaType) {
if (state.NextMediaType !== 'Video') {
view.removeEventListener('viewbeforehide', onViewHideStopPlayback);
Emby.Page.back();
}
@ -705,7 +705,7 @@ import 'css!assets/css/videoosd';
}
function showComingUpNextIfNeeded(player, currentItem, currentTimeTicks, runtimeTicks) {
if (runtimeTicks && currentTimeTicks && !comingUpNextDisplayed && !currentVisibleMenu && 'Episode' === currentItem.Type && userSettings.enableNextVideoInfoOverlay()) {
if (runtimeTicks && currentTimeTicks && !comingUpNextDisplayed && !currentVisibleMenu && currentItem.Type === 'Episode' && userSettings.enableNextVideoInfoOverlay()) {
const showAtSecondsLeft = runtimeTicks >= 3e10 ? 40 : runtimeTicks >= 24e9 ? 35 : 30;
const showAtTicks = runtimeTicks - 1e3 * showAtSecondsLeft * 1e4;
const timeRemainingTicks = runtimeTicks - currentTimeTicks;
@ -717,7 +717,7 @@ import 'css!assets/css/videoosd';
}
function onUpNextHidden() {
if ('upnext' === currentVisibleMenu) {
if (currentVisibleMenu === 'upnext') {
currentVisibleMenu = null;
}
}
@ -740,7 +740,7 @@ import 'css!assets/css/videoosd';
}
function refreshProgramInfoIfNeeded(player, item) {
if ('TvChannel' === item.Type) {
if (item.Type === 'TvChannel') {
const program = item.CurrentProgram;
if (program && program.EndDate) {
@ -781,7 +781,7 @@ import 'css!assets/css/videoosd';
updatePlayPauseState(playState.IsPaused);
const supportedCommands = playbackManager.getSupportedCommands(player);
currentPlayerSupportedCommands = supportedCommands;
supportsBrightnessChange = -1 !== supportedCommands.indexOf('SetBrightness');
supportsBrightnessChange = supportedCommands.indexOf('SetBrightness') !== -1;
updatePlayerVolumeState(player, playState.IsMuted, playState.VolumeLevel);
if (nowPlayingPositionSlider && !nowPlayingPositionSlider.dragging) {
@ -795,13 +795,13 @@ import 'css!assets/css/videoosd';
updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playState.PlaybackStartTimeTicks, playState.BufferedRanges || []);
updateNowPlayingInfo(player, state);
if (state.MediaSource && state.MediaSource.SupportsTranscoding && -1 !== supportedCommands.indexOf('SetMaxStreamingBitrate')) {
if (state.MediaSource && state.MediaSource.SupportsTranscoding && supportedCommands.indexOf('SetMaxStreamingBitrate') !== -1) {
view.querySelector('.btnVideoOsdSettings').classList.remove('hide');
} else {
view.querySelector('.btnVideoOsdSettings').classList.add('hide');
}
const isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks;
const isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
nowPlayingPositionSlider.setIsClear(isProgressClear);
if (nowPlayingItem.RunTimeTicks) {
@ -809,19 +809,19 @@ import 'css!assets/css/videoosd';
userSettings.skipForwardLength() * 1000000 / nowPlayingItem.RunTimeTicks);
}
if (-1 === supportedCommands.indexOf('ToggleFullscreen') || player.isLocalPlayer && layoutManager.tv && playbackManager.isFullscreen(player)) {
if (supportedCommands.indexOf('ToggleFullscreen') === -1 || player.isLocalPlayer && layoutManager.tv && playbackManager.isFullscreen(player)) {
view.querySelector('.btnFullscreen').classList.add('hide');
} else {
view.querySelector('.btnFullscreen').classList.remove('hide');
}
if (-1 === supportedCommands.indexOf('PictureInPicture')) {
if (supportedCommands.indexOf('PictureInPicture') === -1) {
view.querySelector('.btnPip').classList.add('hide');
} else {
view.querySelector('.btnPip').classList.remove('hide');
}
if (-1 === supportedCommands.indexOf('AirPlay')) {
if (supportedCommands.indexOf('AirPlay') === -1) {
view.querySelector('.btnAirPlay').classList.add('hide');
} else {
view.querySelector('.btnAirPlay').classList.remove('hide');
@ -869,7 +869,7 @@ import 'css!assets/css/videoosd';
nowPlayingPositionSlider.value = 0;
}
if (runtimeTicks && null != positionTicks && currentRuntimeTicks && !enableProgressByTimeOfDay && currentItem.RunTimeTicks && 'Recording' !== currentItem.Type) {
if (runtimeTicks && positionTicks != null && currentRuntimeTicks && !enableProgressByTimeOfDay && currentItem.RunTimeTicks && currentItem.Type !== 'Recording') {
endsAtText.innerHTML = '&nbsp;&nbsp;-&nbsp;&nbsp;' + mediaInfo.getEndsAtFromPosition(runtimeTicks, positionTicks, true);
} else {
endsAtText.innerHTML = '';
@ -890,11 +890,11 @@ import 'css!assets/css/videoosd';
let showMuteButton = true;
let showVolumeSlider = true;
if (-1 === supportedCommands.indexOf('Mute')) {
if (supportedCommands.indexOf('Mute') === -1) {
showMuteButton = false;
}
if (-1 === supportedCommands.indexOf('SetVolume')) {
if (supportedCommands.indexOf('SetVolume') === -1) {
showVolumeSlider = false;
}
@ -945,7 +945,7 @@ import 'css!assets/css/videoosd';
}
function updateTimeText(elem, ticks, divider) {
if (null == ticks) {
if (ticks == null) {
elem.innerHTML = '';
return;
}
@ -987,9 +987,9 @@ import 'css!assets/css/videoosd';
}
function onSettingsOption(selectedOption) {
if ('stats' === selectedOption) {
if (selectedOption === 'stats') {
toggleStats();
} else if ('suboffset' === selectedOption) {
} else if (selectedOption === 'suboffset') {
const player = currentPlayer;
if (player) {
playbackManager.enableShowingSubtitleOffset(player);
@ -1063,7 +1063,7 @@ import 'css!assets/css/videoosd';
const streams = playbackManager.subtitleTracks(player);
let currentIndex = playbackManager.getSubtitleStreamIndex(player);
if (null == currentIndex) {
if (currentIndex == null) {
currentIndex = -1;
}
@ -1136,7 +1136,7 @@ import 'css!assets/css/videoosd';
const key = keyboardnavigation.getKeyName(e);
const isKeyModified = e.ctrlKey || e.altKey || e.metaKey;
if (!currentVisibleMenu && 32 === e.keyCode) {
if (!currentVisibleMenu && e.keyCode === 32) {
playbackManager.playPause(currentPlayer);
showOsd();
return;