Last active
August 2, 2018 01:15
-
-
Save basilhayek/81cff5140ae2e40eb2c39712355cf817 to your computer and use it in GitHub Desktop.
A simple bookmarklet to make it easy to convert playlists posted on setlist.fm to a service of your choice using www.playlist-converter.net (two great sites!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var t = document.title; | |
| var b0 = ""; | |
| var s = ""; | |
| if (window.location.hostname === "www.setlist.fm") { | |
| if (t.includes("Average Setlists")) { | |
| b0 = t.substring(0, t.indexOf(" Average Setlists")); | |
| } else if (t.includes("Concert Setlist")) { | |
| b0 = t.substring(0, t.indexOf(" Concert Setlist")); | |
| } | |
| // Make sure we're on a supported page by checking if we have the band name | |
| if (b0 !== "") { | |
| // Iterate through all the songs | |
| for (a of document.querySelectorAll("a.songLabel")) { | |
| b = b0; | |
| // Sometimes songs in the setlist might be from another artist; so use those instead | |
| for (b2 of a.parentElement.parentElement.querySelectorAll("div.infoPart > small.fontSmall > a")) { | |
| if (b2.textContent.trim() !== "") { | |
| b = b2.textContent; | |
| } | |
| } | |
| // Build the entry for the song | |
| s += b + " - " + a.textContent + "\n"; | |
| } | |
| // Jump over to playlist-converter.net | |
| window.open("http://www.playlist-converter.net/#/freetext=" + escape(s)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:!function(){var t=document.title,e="",n="";if("www.setlist.fm"===window.location.hostname&&(t.includes("Average Setlists")?e=t.substring(0,t.indexOf(" Average Setlists")):t.includes("Concert Setlist")&&(e=t.substring(0,t.indexOf(" Concert Setlist"))),""!==e)){for(a of document.querySelectorAll("a.songLabel")){b=e;for(b2 of a.parentElement.parentElement.querySelectorAll("div.infoPart > small.fontSmall > a"))""!==b2.textContent.trim()&&(b=b2.textContent);n+=b+" - "+a.textContent+"\n"}window.open("http://www.playlist-converter.net/#/freetext="+escape(n))}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment