// ==UserScript== // @name Bandcamp: Wishlist Auto Play // @namespace http://tampermonkey.net/ // @version 1.1 // @description Auto-playing tracks on https://bandcamp.com on the "wishlist" page // @author Grihail // @match https://bandcamp.com/*wishlist // @icon https://www.google.com/s2/favicons?sz=64&domain=bandcamp.com // @grant none // @license CC-BY // @downloadURL none // ==/UserScript== (function() { 'use strict'; let playingIndex = null; let isNotificationShown = false; const clickNextItem = (item) => { const nextItem = item.nextElementSibling; if (nextItem !== null) { const img = nextItem.querySelector('img'); img.click(); } }; const checkPlaying = () => { const items = document.querySelectorAll('#wishlist-items > ol > li'); for (let i = 0; i < items.length; i++) { const item = items[i]; if (item.classList.contains('playing')) { if (playingIndex !== i) { playingIndex = i; } return; } } if (playingIndex !== null) { const progressBar = document.querySelector('#carousel-player > div > div.col.col-7-15.progress-transport > div.info-progress > div.progress-bar > div.progress'); const width = parseFloat(progressBar?.style.width || '0'); if (width >= 100) { clickNextItem(items[playingIndex]); } } }; setInterval(checkPlaying, 500); })();