mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Simplify code with object shorthand syntax
This commit is contained in:
parent
a3c330b4e1
commit
cf5d65d86e
5 changed files with 23 additions and 28 deletions
|
@ -1261,7 +1261,7 @@ import { appRouter } from '../appRouter';
|
||||||
logoUrl = null;
|
logoUrl = null;
|
||||||
|
|
||||||
footerCssClass = progressHtml ? 'innerCardFooter fullInnerCardFooter' : 'innerCardFooter';
|
footerCssClass = progressHtml ? 'innerCardFooter fullInnerCardFooter' : 'innerCardFooter';
|
||||||
innerCardFooter += getCardFooterText(item, apiClient, options, footerCssClass, progressHtml, {forceName: forceName, overlayText: overlayText, isOuterFooter: false}, {imgUrl: imgUrl, logoUrl: logoUrl});
|
innerCardFooter += getCardFooterText(item, apiClient, options, footerCssClass, progressHtml, { forceName, overlayText, isOuterFooter: false }, { imgUrl, logoUrl });
|
||||||
footerOverlayed = true;
|
footerOverlayed = true;
|
||||||
} else if (progressHtml) {
|
} else if (progressHtml) {
|
||||||
innerCardFooter += '<div class="innerCardFooter fullInnerCardFooter innerCardFooterClear">';
|
innerCardFooter += '<div class="innerCardFooter fullInnerCardFooter innerCardFooterClear">';
|
||||||
|
@ -1288,7 +1288,7 @@ import { appRouter } from '../appRouter';
|
||||||
logoUrl = null;
|
logoUrl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
outerCardFooter = getCardFooterText(item, apiClient, options, footerCssClass, progressHtml, {forceName: forceName, overlayText: overlayText, isOuterFooter: true}, {imgUrl: imgUrl, logoUrl: logoUrl});
|
outerCardFooter = getCardFooterText(item, apiClient, options, footerCssClass, progressHtml, { forceName, overlayText, isOuterFooter: true }, { imgUrl, logoUrl });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outerCardFooter && !options.cardLayout) {
|
if (outerCardFooter && !options.cardLayout) {
|
||||||
|
|
|
@ -345,7 +345,7 @@ function Guide(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
apiClient.getLiveTvPrograms(programQuery).then(function (programsResult) {
|
apiClient.getLiveTvPrograms(programQuery).then(function (programsResult) {
|
||||||
const guideOptions = {focusProgramOnRender: focusProgramOnRender, scrollToTimeMs: scrollToTimeMs, focusToTimeMs: focusToTimeMs, startTimeOfDayMs: startTimeOfDayMs};
|
const guideOptions = { focusProgramOnRender, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs };
|
||||||
|
|
||||||
renderGuide(context, date, channelsResult.Items, programsResult.Items, renderOptions, guideOptions, apiClient);
|
renderGuide(context, date, channelsResult.Items, programsResult.Items, renderOptions, guideOptions, apiClient);
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ import template from './imageeditor.template.html';
|
||||||
|
|
||||||
for (let i = 0, length = images.length; i < length; i++) {
|
for (let i = 0, length = images.length; i < length; i++) {
|
||||||
const image = images[i];
|
const image = images[i];
|
||||||
const options = {index: i, numImages: length, imageProviders: imageProviders, imageSize: imageSize, tagName: tagName, enableFooterButtons: enableFooterButtons};
|
const options = { index: i, numImages: length, imageProviders, imageSize, tagName, enableFooterButtons };
|
||||||
html += getCardHtml(image, apiClient, options);
|
html += getCardHtml(image, apiClient, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ function getAudioStreamUrlFromDeviceProfile(item, deviceProfile, maxBitrate, api
|
||||||
|
|
||||||
const maxValues = getAudioMaxValues(deviceProfile);
|
const maxValues = getAudioMaxValues(deviceProfile);
|
||||||
|
|
||||||
return getAudioStreamUrl(item, transcodingProfile, directPlayContainers, apiClient, startPosition, { maxBitrate: maxBitrate, ...maxValues });
|
return getAudioStreamUrl(item, transcodingProfile, directPlayContainers, apiClient, startPosition, { maxBitrate, ...maxValues });
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStreamUrls(items, deviceProfile, maxBitrate, apiClient, startPosition) {
|
function getStreamUrls(items, deviceProfile, maxBitrate, apiClient, startPosition) {
|
||||||
|
@ -377,7 +377,7 @@ function getStreamUrls(items, deviceProfile, maxBitrate, apiClient, startPositio
|
||||||
let streamUrl;
|
let streamUrl;
|
||||||
|
|
||||||
if (item.MediaType === 'Audio' && !itemHelper.isLocalItem(item)) {
|
if (item.MediaType === 'Audio' && !itemHelper.isLocalItem(item)) {
|
||||||
streamUrl = getAudioStreamUrl(item, audioTranscodingProfile, audioDirectPlayContainers, apiClient, startPosition, { maxBitrate: maxBitrate, ...maxValues });
|
streamUrl = getAudioStreamUrl(item, audioTranscodingProfile, audioDirectPlayContainers, apiClient, startPosition, { maxBitrate, ...maxValues });
|
||||||
}
|
}
|
||||||
|
|
||||||
streamUrls.push(streamUrl || '');
|
streamUrls.push(streamUrl || '');
|
||||||
|
@ -1722,11 +1722,11 @@ class PlaybackManager {
|
||||||
const currentPlayOptions = currentItem.playOptions || getDefaultPlayOptions();
|
const currentPlayOptions = currentItem.playOptions || getDefaultPlayOptions();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
maxBitrate: maxBitrate,
|
maxBitrate,
|
||||||
startPosition: ticks,
|
startPosition: ticks,
|
||||||
isPlayback: true,
|
isPlayback: true,
|
||||||
audioStreamIndex: audioStreamIndex,
|
audioStreamIndex,
|
||||||
subtitleStreamIndex: subtitleStreamIndex,
|
subtitleStreamIndex,
|
||||||
enableDirectPlay: params.EnableDirectPlay,
|
enableDirectPlay: params.EnableDirectPlay,
|
||||||
enableDirectStream: params.EnableDirectStream,
|
enableDirectStream: params.EnableDirectStream,
|
||||||
allowVideoStreamCopy: params.AllowVideoStreamCopy,
|
allowVideoStreamCopy: params.AllowVideoStreamCopy,
|
||||||
|
@ -2304,9 +2304,9 @@ class PlaybackManager {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
return player.play({
|
return player.play({
|
||||||
items: items,
|
items,
|
||||||
startPositionTicks: options.startPosition || 0,
|
startPositionTicks: options.startPosition || 0,
|
||||||
mediaSourceId: mediaSourceId,
|
mediaSourceId,
|
||||||
audioStreamIndex: options.audioStreamIndex,
|
audioStreamIndex: options.audioStreamIndex,
|
||||||
subtitleStreamIndex: options.subtitleStreamIndex,
|
subtitleStreamIndex: options.subtitleStreamIndex,
|
||||||
startIndex: options.startIndex
|
startIndex: options.startIndex
|
||||||
|
@ -2471,11 +2471,11 @@ class PlaybackManager {
|
||||||
const audioStreamIndex = playOptions.audioStreamIndex;
|
const audioStreamIndex = playOptions.audioStreamIndex;
|
||||||
const subtitleStreamIndex = playOptions.subtitleStreamIndex;
|
const subtitleStreamIndex = playOptions.subtitleStreamIndex;
|
||||||
const options = {
|
const options = {
|
||||||
maxBitrate: maxBitrate,
|
maxBitrate,
|
||||||
startPosition: startPosition,
|
startPosition,
|
||||||
isPlayback: null,
|
isPlayback: null,
|
||||||
audioStreamIndex: audioStreamIndex,
|
audioStreamIndex,
|
||||||
subtitleStreamIndex: subtitleStreamIndex,
|
subtitleStreamIndex,
|
||||||
startIndex: playOptions.startIndex,
|
startIndex: playOptions.startIndex,
|
||||||
enableDirectPlay: null,
|
enableDirectPlay: null,
|
||||||
enableDirectStream: null,
|
enableDirectStream: null,
|
||||||
|
@ -2549,8 +2549,8 @@ class PlaybackManager {
|
||||||
|
|
||||||
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
||||||
const mediaOptions = {
|
const mediaOptions = {
|
||||||
maxBitrate: maxBitrate,
|
maxBitrate,
|
||||||
startPosition: startPosition,
|
startPosition,
|
||||||
isPlayback: null,
|
isPlayback: null,
|
||||||
audioStreamIndex: options.audioStreamIndex,
|
audioStreamIndex: options.audioStreamIndex,
|
||||||
subtitleStreamIndex: options.subtitleStreamIndex,
|
subtitleStreamIndex: options.subtitleStreamIndex,
|
||||||
|
@ -2582,8 +2582,8 @@ class PlaybackManager {
|
||||||
|
|
||||||
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
||||||
const mediaOptions = {
|
const mediaOptions = {
|
||||||
maxBitrate: maxBitrate,
|
maxBitrate,
|
||||||
startPosition: startPosition,
|
startPosition,
|
||||||
isPlayback: true,
|
isPlayback: true,
|
||||||
audioStreamIndex: null,
|
audioStreamIndex: null,
|
||||||
subtitleStreamIndex: null,
|
subtitleStreamIndex: null,
|
||||||
|
|
|
@ -99,12 +99,7 @@ function getIconsHtml(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconCssClass = options.iconCssClass;
|
const iconCssClass = options.iconCssClass;
|
||||||
|
const classes = { buttonCssClass: btnCssClass, iconCssClass: iconCssClass };
|
||||||
const classes = {
|
|
||||||
buttonCssClass: btnCssClass,
|
|
||||||
iconCssClass: iconCssClass
|
|
||||||
};
|
|
||||||
|
|
||||||
const serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
|
|
||||||
if (includePlayed !== false) {
|
if (includePlayed !== false) {
|
||||||
|
@ -113,7 +108,7 @@ function getIconsHtml(options) {
|
||||||
if (itemHelper.canMarkPlayed(item)) {
|
if (itemHelper.canMarkPlayed(item)) {
|
||||||
if (userData.Played) {
|
if (userData.Played) {
|
||||||
const buttonCssClass = classes.buttonCssClass + ' btnUserDataOn';
|
const buttonCssClass = classes.buttonCssClass + ' btnUserDataOn';
|
||||||
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, {buttonCssClass: buttonCssClass, ...classes});
|
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, { buttonCssClass, ...classes });
|
||||||
} else {
|
} else {
|
||||||
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, classes);
|
html += getUserDataButtonHtml('markPlayed', itemId, serverId, 'check', tooltipPlayed, style, classes);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +118,7 @@ function getIconsHtml(options) {
|
||||||
const tooltipFavorite = globalize.translate('Favorite');
|
const tooltipFavorite = globalize.translate('Favorite');
|
||||||
if (userData.IsFavorite) {
|
if (userData.IsFavorite) {
|
||||||
const buttonCssClass = classes.buttonCssClass + ' btnUserData btnUserDataOn';
|
const buttonCssClass = classes.buttonCssClass + ' btnUserData btnUserDataOn';
|
||||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, {buttonCssClass: buttonCssClass, ...classes});
|
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, { buttonCssClass, ...classes });
|
||||||
} else {
|
} else {
|
||||||
classes.buttonCssClass += ' btnUserData';
|
classes.buttonCssClass += ' btnUserData';
|
||||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, classes);
|
html += getUserDataButtonHtml('markFavorite', itemId, serverId, 'favorite', tooltipFavorite, style, classes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue