@@ -32,13 +32,7 @@ const dirFilter = (response, type) => {
32
32
}
33
33
} ) ;
34
34
} ;
35
- /* const fetchFile = (url) => {
36
- let textContent = '';
37
- return fetch(url).then(res => res.text()).then((text) => {
38
- return textContent = text;
39
- })
40
- return textContent
41
- } */
35
+
42
36
const createListElement = linkArray => {
43
37
let listEl = document . createElement ( "ul" ) ;
44
38
linkArray . map ( links => {
@@ -51,10 +45,10 @@ const createListElement = linkArray => {
51
45
} else {
52
46
let innerLinks , tempalteCollapse ;
53
47
Promise . all (
54
- links [ 1 ] . map ( ( url , i ) =>
55
- fetch ( url + "/README.md" , fetchHeaders ) . then ( resp => resp . text ( ) )
48
+ links [ 1 ] . map ( ( url , i ) =>
49
+ fetch ( url + "/README.md" , fetchHeaders ) . then ( resp => resp . text ( ) )
50
+ )
56
51
)
57
- )
58
52
. then ( texts => {
59
53
innerLinks = links [ 1 ] . map ( ( link , i ) => {
60
54
return `<li><a href="${ link } ">${ converter . makeHtml (
@@ -89,39 +83,17 @@ findGithubRepoContents("atomize", "atomize.github.io")
89
83
fetchedPaths . rootPaths [ path . path ] = [ ] ;
90
84
} else {
91
85
let rootDir = path . path . split ( "/" ) [ 0 ] ;
92
- ! fetchedPaths . rootPaths [ rootDir ]
93
- ? ( fetchedPaths . rootPaths [ rootDir ] =
94
- [ ] &&
95
- fetchedPaths . rootPaths [ rootDir ] . push (
96
- document . location . origin + "/" + path . path
97
- ) )
98
- : fetchedPaths . rootPaths [ rootDir ] . push (
86
+ ! fetchedPaths . rootPaths [ rootDir ] ?
87
+ ( fetchedPaths . rootPaths [ rootDir ] = [ ] &&
88
+ fetchedPaths . rootPaths [ rootDir ] . push (
99
89
document . location . origin + "/" + path . path
100
- ) ;
90
+ ) ) :
91
+ fetchedPaths . rootPaths [ rootDir ] . push (
92
+ document . location . origin + "/" + path . path
93
+ ) ;
101
94
}
102
95
} , [ ] ) ;
103
96
104
97
return Object . entries ( fetchedPaths . rootPaths ) ;
105
98
} )
106
- . then ( createListElement ) ;
107
-
108
- /* const createLinkElement = (linkArray) => {
109
- let tmplink = ''
110
-
111
- linkArray.map(link => {
112
- fetch(link + '/README.md').then(res => {
113
- tmplink = link
114
- return res.text()
115
- }).then(txt => {
116
- list.innerHTML += `<li><a href="${tmplink}">${converter.makeHtml(txt)}</a></li>`
117
- })
118
- })
119
- }
120
- var exLinks = fetch('https://api.github.com/repos/atomize/atomize.github.io/contents/examples')
121
- .then(res => {
122
- return res.json()
123
- })
124
- .then(contents => {
125
- return contents.map(dirFilter)
126
- })
127
- exLinks.then(links => createLinkElement(links)) */
99
+ . then ( createListElement ) ;
0 commit comments