Skip to content

Instantly share code, notes, and snippets.

@GMMan
Last active August 29, 2015 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GMMan/d629403650d944ae417f to your computer and use it in GitHub Desktop.
Save GMMan/d629403650d944ae417f to your computer and use it in GitHub Desktop.
Add download links for individual tracks on Groupees purchases page

To use this code, first go to your purchases page, expand the bundles with the albums you want to download individual tracks from, and open a JavaScript console. On Firefox, it's Ctrl-Shift-K, while on Chrome it's Ctrl-Shift-J. Then paste in this line:

var addDownloadLinks=function(){$(".details").each(function(c,d){var a=1;$(this).find(".audioplayer").each(function(c,d){jThis=$(this);if(!jThis.closest("li").find(".track-download").length){var e=(10>a?"0":"")+a+" - "+jThis.next().text()+".mp3",b=$('<a class="btn btn-sm btn-primary fa fa-download track-download" style="position: absolute; left: -65px; line-height: 1.1"></a>');b.attr("href",jThis.find("audio").attr("src"));b.attr("download",e);jThis.closest("li").prepend(b)}++a})})};addDownloadLinks();

and press Enter. A download button will appear before each track. If your browser supports the "download" attribute, you will get a file with the proper name, otherwise it will have numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment