Refactor item details backdrop handling
This commit is contained in:
parent
eff01b3d43
commit
c5a29be2c6
10 changed files with 50 additions and 21 deletions
|
@ -213,8 +213,8 @@ function enabled() {
|
||||||
let rotationInterval;
|
let rotationInterval;
|
||||||
let currentRotatingImages = [];
|
let currentRotatingImages = [];
|
||||||
let currentRotationIndex = -1;
|
let currentRotationIndex = -1;
|
||||||
export function setBackdrops(items, imageOptions, enableImageRotation) {
|
export function setBackdrops(items, imageOptions, enableImageRotation, isEnabled = false) {
|
||||||
if (enabled()) {
|
if (isEnabled || enabled()) {
|
||||||
const images = getImageUrls(items, imageOptions);
|
const images = getImageUrls(items, imageOptions);
|
||||||
|
|
||||||
if (images.length) {
|
if (images.length) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<div class="detailLogo"></div>
|
<div class="detailLogo"></div>
|
||||||
|
|
||||||
<div class="detailPageWrapperContainer padded-bottom-page">
|
<div class="detailPageWrapperContainer">
|
||||||
<div class="detailPagePrimaryContainer padded-left padded-right">
|
<div class="detailPagePrimaryContainer padded-left padded-right">
|
||||||
<div class="infoWrapper">
|
<div class="infoWrapper">
|
||||||
<div class="detailImageContainer padded-left"></div>
|
<div class="detailImageContainer padded-left"></div>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="detailPageSecondaryContainer">
|
<div class="detailPageSecondaryContainer padded-bottom-page">
|
||||||
<div class="detailPageContent">
|
<div class="detailPageContent">
|
||||||
<div class="detailPagePrimaryContent padded-right">
|
<div class="detailPagePrimaryContent padded-right">
|
||||||
<div class="detailSection">
|
<div class="detailSection">
|
||||||
|
|
|
@ -487,15 +487,19 @@ function setTrailerButtonVisibility(page, item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderBackdrop(item) {
|
function renderBackdrop(page, item) {
|
||||||
if (!layoutManager.mobile && dom.getWindowSize().innerWidth >= 1000) {
|
if (!layoutManager.mobile && dom.getWindowSize().innerWidth >= 1000) {
|
||||||
setBackdrops([item]);
|
const isBannerEnabled = !layoutManager.tv && userSettings.detailsBanner();
|
||||||
|
// If backdrops are disabled, but the header banner is enabled, add a class to the page to disable the transparency
|
||||||
|
page.classList.toggle('noBackdropTransparency', isBannerEnabled && !userSettings.enableBackdrops());
|
||||||
|
|
||||||
|
setBackdrops([item], null, null, isBannerEnabled);
|
||||||
} else {
|
} else {
|
||||||
clearBackdrop();
|
clearBackdrop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDetailPageBackdrop(page, item, apiClient) {
|
function renderHeaderBackdrop(page, item, apiClient) {
|
||||||
// Details banner is disabled in user settings
|
// Details banner is disabled in user settings
|
||||||
if (!userSettings.detailsBanner()) {
|
if (!userSettings.detailsBanner()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -509,7 +513,7 @@ function renderDetailPageBackdrop(page, item, apiClient) {
|
||||||
let hasbackdrop = false;
|
let hasbackdrop = false;
|
||||||
const itemBackdropElement = page.querySelector('#itemBackdrop');
|
const itemBackdropElement = page.querySelector('#itemBackdrop');
|
||||||
|
|
||||||
const imgUrl = getItemBackdropImageUrl(apiClient, item, { maxWitdh: dom.getScreenWidth() }, false);
|
const imgUrl = getItemBackdropImageUrl(apiClient, item, { maxWidth: dom.getScreenWidth() }, false);
|
||||||
|
|
||||||
if (imgUrl) {
|
if (imgUrl) {
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
|
@ -531,10 +535,13 @@ function reloadFromItem(instance, page, params, item, user) {
|
||||||
// Save some screen real estate in TV mode
|
// Save some screen real estate in TV mode
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
renderLogo(page, item, apiClient);
|
renderLogo(page, item, apiClient);
|
||||||
renderDetailPageBackdrop(page, item, apiClient);
|
}
|
||||||
|
// Render the mobile header backdrop
|
||||||
|
if (layoutManager.mobile) {
|
||||||
|
renderHeaderBackdrop(page, item, apiClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderBackdrop(item);
|
renderBackdrop(page, item);
|
||||||
|
|
||||||
// Render the main information for the item
|
// Render the main information for the item
|
||||||
page.querySelector('.detailPagePrimaryContainer').classList.add('detailRibbon');
|
page.querySelector('.detailPagePrimaryContainer').classList.add('detailRibbon');
|
||||||
|
@ -2026,7 +2033,7 @@ export default function (view, params) {
|
||||||
if (currentItem) {
|
if (currentItem) {
|
||||||
libraryMenu.setTitle('');
|
libraryMenu.setTitle('');
|
||||||
renderTrackSelections(page, self, currentItem, true);
|
renderTrackSelections(page, self, currentItem, true);
|
||||||
renderBackdrop(currentItem);
|
renderBackdrop(page, currentItem);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reload(self, page, params);
|
reload(self, page, params);
|
||||||
|
|
|
@ -579,14 +579,6 @@
|
||||||
height: 30vh;
|
height: 30vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop &::after {
|
|
||||||
content: "";
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: rgba(0, 0, 0, 0.65);
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-tv .itemBackdrop {
|
.layout-tv .itemBackdrop {
|
||||||
|
@ -850,11 +842,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailPageSecondaryContainer {
|
.detailPageSecondaryContainer {
|
||||||
margin: 1.25em 0;
|
padding-top: 1.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-mobile .detailPageSecondaryContainer {
|
.layout-mobile .detailPageSecondaryContainer {
|
||||||
margin: 1em 0;
|
padding-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailImageContainer .card {
|
.detailImageContainer .card {
|
||||||
|
|
|
@ -252,6 +252,10 @@ a[data-role=button] {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background-color: #d5e9f2;
|
||||||
|
}
|
||||||
|
|
||||||
.detailTableBodyRow-shaded:nth-child(even) {
|
.detailTableBodyRow-shaded:nth-child(even) {
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
|
|
@ -243,6 +243,12 @@ a[data-role=button] {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background: url(bg.jpg) center top no-repeat #033361;
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
.detailTableBodyRow-shaded:nth-child(even) {
|
.detailTableBodyRow-shaded:nth-child(even) {
|
||||||
background: #1c1c1c;
|
background: #1c1c1c;
|
||||||
background: rgba(30, 30, 30, 0.9);
|
background: rgba(30, 30, 30, 0.9);
|
||||||
|
|
|
@ -225,6 +225,10 @@ html {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background-color: #101010;
|
||||||
|
}
|
||||||
|
|
||||||
.listItem-border {
|
.listItem-border {
|
||||||
border-color: rgba(34, 34, 34, 0.9) !important;
|
border-color: rgba(34, 34, 34, 0.9) !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,10 @@ a[data-role=button] {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
.detailTableBodyRow-shaded:nth-child(even) {
|
.detailTableBodyRow-shaded:nth-child(even) {
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,6 +326,12 @@ a[data-role=button] {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background: url(bg.jpg) center top no-repeat #030322;
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
.detailTableBodyRow-shaded:nth-child(even) {
|
.detailTableBodyRow-shaded:nth-child(even) {
|
||||||
background: #1c1c1c;
|
background: #1c1c1c;
|
||||||
background: rgba(30, 30, 30, 0.9);
|
background: rgba(30, 30, 30, 0.9);
|
||||||
|
|
|
@ -228,6 +228,12 @@ a[data-role=button] {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noBackdropTransparency .detailPageSecondaryContainer {
|
||||||
|
background: linear-gradient(to bottom, #0f3562, #1162a4, #03215f);
|
||||||
|
background-color: #0f3562;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
.detailTableBodyRow-shaded:nth-child(even) {
|
.detailTableBodyRow-shaded:nth-child(even) {
|
||||||
background: #1c1c1c;
|
background: #1c1c1c;
|
||||||
background: rgba(0, 0, 0, 0.3);
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue