Skip to content

Commit

Permalink
- Fixed lyrics not working anymore (Genius.com updated their website)
Browse files Browse the repository at this point in the history
- "Show All Settings" state is now remembered on page refresh
  • Loading branch information
Selbi182 committed Jan 8, 2025
1 parent e062854 commit 4a9d6e3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private String scrapeLyrics(String url) throws IOException {
.execute();

Document document = response.parse();
Elements lyricsElements = document.select("div[class^=Lyrics__Container]");
Elements lyricsElements = document.select("div[data-lyrics-container=true]");

StringJoiner lyricsBlocks = new StringJoiner("\n");
for (Element element : lyricsElements) {
Expand Down
25 changes: 21 additions & 4 deletions src/main/resources/static/js/spotify-big-picture.js
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,9 @@ function initVisualPreferences() {
: false;
refreshPreference(pref, state);
}

let expertModeStateFromLocalStorage = getExpertModeStateFromLocalStorage();
setExpertMode(expertModeStateFromLocalStorage === "true");
} else {
// On first load, apply the default preset and enable the ignoreDefaultOn settings. Then force-open the settings menu
applyDefaultPreset();
Expand Down Expand Up @@ -1927,6 +1930,15 @@ function calculateVersionHash() {
return pseudoHash.toString();
}

const LOCAL_STORAGE_KEY_EXPERT_MODE = "expert_mode";
function getExpertModeStateFromLocalStorage() {
return localStorage.getItem(LOCAL_STORAGE_KEY_EXPERT_MODE);
}

function setExpertModeStateInLocalStorage(state) {
return localStorage.setItem(LOCAL_STORAGE_KEY_EXPERT_MODE, state);
}

function toggleVisualPreference(pref) {
setVisualPreference(pref, !pref.state);
}
Expand Down Expand Up @@ -2457,9 +2469,15 @@ function setSettingsMenuState(state) {
}

function toggleSettingsExpertMode() {
settingsExpertMode = !settingsExpertMode;
setClass("settings-wrapper".select(), "expert", settingsExpertMode);
setClass("settings-quick-jump".select(), "show", settingsExpertMode);
let newState = !settingsExpertMode;
setExpertMode(newState);
}

function setExpertMode(state) {
settingsExpertMode = state;
setExpertModeStateInLocalStorage(state)
setClass("settings-wrapper".select(), "expert", state);
setClass("settings-quick-jump".select(), "show", state);
}

function resetSettingsPrompt() {
Expand Down Expand Up @@ -3940,7 +3958,6 @@ const PREFERENCES_PRESETS = [
"spread-timestamps",
"reverse-bottom",
"show-next-track",
"show-podcast-descriptions",
"featured-artists-new-line"
],
disabled: [
Expand Down

0 comments on commit 4a9d6e3

Please sign in to comment.