File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313// @copyright 2020, cuzi (https://github.com/cvzi)
1414// @supportURL https://github.com/cvzi/Spotify-Genius-Lyrics-userscript/issues
1515// @icon https://avatars.githubusercontent.com/u/251374?s=200&v=4
16- // @version 23.6.13
16+ // @version 23.6.14
1717// @require https://greasyfork.org/scripts/406698-geniuslyrics/code/GeniusLyrics.js
1818// @require https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.5.0/lz-string.min.js
1919// @grant GM.xmlHttpRequest
@@ -791,9 +791,14 @@ if (document.location.hostname === 'genius.com') {
791791 try {
792792 const iframe = document . querySelector ( '.ReactModalPortal iframe[srcdoc*="/purchase/"]' )
793793 if ( iframe && iframe . contentDocument && iframe . contentDocument . body ) {
794- iframe . contentDocument . body . querySelectorAll ( '[data-click-to-action-url*="https://www.spotify.com/purchase/"]' ) . forEach ( function ( button ) {
795- button . click ( )
796- } )
794+ const dismissButtons = Array . from ( iframe . contentDocument . body . querySelectorAll ( 'button' ) ) . filter ( b => b . textContent . toLowerCase ( ) . includes ( 'dismiss' ) )
795+ if ( dismissButtons . length ) {
796+ dismissButtons [ 0 ] . click ( )
797+ }
798+ const nonUrlButtons = Array . from ( iframe . contentDocument . body . querySelectorAll ( 'button' ) ) . filter ( b => b . dataset . clickToActionAction !== 'URL' )
799+ if ( nonUrlButtons . length ) {
800+ nonUrlButtons [ 0 ] . click ( )
801+ }
797802 }
798803 } catch ( e ) {
799804 console . warn ( e )
You can’t perform that action at this time.
0 commit comments