Created
October 10, 2011 21:33
-
-
Save devth/1276617 to your computer and use it in GitHub Desktop.
Add Spotify links to Pitchfork reviews
This file contains 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
$(function() { | |
var $ri = $(".review-info"); | |
if ($ri.length === 1) { | |
var search = $("h1, h2", $ri).text().replace(/(\r\n|\n|\r)/gm,"").replace(/\s+/g, " ").trim(); | |
if (search !== "" && search !== []) { | |
$("body").prepend($("<div />") | |
.html($("<div />") | |
.html($("<a />") | |
.attr("href", "spotify:search:'" + search + "'") | |
.attr("style", "color: white;") | |
.html("<b>" + search + "</b>" + " on Spotify")) | |
.attr("style", "position: fixed; z-index: 1000; top: 0; right: 0; background: black; padding: 10px; color: white !important;"))); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment