add new commits in my way
This commit is contained in:
111
script copy.js
111
script copy.js
@@ -6,7 +6,10 @@ let shuffleInterval = 15000; // Time in milliseconds before the next slide is sh
|
|||||||
let useTrailers = true; // Set to false to disable trailers
|
let useTrailers = true; // Set to false to disable trailers
|
||||||
let setRandomMovie = true; // Set to false to disable random movie selection from the list
|
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 showOnOtherPages = false; // Set to true to show the slideshow on all pages eg. favorites tab, requests tab, etc.
|
||||||
let showTitle = true; // Set to false to hide the title
|
//let showTitle = false; // Set to false to hide the title
|
||||||
|
let umuteOnHover = true; // Set to false to disable unmuting the video on hover
|
||||||
|
let isMuted = true; // Set to false to start with sound
|
||||||
|
let useSponsorBlock = true; // Set to true to use SponsorBlock data to skip intro/outro segments of trailers
|
||||||
let plotMaxLength = 550; // Maximum number of characters in the plot
|
let plotMaxLength = 550; // Maximum number of characters in the plot
|
||||||
let trailerMaxLength = 0; // Default value 0; length measured in ms
|
let trailerMaxLength = 0; // Default value 0; length measured in ms
|
||||||
|
|
||||||
@@ -16,47 +19,37 @@ let movieList = [], currentMovieIndex = 0;
|
|||||||
let previousMovies = [];
|
let previousMovies = [];
|
||||||
let forwardMovies = [];
|
let forwardMovies = [];
|
||||||
|
|
||||||
// Ensure that the video player is muted initially and can be unmuted on hover
|
// Get SponsorBlock-Data for the outro segment of the trailer
|
||||||
const initPlayer = () => {
|
//function fetchSponsorBlockOutro(videoId) {
|
||||||
player = new YT.Player(videoElement, {
|
const fetchSponsorBlockOutro = (videoId) => {
|
||||||
height: '100%',
|
return fetch(`https://sponsor.ajay.app/api/skipSegments?videoID=${videoId}&category=outro`)
|
||||||
width: '100%',
|
.then(response => response.json())
|
||||||
videoId,
|
.then(segments => { segments.length > 0 ? segments[0].segment : null; })
|
||||||
playerVars: {
|
.catch(error => {
|
||||||
mute: isMuted ? 1 : 0,
|
console.error('Error fetching SponsorBlock data:', error);
|
||||||
},
|
return null;
|
||||||
events: {
|
});
|
||||||
'onReady': (event) => {
|
|
||||||
event.target.playVideo();
|
|
||||||
event.target.setVolume(isMuted ? 0 : 100);
|
|
||||||
},
|
|
||||||
'onStateChange': (event) => {
|
|
||||||
if (event.data === YT.PlayerState.ENDED) {
|
|
||||||
setTimeout(fetchRandomMovie, 100);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'onError': () => {
|
|
||||||
console.error(`Error with YouTube video`);
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const slidesContainer = document.getElementById('slides-container');
|
|
||||||
slidesContainer.addEventListener('mouseenter', () => {
|
|
||||||
if (player) {
|
|
||||||
player.unMute();
|
|
||||||
isMuted = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
slidesContainer.addEventListener('mouseleave', () => {
|
// Monitor the video player for the outro segment
|
||||||
if (player) {
|
function monitorOutro(player, outroSegment) {
|
||||||
player.mute();
|
const interval = setInterval(() => {
|
||||||
isMuted = true;
|
if (!outroSegment || !player) {
|
||||||
}
|
clearInterval(interval);
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentTime = player.getCurrentTime();
|
||||||
|
if (currentTime >= outroSegment[0] && currentTime < outroSegment[1]) {
|
||||||
|
clearInterval(interval);
|
||||||
|
player.stopVideo(); // stop video
|
||||||
|
setTimeout(fetchRandomMovie, 100); // fetch next movie
|
||||||
|
}
|
||||||
|
}, 500); // check every 500ms
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const createElem = (tag, className, textContent, src, alt) => {
|
const createElem = (tag, className, textContent, src, alt) => {
|
||||||
const elem = document.createElement(tag);
|
const elem = document.createElement(tag);
|
||||||
if (className) elem.className = className;
|
if (className) elem.className = className;
|
||||||
@@ -255,7 +248,6 @@ const createSlideElement = (movie, hasVideo = false) => {
|
|||||||
videoId,
|
videoId,
|
||||||
playerVars: {
|
playerVars: {
|
||||||
mute: 0, // Change to start the video muted MARK: set muted, not officaly refreneced by youtube API, but working...
|
mute: 0, // Change to start the video muted MARK: set muted, not officaly refreneced by youtube API, but working...
|
||||||
// autoplay: 1, // Autoplay the video, maybe not necessary here
|
|
||||||
controls: 0, // Hide the controls
|
controls: 0, // Hide the controls
|
||||||
disablekb: 1, // Disable keyboard controls
|
disablekb: 1, // Disable keyboard controls
|
||||||
fs: 1, // Enavle fullscreen
|
fs: 1, // Enavle fullscreen
|
||||||
@@ -265,6 +257,18 @@ const createSlideElement = (movie, hasVideo = false) => {
|
|||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'onReady': event => {
|
'onReady': event => {
|
||||||
|
if (useSponsorBlock) {
|
||||||
|
fetchSponsorBlockOutro(videoId).then(outroSegment => {
|
||||||
|
if (outroSegment) {
|
||||||
|
console.log(`SponsorBlock outro segment: Start - ${outroSegment[0]}s, End - ${outroSegment[1]}s`);
|
||||||
|
monitorOutro(player, outroSegment);
|
||||||
|
} else {
|
||||||
|
console.log('No outro segment found/provided');
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error fetching SponsorBlock outro segment:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (trailerMaxLength > 0) {
|
if (trailerMaxLength > 0) {
|
||||||
clearTimeout(slideChangeTimeout);
|
clearTimeout(slideChangeTimeout);
|
||||||
slideChangeTimeout = setTimeout(() => {
|
slideChangeTimeout = setTimeout(() => {
|
||||||
@@ -291,7 +295,6 @@ const createSlideElement = (movie, hasVideo = false) => {
|
|||||||
backdrop.style.width = 'calc(100% - 23vw)';
|
backdrop.style.width = 'calc(100% - 23vw)';
|
||||||
backdrop.style.left = '0vw';
|
backdrop.style.left = '0vw';
|
||||||
}
|
}
|
||||||
// MARK: mod css
|
|
||||||
const plot = document.querySelector('.plot');
|
const plot = document.querySelector('.plot');
|
||||||
if (plot) {
|
if (plot) {
|
||||||
plot.style.left = '33vw';
|
plot.style.left = '33vw';
|
||||||
@@ -303,17 +306,6 @@ const createSlideElement = (movie, hasVideo = false) => {
|
|||||||
genres.style.left = 'calc(50% - 17vw)';
|
genres.style.left = 'calc(50% - 17vw)';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
const plot = document.querySelector('.plot');
|
|
||||||
if (plot) plot.style.width = 'calc(100% - 36.4vw)';
|
|
||||||
|
|
||||||
const loremIpsum = document.querySelector('.lorem-ipsum');
|
|
||||||
if (loremIpsum) loremIpsum.style.paddingRight = '32.4vw';
|
|
||||||
|
|
||||||
const logo = document.querySelector('.logo');
|
|
||||||
if (logo) logo.style.left = 'calc(50% - 14.2vw)';
|
|
||||||
*/
|
|
||||||
|
|
||||||
const loremIpsum = document.querySelector('.lorem-ipsum');
|
const loremIpsum = document.querySelector('.lorem-ipsum');
|
||||||
if (loremIpsum) loremIpsum.style.left = 'calc(50% - 17vw)';
|
if (loremIpsum) loremIpsum.style.left = 'calc(50% - 17vw)';
|
||||||
|
|
||||||
@@ -351,7 +343,22 @@ const createSlideElement = (movie, hasVideo = false) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
videoContainer.addEventListener('mouseenter', () => {
|
||||||
|
if (player && umuteOnHover) {
|
||||||
|
player.unMute();
|
||||||
|
isMuted = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
videoContainer.addEventListener('mouseleave', () => {
|
||||||
|
if (player && umuteOnHover) {
|
||||||
|
player.mute();
|
||||||
|
isMuted = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
console.log(`Trailer disabled for '${movie.Name}'`);
|
||||||
startSlideChangeTimer();
|
startSlideChangeTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css">
|
||||||
<title>Jellyfin Spotlight v2.3.2 Fork v1.1</title>
|
<title>Jellyfin Spotlight v2.5.0 Fork v1.2</title>
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
@@ -135,7 +135,7 @@ body {
|
|||||||
.lorem-ipsum {
|
.lorem-ipsum {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 20.1em;
|
bottom: 20.1em;
|
||||||
Right: 2.5em;
|
right: 2.5em;
|
||||||
font-family: "Titillium Web", sans-serif;
|
font-family: "Titillium Web", sans-serif;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
text-shadow: 1px 1px 1px rgba(0, 0, 0, 1);
|
text-shadow: 1px 1px 1px rgba(0, 0, 0, 1);
|
||||||
|
Reference in New Issue
Block a user