Created
August 30, 2019 11:01
-
-
Save antoniopresto/367431c9965ddc0eeccace504d5acf1e to your computer and use it in GitHub Desktop.
spotify shuffle all playlists, random all songs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
go to https://open.spotify.com/collection/playlists | |
and ast this in the browser console | |
**/ | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutationRecord) { | |
window.onChangeProgressBar( | |
+mutationRecord.target.style.transform.split('.')[0].replace(/\D/gim, '') | |
); | |
}); | |
}); | |
var target = document.querySelector('.progress-bar__fg'); | |
if (!target) { | |
throw new Error('progress-bar__fg does note exist'); | |
} | |
observer.observe(target, { attributes: true, attributeFilter: ['style'] }); | |
window.onChangeProgressBar = function(progress) { | |
if(progress > 1) return; | |
const playlists = [...document.querySelectorAll('.cover-art-playback')]; | |
playlists[Math.floor(Math.random() * playlists.length)].click(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment