|
42 | 42 | let forkArray = []; |
43 | 43 | let languageArray = []; |
44 | 44 | let descriptionArray = []; |
| 45 | + let updatedAt = []; |
45 | 46 | let htmlArray = []; |
46 | 47 | let contributorsArray = []; |
47 | 48 | for (let i = 0; i < data.length; i++){ |
|
50 | 51 | descriptionArray.push(data[i].description); |
51 | 52 | forkArray.push(data[i].forks); |
52 | 53 | languageArray.push(data[i].language); |
| 54 | + updatedAt.push(data[i].updated_at); |
53 | 55 | contributorsArray.push(data[i].contributors_url); |
54 | 56 | contributorsArray.sort(); |
55 | 57 | htmlArray.push(data[i].html_url); |
56 | 58 | htmlArray.sort(); |
57 | 59 | } |
| 60 | + |
58 | 61 |
|
59 | 62 | let app = document.getElementById('root'); |
60 | 63 | const header = createAndAppend('h1', app, { text: "Hack Your Future Repositories", class: 'title' }); |
|
83 | 86 | while (contributorsUl.hasChildNodes()) { |
84 | 87 | contributorsUl.removeChild(contributorsUl.firstChild); |
85 | 88 | } |
86 | | - } |
87 | | - |
| 89 | + } //end removeNodes |
| 90 | + |
88 | 91 | selectList.onchange = function(selectedIndex){ |
89 | 92 | let RepoName = createAndAppend('li', ul, { text: "Repository: ", class: 'nameInContainer', function: removeNodes()}); |
90 | 93 | createAndAppend('a', RepoName, { text: newArray[this.selectedIndex], id: 'linkInContainer', target: "_blank", href: htmlArray[this.selectedIndex]}); |
91 | 94 | createAndAppend('li', ul, {text: "Description: " + descriptionArray[this.selectedIndex], class: 'descriptionInContainer'}); |
92 | 95 | createAndAppend('li', ul, { text: "Number of Forks: " + forkArray[this.selectedIndex], class: 'forksInContainer'}); |
93 | 96 | createAndAppend('li', ul, { text: "Language: " + languageArray[this.selectedIndex], class: 'languageInContainer'}); |
| 97 | + createAndAppend('li', ul, {text: "Updated at: " + updatedAt[this.selectedIndex], id: 'updatedAtInContainer'}) |
94 | 98 | createAndAppend('li', contributorsUl, { text: contributorsArray[this.selectedIndex], class: 'contributorsInContainer'}); |
95 | 99 | } |
96 | 100 | }); |
| 101 | + |
97 | 102 | /* |
98 | 103 | fetchJSON( theContributors_URL, (err, data) => { |
99 | 104 | let theContributorsUrl = []; |
100 | 105 | for (let i = 0; i < data.length; i++){ |
101 | | -
|
102 | 106 | } |
103 | 107 | });*/ |
104 | 108 | } |
|
0 commit comments