From 2969186f3295d0df2ff2e7a9765d3886a6267406 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Wed, 29 Jun 2022 05:18:23 -0300 Subject: [PATCH] Add update, define constants --- script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 29707f2..805c37f 100644 --- a/script.js +++ b/script.js @@ -4,6 +4,8 @@ // @version 0.0.1 // @description Changes the background of Spotify playlists and albums in a rainbow pattern // @author Isaac Shoebottom +// @updateURL https://raw.githubusercontent.com/Glaceon575/SpotifyBackgroundSwitcher/master/script.js +// @downloadURL https://raw.githubusercontent.com/Glaceon575/SpotifyBackgroundSwitcher/master/script.js // @match https://open.spotify.com/playlist/* // @match https://open.spotify.com/album/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js @@ -15,11 +17,13 @@ waitForKeyElements(".xYgjMpAjE5XT05aRIezb", changeBackground); +const timer = 50 //in milliseconds + let r1, g1, b1, r2, b2, g2 let topIntensityCutoff = 235 let topDarknessCutoff = 75 -let difference = 60 +const difference = 60 //delta between the top and bottom let bottomIntensityCutoff = topIntensityCutoff - difference let bottomDarknessCutoff = topDarknessCutoff - difference @@ -50,7 +54,7 @@ function changeBackground() { g2 = bottomDarknessCutoff; b2 = bottomDarknessCutoff; - setInterval(changeColor, 30, bg); + setInterval(changeColor, timer, bg); } function changeColor(bg) {