Skip to content

Instantly share code, notes, and snippets.

@inlife
Created March 8, 2016 09:10
Show Gist options
  • Save inlife/cf1d9e517fd7d6052e65 to your computer and use it in GitHub Desktop.
Save inlife/cf1d9e517fd7d6052e65 to your computer and use it in GitHub Desktop.
function getTrackList() {
var trackNoClass = ".number";
var artistClass = ".section-artist";
var trackClass = ".section-title";
var timeClass = "input.section-time.ng-pristine";
// var artists = [];
var tracks = $(".section-row").map(function() {
var trackNo = $(this).find(trackNoClass).text().trim();
var artist = $(this).find(artistClass).val();
var trackTitle = $(this).find(trackClass).val();
var trackTime = $(this).find(timeClass).val();
if (trackNo || artist) {
return "[" + trackTime + "] " + artist + " - " + trackTitle;
} else {
return null;
}
});
tracks = $.makeArray(tracks);
tracks = tracks.join("\n");
if (window.navigator.userAgent.indexOf("Chrom") !== -1) {
prompt("Copy and paste plz", tracks);
} else {
alert(tracks);
}
prompt("Here's a list of artists, too:", artists);
}
getTrackList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment