Skip to content

Instantly share code, notes, and snippets.

@basketofsoftkittens
Last active August 29, 2015 14:24
Show Gist options
  • Save basketofsoftkittens/7a3ee1405ca542743a02 to your computer and use it in GitHub Desktop.
Save basketofsoftkittens/7a3ee1405ca542743a02 to your computer and use it in GitHub Desktop.
get track id from tack click find music bookmark
javascript:$(function(){function a(a){alert(a)}$(document).on("click",".track-list li",function(t){var r=$(t.currentTarget),e=r.attr("data-id"),c=getParameterByName("locale")||getParameterByName("locale","hash",!0),n=$("#search_input").val();return n?void $.ajax({url:"/api/music/search/",data:{terms:n,countryCode:c?getCountry(c):"us"},dataType:"json",success:function(t){if(t&&t.data){var r=!1;t.data.forEach(function(t){t.trackId==e&&(r=!0,a("TRACK LABEL FOUND: "+t.trackLabel))}),r||a("no track found with that track id")}}}):a("no search terms found in the search box")})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment