mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #4704 from thornbill/eslint-sonar-updates
This commit is contained in:
commit
71ec7c57f5
99 changed files with 263 additions and 287 deletions
|
@ -47,7 +47,7 @@ function showPlaybackInfo(btn, session) {
|
|||
text.push(globalize.translate('MediaIsBeingConverted'));
|
||||
text.push(DashboardPage.getSessionNowPlayingStreamInfo(session));
|
||||
|
||||
if (session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length) {
|
||||
if (session.TranscodingInfo?.TranscodeReasons?.length) {
|
||||
text.push('<br/>');
|
||||
text.push(globalize.translate('LabelReasonForTranscoding'));
|
||||
session.TranscodingInfo.TranscodeReasons.forEach(function (transcodeReason) {
|
||||
|
@ -90,7 +90,7 @@ function showOptionsMenu(btn, session) {
|
|||
});
|
||||
}
|
||||
|
||||
if (session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length) {
|
||||
if (session.TranscodingInfo?.TranscodeReasons?.length) {
|
||||
menuItems.push({
|
||||
name: globalize.translate('ViewPlaybackInfo'),
|
||||
id: 'transcodinginfo'
|
||||
|
@ -402,7 +402,7 @@ window.DashboardPage = {
|
|||
} else if (displayPlayMethod === 'DirectStream') {
|
||||
html += globalize.translate('DirectStreaming');
|
||||
} else if (displayPlayMethod === 'Transcode') {
|
||||
if (session.TranscodingInfo && session.TranscodingInfo.Framerate) {
|
||||
if (session.TranscodingInfo?.Framerate) {
|
||||
html += `${globalize.translate('Framerate')}: ${session.TranscodingInfo.Framerate}fps`;
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ window.DashboardPage = {
|
|||
let topText = escapeHtml(itemHelper.getDisplayName(nowPlayingItem));
|
||||
let bottomText = '';
|
||||
|
||||
if (nowPlayingItem.Artists && nowPlayingItem.Artists.length) {
|
||||
if (nowPlayingItem.Artists?.length) {
|
||||
bottomText = topText;
|
||||
topText = escapeHtml(nowPlayingItem.Artists[0]);
|
||||
} else {
|
||||
|
@ -493,7 +493,7 @@ window.DashboardPage = {
|
|||
}
|
||||
}
|
||||
|
||||
if (nowPlayingItem.ImageTags && nowPlayingItem.ImageTags.Logo) {
|
||||
if (nowPlayingItem.ImageTags?.Logo) {
|
||||
imgUrl = ApiClient.getScaledImageUrl(nowPlayingItem.Id, {
|
||||
tag: nowPlayingItem.ImageTags.Logo,
|
||||
maxHeight: 24,
|
||||
|
@ -571,7 +571,7 @@ window.DashboardPage = {
|
|||
|
||||
const btnSessionPlayPauseIcon = btnSessionPlayPause.querySelector('.material-icons');
|
||||
btnSessionPlayPauseIcon.classList.remove('play_arrow', 'pause');
|
||||
btnSessionPlayPauseIcon.classList.add(session.PlayState && session.PlayState.IsPaused ? 'play_arrow' : 'pause');
|
||||
btnSessionPlayPauseIcon.classList.add(session.PlayState?.IsPaused ? 'play_arrow' : 'pause');
|
||||
|
||||
row.querySelector('.sessionNowPlayingTime').innerText = DashboardPage.getSessionNowPlayingTime(session);
|
||||
row.querySelector('.sessionUserName').innerHTML = DashboardPage.getUsersHtml(session);
|
||||
|
@ -620,7 +620,7 @@ window.DashboardPage = {
|
|||
getNowPlayingImageUrl: function (item) {
|
||||
/* Screen width is multiplied by 0.2, as the there is currently no way to get the width of
|
||||
elements that aren't created yet. */
|
||||
if (item && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
if (item?.BackdropImageTags?.length) {
|
||||
return ApiClient.getScaledImageUrl(item.Id, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Backdrop',
|
||||
|
@ -628,7 +628,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||
if (item?.ParentBackdropImageTags?.length) {
|
||||
return ApiClient.getScaledImageUrl(item.ParentBackdropItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Backdrop',
|
||||
|
@ -636,7 +636,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.BackdropImageTag) {
|
||||
if (item?.BackdropImageTag) {
|
||||
return ApiClient.getScaledImageUrl(item.BackdropItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Backdrop',
|
||||
|
@ -644,7 +644,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
const imageTags = (item || {}).ImageTags || {};
|
||||
const imageTags = item?.ImageTags || {};
|
||||
|
||||
if (item && imageTags.Thumb) {
|
||||
return ApiClient.getScaledImageUrl(item.Id, {
|
||||
|
@ -654,7 +654,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.ParentThumbImageTag) {
|
||||
if (item?.ParentThumbImageTag) {
|
||||
return ApiClient.getScaledImageUrl(item.ParentThumbItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Thumb',
|
||||
|
@ -662,7 +662,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.ThumbImageTag) {
|
||||
if (item?.ThumbImageTag) {
|
||||
return ApiClient.getScaledImageUrl(item.ThumbItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Thumb',
|
||||
|
@ -678,7 +678,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.PrimaryImageTag) {
|
||||
if (item?.PrimaryImageTag) {
|
||||
return ApiClient.getScaledImageUrl(item.PrimaryImageItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Primary',
|
||||
|
@ -686,7 +686,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
|
||||
if (item && item.AlbumPrimaryImageTag) {
|
||||
if (item?.AlbumPrimaryImageTag) {
|
||||
return ApiClient.getScaledImageUrl(item.AlbumId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.20),
|
||||
type: 'Primary',
|
||||
|
|
|
@ -415,7 +415,7 @@ function renderContainerProfiles(page, profiles) {
|
|||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
if (profile.Conditions?.length) {
|
||||
html += '<p>';
|
||||
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
|
@ -487,7 +487,7 @@ function renderCodecProfiles(page, profiles) {
|
|||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += '<p>' + globalize.translate('ValueCodec', profile.Codec || allText) + '</p>';
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
if (profile.Conditions?.length) {
|
||||
html += '<p>';
|
||||
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
|
@ -567,7 +567,7 @@ function renderResponseProfiles(page, profiles) {
|
|||
}
|
||||
}
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
if (profile.Conditions?.length) {
|
||||
html += '<p>';
|
||||
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
|
|
|
@ -13,8 +13,8 @@ import confirm from '../../components/confirm/confirm';
|
|||
import cardBuilder from '../../components/cardbuilder/cardBuilder';
|
||||
|
||||
function addVirtualFolder(page) {
|
||||
import('../../components/mediaLibraryCreator/mediaLibraryCreator').then(({ default: medialibrarycreator }) => {
|
||||
new medialibrarycreator({
|
||||
import('../../components/mediaLibraryCreator/mediaLibraryCreator').then(({ default: MediaLibraryCreator }) => {
|
||||
new MediaLibraryCreator({
|
||||
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
||||
return !f.hidden;
|
||||
}),
|
||||
|
@ -28,8 +28,8 @@ function addVirtualFolder(page) {
|
|||
}
|
||||
|
||||
function editVirtualFolder(page, virtualFolder) {
|
||||
import('../../components/mediaLibraryEditor/mediaLibraryEditor').then(({ default: medialibraryeditor }) => {
|
||||
new medialibraryeditor({
|
||||
import('../../components/mediaLibraryEditor/mediaLibraryEditor').then(({ default: MediaLibraryEditor }) => {
|
||||
new MediaLibraryEditor({
|
||||
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||
library: virtualFolder
|
||||
}).then(function (hasChanges) {
|
||||
|
@ -62,8 +62,8 @@ function deleteVirtualFolder(page, virtualFolder) {
|
|||
}
|
||||
|
||||
function refreshVirtualFolder(page, virtualFolder) {
|
||||
import('../../components/refreshdialog/refreshdialog').then(({ default: refreshDialog }) => {
|
||||
new refreshDialog({
|
||||
import('../../components/refreshdialog/refreshdialog').then(({ default: RefreshDialog }) => {
|
||||
new RefreshDialog({
|
||||
itemIds: [virtualFolder.ItemId],
|
||||
serverId: ApiClient.serverId(),
|
||||
mode: 'scan'
|
||||
|
|
|
@ -24,12 +24,6 @@ function fillTimeOfDay(select) {
|
|||
}).join('');
|
||||
}
|
||||
|
||||
Array.prototype.remove = function (from, to) {
|
||||
const rest = this.slice((to || from) + 1 || this.length);
|
||||
this.length = from < 0 ? this.length + from : from;
|
||||
return this.push.apply(this, rest);
|
||||
};
|
||||
|
||||
const ScheduledTaskPage = {
|
||||
refreshScheduledTask: function (view) {
|
||||
loading.show();
|
||||
|
@ -143,7 +137,7 @@ const ScheduledTaskPage = {
|
|||
loading.show();
|
||||
const id = getParameterByName('id');
|
||||
ApiClient.getScheduledTask(id).then(function (task) {
|
||||
task.Triggers.remove(index);
|
||||
task.Triggers.splice(index, 1);
|
||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||
ScheduledTaskPage.refreshScheduledTask(view);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue