Created
April 3, 2016 04:07
-
-
Save cponeill/9b94e8f1ce901801139cea0ba5fb8abb 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
// Call client ID. | |
// Be sure to add your personal api client key | |
SC.initialize({ | |
client_id: '<client_id>' | |
}); | |
// Loop through tradck data and append SC embed. | |
function makeCenterFromTracks(tracks) { | |
var track, permURL, newDiv; | |
for (var i = 0; i <= 10; i++) { | |
newDiv = document.createElement("center"); | |
newDiv.id = "track" + i; | |
track=tracks[i]; | |
SC.oEmbed(track.permalink_url,{color:"ff0066", | |
maxwidth:750, maxheight: 166},newDiv); | |
document.body.appendChild(newDiv); | |
} | |
} | |
$(document).ready(function() { | |
$('#search').click(function() {as | |
// assign user variable to input name | |
var user = $('input[name=Soundcloud]').val(); | |
// get SC data and append results into html page. | |
SC.get('/users/'+user+'/tracks', {limit: 100}, function(tracks) { | |
$('#results').append(makeCenterFromTracks(tracks)); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment