2
0

index.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>three.js - documentation</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <style>
  8. @font-face {
  9. font-family: 'inconsolata';
  10. src: url('files/inconsolata.woff') format('woff');
  11. font-weight: normal;
  12. font-style: normal;
  13. }
  14. *{ box-sizing: border-box;}
  15. html {
  16. height: 100%;
  17. }
  18. body {
  19. background-color: #ffffff;
  20. margin: 0;
  21. padding: 0 0 0 260px;
  22. height: 100%;
  23. color: #555;
  24. font-family: 'inconsolata';
  25. font-size: 15px;
  26. line-height: 18px;
  27. overflow: hidden;
  28. }
  29. a {
  30. color: #2194CE;
  31. text-decoration: none;
  32. }
  33. #panel {
  34. position: fixed;
  35. left: 0px;
  36. width: 260px;
  37. height: 100%;
  38. overflow: auto;
  39. background: #fafafa;
  40. }
  41. #panel h1 {
  42. margin-top: 30px;
  43. margin-bottom: 40px;
  44. margin-left: 20px;
  45. font-size: 25px;
  46. font-weight: normal;
  47. }
  48. #panel h2 {
  49. color: #454545;
  50. font-size: 18px;
  51. font-weight: normal;
  52. margin-top: 20px;
  53. margin-left: 20px;
  54. }
  55. #panel h3 {
  56. color: #666;
  57. font-size: 16px;
  58. font-weight: normal;
  59. margin-top: 20px;
  60. margin-left: 20px;
  61. }
  62. #panel ul {
  63. list-style-type: none;
  64. padding: 0px;
  65. margin-left: 20px;
  66. }
  67. #viewer {
  68. border: 0px;
  69. width: 100%;
  70. height: 100%;
  71. overflow: auto;
  72. }
  73. .filterBlock{
  74. margin: 20px;
  75. position: relative;
  76. }
  77. .filterBlock p {
  78. margin: 0;
  79. }
  80. #filterInput {
  81. width: 100%;
  82. padding: 5px;
  83. font-family: inherit;
  84. font-size: 15px;
  85. outline: none;
  86. border: 1px solid #dedede;
  87. }
  88. #filterInput:focus{
  89. border: 1px solid #2194CE;
  90. }
  91. #clearFilterButton {
  92. position: absolute;
  93. right: 6px;
  94. top: 50%;
  95. margin-top: -8px;
  96. width: 16px;
  97. height: 16px;
  98. font-size: 14px;
  99. color: grey;
  100. text-align: center;
  101. line-height: 0;
  102. padding-top: 7px;
  103. opacity: .5;
  104. }
  105. #clearFilterButton:hover{
  106. opacity: 1;
  107. }
  108. .filtered{
  109. display: none;
  110. }
  111. #panel li b{
  112. font-weight: bold;
  113. }
  114. #expandButton{
  115. display: none;
  116. position: absolute;
  117. right: 20px;
  118. top: 12px;
  119. width: 32px;
  120. height: 32px;
  121. background-color: #2194CE;
  122. }
  123. #expandButton span{
  124. height: 3px;
  125. background-color: white;
  126. width: 16px;
  127. position: absolute;
  128. left: 8px;
  129. top: 8px;
  130. }
  131. #expandButton span:nth-child(1) {
  132. top: 14px;
  133. }
  134. #expandButton span:nth-child(2) {
  135. top: 20px;
  136. width: 12px;
  137. }
  138. @media all and ( max-width: 640px ) {
  139. #panel{
  140. position: absolute;
  141. left: 0;
  142. top: 0;
  143. height: 480px;
  144. width: 100%;
  145. right: 0;
  146. z-index: 100;
  147. overflow: hidden;
  148. border-bottom: 1px solid #dedede;
  149. }
  150. #content{
  151. overflow: auto;
  152. position: absolute;
  153. left: 0;
  154. top: 120px;
  155. right: 0;
  156. bottom: 0;
  157. }
  158. #viewer{
  159. position: absolute;
  160. left: 0;
  161. top: 48px;
  162. }
  163. #expandButton{
  164. display: block;
  165. }
  166. #panel.collapsed{
  167. height: 56px;
  168. }
  169. #panel h1{
  170. margin-top: 20px;
  171. margin-bottom: 20px;
  172. }
  173. #content{
  174. top: 90px;
  175. }
  176. }
  177. </style>
  178. </head>
  179. <body>
  180. <div id="panel" class="collapsed">
  181. <a id="expandButton" href="#" >
  182. <span></span><span></span><span></span>
  183. </a>
  184. <h1><a href="http://threejs.org">three.js</a> / docs</h1>
  185. <div class="filterBlock" >
  186. <input type="text" id="filterInput" placeholder="Type to filter"/>
  187. <a href="#" id="clearFilterButton" >x</a>
  188. </div>
  189. <div id="content" >
  190. </div>
  191. </div>
  192. <iframe id="viewer"></iframe>
  193. <script src="list.js"></script>
  194. <script>
  195. var panel = document.getElementById( 'panel' );
  196. var viewer = document.getElementById( 'viewer' );
  197. var clearFilterButton = document.getElementById( 'clearFilterButton' );
  198. var filterInput = document.getElementById( 'filterInput' );
  199. //filterInput.focus();
  200. panel.addEventListener( 'click', function( e ) {
  201. //filterInput.focus();
  202. e.preventDefault();
  203. } );
  204. document.getElementById( 'expandButton' ).addEventListener( 'click', function( e ) {
  205. panel.classList.toggle( 'collapsed' );
  206. if( !panel.classList.contains( 'collapsed' ) ) {
  207. //filterInput.focus();
  208. }
  209. e.preventDefault();
  210. } );
  211. var DELIMITER = '/';
  212. var nameCategoryMap = {};
  213. var sections = [];
  214. var content = document.getElementById( 'content' );
  215. for ( var section in list ) {
  216. var h2 = document.createElement( 'h2' );
  217. h2.textContent = section;
  218. content.appendChild( h2 );
  219. for ( var category in list[ section ] ) {
  220. var div = document.createElement( 'div' );
  221. var h3 = document.createElement( 'h3' );
  222. h3.textContent = category;
  223. div.appendChild( h3 );
  224. var ul = document.createElement( 'ul' );
  225. div.appendChild( ul );
  226. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  227. var page = list[ section ][ category ][ i ];
  228. var li = document.createElement( 'li' );
  229. var a = document.createElement( 'a' );
  230. a.setAttribute( 'href', '#' );
  231. ( function( s, c, p ) {
  232. a.addEventListener( 'click', function( e ) {
  233. goTo( s, c, p );
  234. e.preventDefault();
  235. } )
  236. } )( section, category, page[ 0 ] )
  237. a.textContent = page[ 0 ];
  238. li.appendChild( a );
  239. ul.appendChild( li );
  240. nameCategoryMap[page[0]] = {
  241. section: section,
  242. category: category,
  243. name: page[0],
  244. element: a
  245. };
  246. }
  247. content.appendChild( div );
  248. sections.push( ul );
  249. }
  250. }
  251. panel.appendChild( content )
  252. function layoutList() {
  253. sections.forEach( function( el ) {
  254. var collapsed = true;
  255. Array.prototype.slice.apply( el.children ).forEach( function( item ) {
  256. if( !item.classList.contains( 'filtered' ) ) {
  257. collapsed = false;
  258. return;
  259. }
  260. } );
  261. if( collapsed ) {
  262. el.parentElement.classList.add( 'filtered' );
  263. } else {
  264. el.parentElement.classList.remove( 'filtered' );
  265. }
  266. } );
  267. }
  268. filterInput.addEventListener( 'input', function( e ) {
  269. updateFilter();
  270. } );
  271. clearFilterButton.addEventListener( 'click', function( e ) {
  272. filterInput.value = '';
  273. updateFilter();
  274. e.preventDefault();
  275. } );
  276. function updateFilter() {
  277. var exp = new RegExp( filterInput.value, 'gi' );
  278. for( var j in nameCategoryMap ) {
  279. var res = nameCategoryMap[ j ].name.match( exp );
  280. if( res && res.length > 0 ) {
  281. nameCategoryMap[ j ].element.parentElement.classList.remove( 'filtered' );
  282. var str = nameCategoryMap[ j ].name;
  283. for( var i = 0; i < res.length; i++ ) {
  284. str = str.replace( res[ i ], '<b>' + res[ i ] + '</b>' );
  285. }
  286. nameCategoryMap[ j ].element.innerHTML = str;
  287. } else {
  288. nameCategoryMap[ j ].element.parentElement.classList.add( 'filtered' );
  289. nameCategoryMap[ j ].element.textContent = nameCategoryMap[ j ].name;
  290. }
  291. }
  292. layoutList();
  293. }
  294. function encodeUrl( path ) {
  295. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  296. }
  297. function decodeUrl( path ) {
  298. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  299. }
  300. // Page loading
  301. function goTo( section, category, name ) {
  302. // Fully resolve links that only provide a name
  303. if(arguments.length == 1) {
  304. var location = nameCategoryMap[section];
  305. section = location.section;
  306. category = location.category;
  307. name = location.name;
  308. }
  309. var title = 'three.js - documentation - ' + section + ' - ' + name;
  310. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  311. window.location.hash = url;
  312. window.document.title = title;
  313. viewer.src = pages[ section ][ category ][ name ] + '.html';
  314. panel.classList.add( 'collapsed' );
  315. }
  316. function goToHash() {
  317. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  318. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  319. }
  320. window.addEventListener( 'hashchange', goToHash, false );
  321. if ( window.location.hash.length > 0 ) goToHash();
  322. </script>
  323. </body>
  324. </html>