Created
August 15, 2011 03:19
-
-
Save Ruxton/1145657 to your computer and use it in GitHub Desktop.
Blocks clicks in them itms link maker, re-creates metadata and captures output
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
$('a.link').unbind( 'click' ); | |
$('a.link').bind( 'click', function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
var f = this.className.replace(/(\s|^)link(\s|$)/, ""); | |
this.mediaType = f.substr(0, 1).toUpperCase() + f.substr(1); | |
if (this.mediaType == "Artist") { | |
this.linkText = $(this).prevAll("h5").text() + " (Artist)"; | |
this.artistText = "<strong>" + this.linkText + "</strong>" | |
} else { | |
if (this.mediaType == "Movie" || this.mediaType == "Podcast" || this.mediaType == "Film") { | |
this.name = $(this).closest("tr").find("td.name > span").text(); | |
this.linkText = this.name; | |
this.artistText = "<strong>" + this.linkText + "</strong>" | |
} else { | |
if (this.mediaType == "Video") { | |
this.name = $(this).closest("tr").find("td.name > span").text(); | |
this.artist = $(this).closest("tr").find("td.album_genre > span").text(); | |
this.linkText = this.artist + " - " + this.name; | |
this.artistText = "<strong>" + this.artist + "</strong>" + " -" + this.name; | |
} else { | |
this.name = $(this).closest("tr").find("td.name > span").text(); | |
this.artist = $(this).closest("tr").find("td.album_artist > span").text(); | |
this.linkText = this.artist + " - " + this.name; | |
this.artistText = "<strong>" + this.artist + "</strong>" + " - " + this.name; | |
} | |
} | |
} | |
url = this.href; | |
title = ''; | |
if(this.linkText) | |
{ | |
title = this.linkText; | |
} | |
console.log("Title: "+title+" URL: "+url); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment