Add logging

This commit is contained in:
Isaac Shoebottom 2022-07-03 01:40:57 -03:00
parent 96e21dfcb4
commit d04a1c32d2

View File

@ -2,7 +2,7 @@
// @name Spotify Background Changer // @name Spotify Background Changer
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @source https://github.com/Glaceon575/SpotifyBackgroundSwitcher // @source https://github.com/Glaceon575/SpotifyBackgroundSwitcher
// @version 0.1.3 // @version 0.1.4
// @description Changes the background of Spotify playlists and albums in a rainbow pattern // @description Changes the background of Spotify playlists and albums in a rainbow pattern
// @author Isaac Shoebottom // @author Isaac Shoebottom
// @updateURL https://raw.githubusercontent.com/Glaceon575/SpotifyBackgroundSwitcher/master/script.js // @updateURL https://raw.githubusercontent.com/Glaceon575/SpotifyBackgroundSwitcher/master/script.js
@ -47,13 +47,14 @@ function changeColor() {
function probeBackground() { function probeBackground() {
console.log("Probing for background"); console.log("Begin probing for background");
setInterval(() => { setInterval(() => {
const newBackground = document.querySelector(selector); const newBackground = document.querySelector(selector);
if (!newBackground) { if (!newBackground) {
return; return;
} }
if (newBackground !== background) { if (newBackground !== background) {
console.log("Spotify background changed")
clearInterval(colorInterval); clearInterval(colorInterval);
colorInterval = setInterval(changeColor, timer) colorInterval = setInterval(changeColor, timer)
background = newBackground; background = newBackground;