-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
90 lines (86 loc) · 3.24 KB
/
index.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!-- Graphics Example Code.
index.html - The web page document containing the canvas (drawing surface). It launches your JavaScript files. //-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="assets/fav.ico" />
</head>
<body style="background: DarkGray">
<!-- Begin typing your web page here. //-->
<!-- The following code embeds a WebGL canvas panel, loads certain scene(s), and displays panel(s) of their controls. //-->
<div id="main-canvas" class="canvas-widget"></div>
<script type="module">
// ********************* THE ENTRY POINT OF YOUR WHOLE PROGRAM STARTS HERE *********************
// Indicate which element on the page you want the Canvas_Widget to replace with a 3D WebGL area:
const element_to_replace = document.querySelector("#main-canvas");
import {
Main_Scene,
Additional_Scenes,
Canvas_Widget
} from "./main-scene.js"; // Import the file that defines a scene.
const scenes = [Main_Scene, ...Additional_Scenes].map(
scene => new scene()
); // This line creates your scene.
new Canvas_Widget(element_to_replace, scenes);
</script>
<!-- The following code embeds a code navigator widget with links to classes. //-->
<!-- <div id="main-code" class="code-widget"></div>
<script type="module">
// Indicate which element on the page you want the Code_Widget to replace with a code readout:
const element_to_replace = document.querySelector("#main-code");
import {
Main_Scene,
Additional_Scenes,
Code_Widget,
defs
} from "./main-scene.js"; // Import the file that defines a scene.
new Code_Widget(element_to_replace, Main_Scene, Additional_Scenes, defs);
</script> -->
<br />
<br />
<div
w3-include-html="readme.html"
style="margin: auto; width: 1000px; padding: 10px; overflow-y: scroll; height: 800px; background: whitesmoke"
></div>
<br />
<br />
<br />
<br />
<br />
<script>
function includeHTML() {
var z, i, elmnt, file, xhttp;
/* Loop through a collection of all HTML elements: */
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
if (file) {
/* Make an HTTP request using the attribute value as the file name: */
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
elmnt.innerHTML = this.responseText;
}
if (this.status == 404) {
elmnt.innerHTML = "Page not found.";
}
/* Remove the attribute, and call this function once more: */
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
};
xhttp.open("GET", file, true);
xhttp.send();
/* Exit the function: */
return;
}
}
}
includeHTML();
</script>
</body>
</html>