Created
February 22, 2013 07:35
-
-
Save e-oz/5011518 to your computer and use it in GitHub Desktop.
for webinar
This file contains hidden or 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
// Host where all mp3 files are located | |
var musicHost = 'http://player.tupi.ca/webinar/music/'; | |
// List of available files | |
var files = [ | |
'Chris_de_Burgh_-_The_Snows_Of_New_York.mp3', | |
'Metallica_-_Nothing_Else_Matters.mp3', | |
'R.E.M._-_Losing_My_Religion.mp3', | |
'Scooter_-_How_much_is_the_fish.mp3', | |
'Skrillex_-_Scary_Monsters_and_Nice_Sprites.mp3' | |
]; | |
function getSongName(filename) { | |
return filename.replace(/_/g, ' ').replace('.mp3', ''); | |
} | |
function createElement(filename, songName) { | |
var el = document.createElement('li'); | |
el.innerHTML = songName; | |
el.classList.add('track'); | |
el.setAttribute('data-filename', filename); | |
return el; | |
} | |
function init() { | |
// @TODO: start all your works here | |
var container = document.querySelector('#tracklist'); | |
files.forEach(function (filename) { | |
var songName = getSongName(filename); | |
var el = createElement(filename, songName); | |
container.appendChild(el); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment