|
41 | 41 | let newArray = []; |
42 | 42 | let forkArray = []; |
43 | 43 | let languageArray = []; |
44 | | - let newURLArray = []; |
| 44 | + let htmlArray = []; |
45 | 45 | let contributorsArray = []; |
46 | 46 | for (let i = 0; i < data.length; i++){ |
47 | 47 | newArray.push(data[i].name); |
|
50 | 50 | languageArray.push(data[i].language); |
51 | 51 | contributorsArray.push(data[i].contributors_url); |
52 | 52 | contributorsArray.sort(); |
53 | | - newURLArray.push(data[i].html_url); |
54 | | - newURLArray.sort(); |
| 53 | + htmlArray.push(data[i].html_url); |
| 54 | + htmlArray.sort(); |
55 | 55 | } |
56 | 56 |
|
57 | 57 | let app = document.getElementById('root'); |
|
66 | 66 | const contributorsCard = createAndAppend('div', contributorsContainer, {text: "Contributors to this Repository", class: 'card'}); |
67 | 67 | const contributorsUl = createAndAppend('ul', contributorsCard, {id: 'contributorsUl'}); |
68 | 68 |
|
| 69 | + |
| 70 | + |
69 | 71 | data.forEach((repo) => { |
70 | 72 | for (let i = 0; i < newArray.length; i++) { |
71 | 73 | createAndAppend('option', selectList, {id: "myOption", value: i, text: newArray[i]}); |
|
83 | 85 |
|
84 | 86 | selectList.onchange = function(selectedIndex){ |
85 | 87 | createAndAppend('li', ul, { text: "Repository: " + newArray[this.selectedIndex], class: 'nameInContainer', function: removeNodes()}); |
| 88 | + createAndAppend('a', ul, { text: htmlArray[this.selectedIndex], id: 'linkInContainer', target: "_blank", href: htmlArray[this.selectedIndex]}); |
86 | 89 | createAndAppend('li', ul, { text: "Number of Forks: " + forkArray[this.selectedIndex], class: 'forksInContainer'}); |
87 | 90 | createAndAppend('li', ul, { text: "Language: " + languageArray[this.selectedIndex], class: 'languageInContainer'}); |
88 | | - createAndAppend('li', contributorsUl, { text: newURLArray[this.selectedIndex], class: 'contributorsInContainer'}); |
89 | | - |
| 91 | + createAndAppend('li', contributorsUl, { text: contributorsArray[this.selectedIndex], class: 'contributorsInContainer'}); |
90 | 92 | } |
91 | 93 |
|
92 | 94 | }); |
|
0 commit comments