add title option

This commit is contained in:
CodeDevMLH
2025-09-26 13:53:04 +02:00
parent 018f78a6df
commit 4323cdb367
2 changed files with 132 additions and 38 deletions

View File

@@ -5,7 +5,7 @@ let shuffleInterval = 15000; // Time in milliseconds before the next slide is sh
let useTrailers = true; // Set to false to disable trailers
let setRandomMovie = true; // Set to false to disable random movie selection from the list
let showOnOtherPages = false; // Set to true to show the slideshow on all pages eg. favorites tab, requests tab, etc.
//let showTitle = false; // Set to false to hide the title TBD
let showTitle = false; // Set to true to place the slideshow title above the banner
let disableTrailerControls = false; // Set to false to enable trailer controls
let setMutedHover = true; // Set to false to disable unmuting the video on hover
let unmutedVolume = 20; // Set the volume level when the video is unmuted
@@ -176,6 +176,7 @@ const createSlideElement = (movie, hasVideo = false) => {
cleanup();
isMuted = startTrailerMuted;
const container = document.getElementById('slides-container');
const slideWrapper = createElem('div', 'slide-wrapper');
const slide = createElem('div', 'slide');
if (movie && (!previousMovies.length || previousMovies[previousMovies.length - 1].Id !== movie.Id)) {
@@ -186,7 +187,13 @@ const createSlideElement = (movie, hasVideo = false) => {
previousMovies.shift();
}
['backdrop', 'logo'].forEach(type => slide.appendChild(createElem('img', type, null, `/Items/${movie.Id}/Images/${type.charAt(0).toUpperCase() + type.slice(1)}${type === 'backdrop' ? '/0' : ''}`, type)));
slide.appendChild(createElem('div', 'heading', title));
if (showTitle && title) {
const heading = createElem('div', 'heading', title);
heading.style.display = 'flex';
slideWrapper.classList.add('has-heading');
slideWrapper.appendChild(heading);
}
const textContainer = createElem('div', 'text-container');
const premiereYear = movie.PremiereDate ? new Date(movie.PremiereDate).getFullYear() : unknownYearTerms[languageIndex];
@@ -457,8 +464,10 @@ const createSlideElement = (movie, hasVideo = false) => {
}
slideWrapper.appendChild(slide);
container.innerHTML = '';
container.appendChild(slide);
container.appendChild(slideWrapper);
};
function addSwipeListeners(slide) {
@@ -595,12 +604,27 @@ const readCustomList = () =>
const lines = text.split('\n').filter(Boolean);
const firstLine = lines.shift().trim();
const [parsedTitle, muteSetting] = firstLine.split(/\s+/);
const tokens = firstLine.split(/\s+/).filter(Boolean);
title = parsedTitle || title;
let muteSetting = null;
if (tokens.length > 0) {
const lastToken = tokens[tokens.length - 1].toLowerCase();
if (lastToken === 'muteon' || lastToken === 'muteoff') {
muteSetting = lastToken;
tokens.pop();
}
}
// Check for mute
isMuted = muteSetting === "MuteOn";
const parsedTitle = tokens.join(' ').trim();
if (parsedTitle) {
title = parsedTitle;
}
if (muteSetting) {
startTrailerMuted = muteSetting === 'muteon';
}
isMuted = startTrailerMuted;
// Remaining lines are media IDs
const mediaList = lines.map(line => line.trim().substring(0, 32));