Spotify lyric background override

9/11/2024, 4:57:30 PM

目前為 2024-09-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Spotify lyric background override
// @namespace   Violentmonkey Scripts
// @match       https://open.spotify.com/*
// @grant       none
// @version     1.1
// @author      M Ogdahl
// @description 9/11/2024, 4:57:30 PM
// @license    MIT
// ==/UserScript==

const delay = ms => new Promise(res => setTimeout(res, ms));
const styleString = "--lyrics-color-active: rgb(133,153,0); --lyrics-color-inactive: rgb(101,123,131); --lyrics-color-passed: rgba(133,153,0,0.5); --lyrics-color-background: rgb(0,43,54); --lyrics-color-messaging: rgb(0, 0, 0);";
const MyFunction = async () => {
    'use strict';
    await delay(2000);
    console.log("Waited 5 seconds");
    while (true) {
      await delay(100);
      let possibleDiv = document.getElementsByClassName("FUYNhisXTCmbzt9IDxnT");
      if (possibleDiv[0] != undefined) {
        if (possibleDiv[0].style.cssText !=styleString) {
          possibleDiv[0].style.cssText = styleString;
          console.log(possibleDiv[0].style.cssText);
          console.log("Overwrote lyrics style!");
        } else {
        //console.log(possibleDiv[0].style.cssText);
        }
      }

    }
};

MyFunction()