Skip to content

Instantly share code, notes, and snippets.

@apnerve
Created November 20, 2013 14:48
Show Gist options
  • Select an option

  • Save apnerve/7564389 to your computer and use it in GitHub Desktop.

Select an option

Save apnerve/7564389 to your computer and use it in GitHub Desktop.
Dhingana download bookmarklet - Adds a download button beside every song in the list.
javascript:!function(){Dhingana=Dhingana||{},Dhingana.findSongList=function(){return $(".songs").find(".song")},Dhingana.fetchSongURL=function(a,b){$.get("http://www.dhingana.com/xhr/getSongDetails?id="+a+"&count=1",function(c){var d=$.parseJSON(c),e=d.songs[a].Name,f=d.songs[a].Streams.Mp3;Dhingana.addDownloadButton(b,f,e)})},Dhingana.addDownloadButtons=function(){this.findSongList().each(function(a,b){var c=$(b).data("id");Dhingana.fetchSongURL(c,b)})},Dhingana.addDownloadButton=function(a,b,c){$(a).append('<a class="btn btn-blue" style="position:absolute;left:540px;top:9px;" href="'+b+'" download="'+c+'.mp3">Download</a>')},Dhingana.addDownloadButtons()}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment