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

Address review comments

This commit is contained in:
ferferga 2020-06-02 22:02:13 +02:00
parent d32dd7d7d8
commit 169ecacc62
2 changed files with 19 additions and 7 deletions

View file

@ -507,6 +507,7 @@ import 'programStyles';
let coverImage = false; let coverImage = false;
let uiAspect = null; let uiAspect = null;
let imgType = null; let imgType = null;
let itemId = null;
if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) { if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
imgType = 'Thumb'; imgType = 'Thumb';
@ -523,12 +524,15 @@ import 'programStyles';
} else if (options.preferLogo && item.ParentLogoImageTag && item.ParentLogoItemId) { } else if (options.preferLogo && item.ParentLogoImageTag && item.ParentLogoItemId) {
imgType = 'Logo'; imgType = 'Logo';
imgTag = item.ParentLogoImageTag; imgTag = item.ParentLogoImageTag;
itemId = item.ParentLogoItemId;
} else if (options.preferThumb && item.SeriesThumbImageTag && options.inheritThumb !== false) { } else if (options.preferThumb && item.SeriesThumbImageTag && options.inheritThumb !== false) {
imgType = 'Thumb'; imgType = 'Thumb';
imgTag = item.SeriesThumbImageTag; imgTag = item.SeriesThumbImageTag;
itemId = item.SeriesId;
} else if (options.preferThumb && item.ParentThumbItemId && options.inheritThumb !== false && item.MediaType !== 'Photo') { } else if (options.preferThumb && item.ParentThumbItemId && options.inheritThumb !== false && item.MediaType !== 'Photo') {
imgType = 'Thumb'; imgType = 'Thumb';
imgTag = item.ParentThumbImageTag; imgTag = item.ParentThumbImageTag;
itemId = item.ParentThumbItemId;
} else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) { } else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) {
imgType = 'Backdrop'; imgType = 'Backdrop';
imgTag = item.BackdropImageTags[0]; imgTag = item.BackdropImageTags[0];
@ -536,6 +540,7 @@ import 'programStyles';
} else if (options.preferThumb && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length && options.inheritThumb !== false && item.Type === 'Episode') { } else if (options.preferThumb && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length && options.inheritThumb !== false && item.Type === 'Episode') {
imgType = 'Backdrop'; imgType = 'Backdrop';
imgTag = item.ParentBackdropImageTags[0]; imgTag = item.ParentBackdropImageTags[0];
itemId = item.ParentBackdropItemId;
} else if (item.ImageTags && item.ImageTags.Primary) { } else if (item.ImageTags && item.ImageTags.Primary) {
imgType = 'Primary'; imgType = 'Primary';
imgTag = item.ImageTags.Primary; imgTag = item.ImageTags.Primary;
@ -555,6 +560,7 @@ import 'programStyles';
} else if (item.PrimaryImageTag) { } else if (item.PrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
imgTag = item.PrimaryImageTag; imgTag = item.PrimaryImageTag;
itemId = item.PrimaryImageItemId;
height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null; height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null;
if (options.preferThumb && options.showTitle !== false) { if (options.preferThumb && options.showTitle !== false) {
@ -570,12 +576,15 @@ import 'programStyles';
} else if (item.ParentPrimaryImageTag) { } else if (item.ParentPrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
imgTag = item.ParentPrimaryImageTag; imgTag = item.ParentPrimaryImageTag;
itemId = item.ParentPrimaryImageItemId;
} else if (item.SeriesPrimaryImageTag) { } else if (item.SeriesPrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
imgTag = item.SeriesPrimaryImageTag; imgTag = item.SeriesPrimaryImageTag;
itemId = item.SeriesId;
} else if (item.AlbumId && item.AlbumPrimaryImageTag) { } else if (item.AlbumId && item.AlbumPrimaryImageTag) {
imgType = 'Primary'; imgType = 'Primary';
imgTag = item.AlbumPrimaryImageTag; imgTag = item.AlbumPrimaryImageTag;
itemId = item.AlbumId;
height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null; height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null;
if (primaryImageAspectRatio) { if (primaryImageAspectRatio) {
@ -596,16 +605,23 @@ import 'programStyles';
} else if (item.SeriesThumbImageTag && options.inheritThumb !== false) { } else if (item.SeriesThumbImageTag && options.inheritThumb !== false) {
imgType = 'Thumb'; imgType = 'Thumb';
imgTag = item.SeriesThumbImageTag; imgTag = item.SeriesThumbImageTag;
itemId = item.SeriesId;
} else if (item.ParentThumbItemId && options.inheritThumb !== false) { } else if (item.ParentThumbItemId && options.inheritThumb !== false) {
imgType = 'Thumb'; imgType = 'Thumb';
imgTag = item.ParentThumbImageTag; imgTag = item.ParentThumbImageTag;
itemId = item.ParentThumbItemId;
} else if (item.ParentBackdropImageTags && item.ParentBackdropImageTags.length && options.inheritThumb !== false) { } else if (item.ParentBackdropImageTags && item.ParentBackdropImageTags.length && options.inheritThumb !== false) {
imgType = 'Backdrop'; imgType = 'Backdrop';
imgTag = item.ParentBackdropImageTags[0]; imgTag = item.ParentBackdropImageTags[0];
itemId = item.ParentBackdropItemId;
}
if (itemId === null) {
itemId = item.Id;
} }
if (imgTag && imgType) { if (imgTag && imgType) {
imgUrl = apiClient.getScaledImageUrl(item.Id, { imgUrl = apiClient.getScaledImageUrl(itemId, {
type: imgType, type: imgType,
maxHeight: height, maxHeight: height,
maxWidth: width, maxWidth: width,

View file

@ -88,7 +88,7 @@ import 'css!./style';
let preloaderImg = new Image(); let preloaderImg = new Image();
preloaderImg.src = url; preloaderImg.src = url;
// This is necessary, so switching between blurhash enabled and disabled works // This is necessary, so changing blurhash settings without reloading the page works
if (!userSettings.enableBlurhash()) { if (!userSettings.enableBlurhash()) {
elem.classList.add('lazy-hidden'); elem.classList.add('lazy-hidden');
} }
@ -129,11 +129,7 @@ import 'css!./style';
if (userSettings.enableBlurhash()) { if (userSettings.enableBlurhash()) {
switchCanvas(elem); switchCanvas(elem);
} else { } else {
if (userSettings.enableFastFadein()) { elem.classList.remove('lazy-image-fadein-fast', 'lazy-image-fadein');
elem.classList.remove('lazy-image-fadein-fast');
} else {
elem.classList.remove('lazy-image-fadein');
}
elem.classList.add('lazy-hidden'); elem.classList.add('lazy-hidden');
} }
} }