fix some issues :3

This commit is contained in:
Ashley 2023-03-11 13:39:44 +00:00
parent 28d1f03afe
commit 794ba0853c

View file

@ -1382,7 +1382,6 @@ video.addEventListener('volumechange', function() {
localStorage.setItem('playerVolume', this.volume); localStorage.setItem('playerVolume', this.volume);
}); });
// Get the progress bar and container elements // Get the progress bar and container elements
const progressBar1 = document.querySelector(".progress-bar"); const progressBar1 = document.querySelector(".progress-bar");
const progressContainer1 = document.querySelector(".progress-container"); const progressContainer1 = document.querySelector(".progress-container");
@ -1399,13 +1398,13 @@ window.addEventListener("load", () => {
}, 500); }, 500);
}); });
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
let bgs = document.querySelectorAll('[data-bg]'); let bgs = document.querySelectorAll('[data-bg]');
let bgCount = bgs.length; let bgCount = bgs.length;
function loadBg(index) { function loadBg(index) {
let bg = bgs[index]; let bg = bgs[index];
let bgUrl = bg.getAttribute('data-bg'); let bgUrl = bg.getAttribute('data-bg');
bg.style.backgroundImage = `url(${bgUrl})`; bg.style.backgroundImage = `url(${bgUrl})`;
bg.removeAttribute('data-bg'); bg.removeAttribute('data-bg');
bg.classList.add('loaded'); bg.classList.add('loaded');
@ -1427,7 +1426,7 @@ window.addEventListener("load", () => {
window.addEventListener('resize', lazyLoadBg); window.addEventListener('resize', lazyLoadBg);
}); });
const fadeInElements = () => { const fadeInElements = () => {
const elements = document.querySelectorAll('.fade-in'); const elements = document.querySelectorAll('.fade-in');
const viewportHeight = window.innerHeight; const viewportHeight = window.innerHeight;
elements.forEach(element => { elements.forEach(element => {
@ -1448,13 +1447,17 @@ document.addEventListener('fullscreenchange', () => {
fadeInElements(); fadeInElements();
}); });
setInterval(fadeInElements, 500);
// Get all anchor links on the page
// Get all anchor links on the page
const links = document.querySelectorAll('a'); const links = document.querySelectorAll('a');
// Add a click event listener to each link // Add a click event listener to each link
links.forEach(link => { links.forEach(link => {
link.addEventListener('click', e => { link.addEventListener('click', e => {
// Check if the link's href includes a hash character
if (!link.href.includes('#')) {
e.preventDefault(); // Prevent the default link behavior e.preventDefault(); // Prevent the default link behavior
// Create a loading spinner element // Create a loading spinner element
@ -1473,18 +1476,14 @@ links.forEach(link => {
setTimeout(() => { setTimeout(() => {
window.location.href = link.href; window.location.href = link.href;
}, 500); }, 500);
}
}); });
}); });
const videoElement = document.getElementById("video");
// Listen for full screen change events on the video element
</script> videoElement.addEventListener("fullscreenchange", () => {
<script>
const videoElement = document.getElementById("video");
// Listen for full screen change events on the video element
videoElement.addEventListener("fullscreenchange", () => {
if (document.fullscreenElement === videoElement) { if (document.fullscreenElement === videoElement) {
// If the video element is in full screen mode, remove the border radius // If the video element is in full screen mode, remove the border radius
videoElement.style.borderRadius = "0em "; videoElement.style.borderRadius = "0em ";
@ -1493,7 +1492,8 @@ links.forEach(link => {
videoElement.style.borderRadius = "16px"; videoElement.style.borderRadius = "16px";
} }
}); });
</script>
</script>
<% if (!optout) { %> <% if (!optout) { %>
<!-- MORE INFO :https://poketube.fun/privacy --> <!-- MORE INFO :https://poketube.fun/privacy -->