-
-
Save JPalounek/3880217 to your computer and use it in GitHub Desktop.
První file jeden problém, druhý file jiný problém
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
window.onload = function () { | |
var projects = { | |
notedew: { | |
todos: ['implement','design','sell licenses','earn millions'], | |
team: { | |
"Jan Palounek": { | |
email: "[email protected]" | |
}, | |
"Jan Polášek": { | |
email: "[email protected]" | |
}, | |
} | |
}, | |
cnc: { | |
todos:['assemble','create app','sell','earn millions'] | |
}, | |
magic_stuff: { | |
todos:['Collect underpants.','???','Profit.'] | |
} | |
}; | |
var body = document.getElementsByTagName('body')[0]; | |
for(var i in projects) { | |
// Make a wrapper | |
var wrapper = document.createElement('div'); | |
wrapper.setAttribute('id', 'project' + i); | |
wrapper.setAttribute('class', 'project'); | |
// Create title | |
var title = document.createElement('h2'); | |
title.innerHTML = i; | |
// Create subtitles | |
var todosTitle = document.createElement('h3'); | |
todosTitle.innerHTML = 'Todos'; | |
var teamTitle = document.createElement('h3'); | |
teamTitle.innerHTML = 'Team'; | |
// Create lists | |
var list = document.createElement('ul'); | |
list.setAttribute('id', 'list-' + i) | |
list.setAttribute('class', 'todolist') | |
for(var j in projects[i]['todos']) { | |
var point = document.createElement('li'); | |
point.innerHTML = projects[i]['todos'][j]; | |
list.appendChild(point); | |
} | |
var team = document.createElement('ul'); | |
team.setAttribute('id', 'team-' + i) | |
team.setAttribute('class', 'team') | |
for(var j in projects[i]['team']) { | |
var point = document.createElement('li'); | |
point.innerHTML = j + ' (' + projects[i]['team'][j].email + ')'; | |
team.appendChild(point); | |
} | |
// Append to DOM | |
wrapper.appendChild(title); | |
wrapper.appendChild(todosTitle); | |
wrapper.appendChild(list); | |
wrapper.appendChild(teamTitle); | |
wrapper.appendChild(team); | |
body.appendChild(wrapper); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
...
4. "earn millions"
5. there is no step 5 :)