Skip to content

Commit 9d9604b

Browse files
author
berti
committed
minor
1 parent 17b21da commit 9d9604b

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

examples/prism/prism-data-tutorial.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var isTut = false
2222
var tutSep;
2323
var commentArr = []
24-
24+
2525
var dataStarts = function (text) {
2626
return findDataStarts(text.trim(), new RegExp('^[^A-Z^a-z]+[^\s+' + tutSep + ']' + tutSep, 'm'))
2727
}

ghDirList.js

+12-40
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ const dirFilter = (response, type) => {
3232
}
3333
});
3434
};
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+
4236
const createListElement = linkArray => {
4337
let listEl = document.createElement("ul");
4438
linkArray.map(links => {
@@ -51,10 +45,10 @@ const createListElement = linkArray => {
5145
} else {
5246
let innerLinks, tempalteCollapse;
5347
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+
)
5651
)
57-
)
5852
.then(texts => {
5953
innerLinks = links[1].map((link, i) => {
6054
return `<li><a href="${link}">${converter.makeHtml(
@@ -89,39 +83,17 @@ findGithubRepoContents("atomize", "atomize.github.io")
8983
fetchedPaths.rootPaths[path.path] = [];
9084
} else {
9185
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(
9989
document.location.origin + "/" + path.path
100-
);
90+
)) :
91+
fetchedPaths.rootPaths[rootDir].push(
92+
document.location.origin + "/" + path.path
93+
);
10194
}
10295
}, []);
10396

10497
return Object.entries(fetchedPaths.rootPaths);
10598
})
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

Comments
 (0)