-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexamples-list.html
58 lines (37 loc) · 1.08 KB
/
examples-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
<head>
<title>MathCell - Examples</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style></style>
</head>
<body>
<div id="columns" style="column-count: 2"></div>
<script>
var xhr = new XMLHttpRequest();
// GitHub API not consistenly loaded by Google...
xhr.open( 'GET', 'https://paulmasson.github.io/sitemap.txt', true );
xhr.onload = function() {
var files = xhr.response.split( '\n' ).filter( e => e.includes( '/docs/examples/' ) );
var xhrs = [];
for ( var i = 0 ; i < files.length ; i++ ) {
var div = document.createElement( 'div' );
div.id = 'example' + i;
columns.append( div );
xhrs[i] = new XMLHttpRequest();
xhrs[i].fileName = files[i];
xhrs[i].responseType = 'document';
xhrs[i].id = div.id;
xhrs[i].open( 'GET', xhrs[i].fileName, true );
xhrs[i].onload = function() {
var a = document.createElement( 'a' );
a.href = this.fileName;
a.innerHTML = this.response.title;
document.getElementById( this.id ).append( a );
}
xhrs[i].send();
}
}
xhr.send();
</script>
</body>
</html>