1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8">
|
---|
5 | <title>three.js - documentation</title>
|
---|
6 | <style>
|
---|
7 | @font-face {
|
---|
8 | font-family: 'inconsolata';
|
---|
9 | src: url('files/inconsolata.woff') format('woff');
|
---|
10 | font-weight: normal;
|
---|
11 | font-style: normal;
|
---|
12 | }
|
---|
13 |
|
---|
14 | html {
|
---|
15 | height: 100%;
|
---|
16 | }
|
---|
17 |
|
---|
18 | body {
|
---|
19 | margin: 0;
|
---|
20 | padding: 0;
|
---|
21 | height: 100%;
|
---|
22 | color: #555;
|
---|
23 | font-family: 'inconsolata';
|
---|
24 | font-size: 15px;
|
---|
25 | line-height: 18px;
|
---|
26 | overflow: hidden;
|
---|
27 | }
|
---|
28 |
|
---|
29 | a {
|
---|
30 | color: #2194CE;
|
---|
31 | text-decoration: none;
|
---|
32 | }
|
---|
33 |
|
---|
34 | #panel {
|
---|
35 | position: fixed;
|
---|
36 | width: 260px;
|
---|
37 | height: 100%;
|
---|
38 | overflow: auto;
|
---|
39 | }
|
---|
40 |
|
---|
41 | #panel h1 {
|
---|
42 | margin-top: 20px;
|
---|
43 | margin-bottom: 40px;
|
---|
44 | margin-left: 20px;
|
---|
45 | font-size: 25px;
|
---|
46 | font-weight: normal;
|
---|
47 | }
|
---|
48 |
|
---|
49 | #panel h2 {
|
---|
50 | color: #454545;
|
---|
51 | font-size: 18px;
|
---|
52 | font-weight: normal;
|
---|
53 |
|
---|
54 | margin-top: 20px;
|
---|
55 | margin-left: 20px;
|
---|
56 | }
|
---|
57 |
|
---|
58 | #panel h3 {
|
---|
59 | color: #666;
|
---|
60 | font-size: 16px;
|
---|
61 | font-weight: normal;
|
---|
62 |
|
---|
63 | margin-top: 20px;
|
---|
64 | margin-left: 20px;
|
---|
65 | }
|
---|
66 |
|
---|
67 | #panel ul {
|
---|
68 | list-style-type: none;
|
---|
69 | padding: 0px;
|
---|
70 | margin-left: 20px;
|
---|
71 | }
|
---|
72 |
|
---|
73 | #viewer {
|
---|
74 | border: 0px;
|
---|
75 | margin-left: 260px;
|
---|
76 | width: -webkit-calc(100% - 260px);
|
---|
77 | width: -moz-calc(100% - 260px);
|
---|
78 | width: calc(100% - 260px);
|
---|
79 | height: 100%;
|
---|
80 | overflow: auto;
|
---|
81 | }
|
---|
82 |
|
---|
83 | </style>
|
---|
84 | </head>
|
---|
85 | <body>
|
---|
86 | <div id="panel"></div>
|
---|
87 | <iframe id="viewer"></iframe>
|
---|
88 |
|
---|
89 | <script src="list.js"></script>
|
---|
90 | <script>
|
---|
91 | var panel = document.getElementById( 'panel' );
|
---|
92 | var viewer = document.getElementById( 'viewer' );
|
---|
93 |
|
---|
94 | var html = '<h1><a href="http://threejs.org">three.js</a> / docs</h1>';
|
---|
95 |
|
---|
96 | var DELIMITER = '/';
|
---|
97 | var nameCategoryMap = {};
|
---|
98 |
|
---|
99 | for ( var section in list ) {
|
---|
100 |
|
---|
101 | html += '<h2>' + section + '</h2>';
|
---|
102 |
|
---|
103 | html += '<ul>';
|
---|
104 |
|
---|
105 | for ( var category in list[ section ] ) {
|
---|
106 |
|
---|
107 | html += '<h3>' + category + '</h3>';
|
---|
108 |
|
---|
109 | html += '<ul>';
|
---|
110 |
|
---|
111 | for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
|
---|
112 |
|
---|
113 | var page = list[ section ][ category ][ i ];
|
---|
114 |
|
---|
115 | html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
|
---|
116 |
|
---|
117 | nameCategoryMap[page[0]] = {
|
---|
118 | section: section,
|
---|
119 | category: category,
|
---|
120 | name: page[0]
|
---|
121 | };
|
---|
122 |
|
---|
123 | }
|
---|
124 |
|
---|
125 | html += '</ul>';
|
---|
126 |
|
---|
127 | }
|
---|
128 |
|
---|
129 | html += '</ul>';
|
---|
130 |
|
---|
131 | }
|
---|
132 |
|
---|
133 | panel.innerHTML += html;
|
---|
134 |
|
---|
135 | function encodeUrl( path ) {
|
---|
136 |
|
---|
137 | return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
|
---|
138 |
|
---|
139 | }
|
---|
140 |
|
---|
141 | function decodeUrl( path ) {
|
---|
142 |
|
---|
143 | return path.replace(/_/g, ' ').replace(/\./g, ' / ');
|
---|
144 |
|
---|
145 | }
|
---|
146 |
|
---|
147 | // Page loading
|
---|
148 |
|
---|
149 | function goTo( section, category, name ) {
|
---|
150 |
|
---|
151 | // Fully resolve links that only provide a name
|
---|
152 | if(arguments.length == 1) {
|
---|
153 | var location = nameCategoryMap[section];
|
---|
154 | section = location.section;
|
---|
155 | category = location.category;
|
---|
156 | name = location.name;
|
---|
157 | }
|
---|
158 |
|
---|
159 | var title = 'three.js - documentation - ' + section + ' - ' + name;
|
---|
160 | var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
|
---|
161 |
|
---|
162 | window.location.hash = url;
|
---|
163 | window.document.title = title;
|
---|
164 |
|
---|
165 |
|
---|
166 | viewer.src = pages[ section ][ category ][ name ] + '.html';
|
---|
167 |
|
---|
168 | }
|
---|
169 |
|
---|
170 | function goToHash() {
|
---|
171 |
|
---|
172 | var hash = window.location.hash.substring( 1 ).split(DELIMITER);
|
---|
173 | goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
|
---|
174 |
|
---|
175 | }
|
---|
176 |
|
---|
177 | window.addEventListener( 'hashchange', goToHash, false );
|
---|
178 |
|
---|
179 | if ( window.location.hash.length > 0 ) goToHash();
|
---|
180 |
|
---|
181 | </script>
|
---|
182 | </body>
|
---|
183 | </html>
|
---|