Skip to content

Instantly share code, notes, and snippets.

@devth
Created October 10, 2011 21:33
Show Gist options
  • Save devth/1276617 to your computer and use it in GitHub Desktop.
Save devth/1276617 to your computer and use it in GitHub Desktop.
Add Spotify links to Pitchfork reviews
$(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