Automatically clicks the "Load More Episodes" button when visible on Spotify
当前为
// ==UserScript==
// @name Infinite Scroll Spotify Episodes
// @namespace https://greasyfork.org/en/users/1200587-trilla-g
// @version 4.0
// @description Automatically clicks the "Load More Episodes" button when visible on Spotify
// @author Trilla_G
// @match *://*.open.spotify.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Define the selector for the button
const buttonSelector = '.vqQmhCMZq7eUtTV7YYOQ';
// Function to check if an element is in the viewport
function isInViewport(element) {
const rect = element.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
// Function to check for the button and click it if it's in the viewport
function checkForButtonAndClick() {
const button = document.querySelector(buttonSelector);
if (button && isInViewport(button)) {
button.click();
}
}
// Run checkForButtonAndClick every second
setInterval(checkForButtonAndClick, 1000);
})();