Skip to content

Commit

Permalink
Code Fix for CompoundTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfung1031 authored and cvzi committed Dec 26, 2022
1 parent 7c7da15 commit 4f8347f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions YoutubeMusicGeniusLyrics.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// @author cuzi
// @icon https://music.youtube.com/img/favicon_144.png
// @supportURL https://github.com/cvzi/Youtube-Music-Genius-Lyrics-userscript/issues
// @version 4.0.11
// @version 4.0.12
// @require https://greasyfork.org/scripts/406698-geniuslyrics/code/GeniusLyrics.js
// @grant GM.xmlHttpRequest
// @grant GM.setValue
Expand Down Expand Up @@ -343,6 +343,10 @@ function showSearchField (query) {

if (query) {
input.value = query
} else if (genius.current.compoundTitle) {
input.value = genius.current.compoundTitle.replace('\t', ' ')
} else if (genius.current.artists && genius.current.title) {
input.value = genius.current.artists + ' ' + genius.current.title
} else if (genius.current.artists) {
input.value = genius.current.artists
}
Expand Down Expand Up @@ -384,8 +388,12 @@ function listSongs (hits, container, query) {
ev.preventDefault()
if (query) {
showSearchField(query)
} else if (genius.current.artists) {
} else if (genius.current.compoundTitle) {
showSearchField(genius.current.compoundTitle.replace('\t', ' '))
} else if (genius.current.artists && genius.current.title) {
showSearchField(genius.current.artists + ' ' + genius.current.title)
} else if (genius.current.artists) {
showSearchField(genius.current.artists)
} else {
showSearchField()
}
Expand Down Expand Up @@ -420,10 +428,9 @@ function listSongs (hits, container, query) {
const ol = container.querySelector('ol.tracklist')
ol.style.listStyle = 'none'
const searchresultsLengths = hits.length
const title = genius.current.title
const artists = genius.current.artists
const compoundTitle = genius.current.compoundTitle
const onclick = function onclick () {
genius.f.rememberLyricsSelection(title, artists, this.dataset.hit)
genius.f.rememberLyricsSelection(compoundTitle, null, this.dataset.hit)
genius.f.showLyrics(JSON.parse(this.dataset.hit), searchresultsLengths)
}
const mouseover = function onmouseover () {
Expand Down

0 comments on commit 4f8347f

Please sign in to comment.