Created
March 8, 2016 09:10
-
-
Save inlife/cf1d9e517fd7d6052e65 to your computer and use it in GitHub Desktop.
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
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