index.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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. <script type="text/javascript">
  181. var _gaq = _gaq || [];
  182. _gaq.push(['_setAccount', 'UA-86951-15']);
  183. _gaq.push(['_trackPageview']);
  184. (function() {
  185. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  186. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  187. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  188. })();
  189. </script>
  190. <div id="panel" class="collapsed">
  191. <a id="expandButton" href="#" >
  192. <span></span><span></span><span></span>
  193. </a>
  194. <h1><a href="http://threejs.org">three.js</a> / docs</h1>
  195. <div class="filterBlock" >
  196. <input type="text" id="filterInput" placeholder="Type to filter"/>
  197. <a href="#" id="clearFilterButton" >x</a>
  198. </div>
  199. <div id="content" >
  200. </div>
  201. </div>
  202. <iframe id="viewer"></iframe>
  203. <script src="list.js"></script>
  204. <script>
  205. var panel = document.getElementById( 'panel' );
  206. var viewer = document.getElementById( 'viewer' );
  207. var clearFilterButton = document.getElementById( 'clearFilterButton' );
  208. var filterInput = document.getElementById( 'filterInput' );
  209. //filterInput.focus();
  210. panel.addEventListener( 'click', function( e ) {
  211. //filterInput.focus();
  212. e.preventDefault();
  213. } );
  214. document.getElementById( 'expandButton' ).addEventListener( 'click', function( e ) {
  215. panel.classList.toggle( 'collapsed' );
  216. if( !panel.classList.contains( 'collapsed' ) ) {
  217. //filterInput.focus();
  218. }
  219. e.preventDefault();
  220. } );
  221. var DELIMITER = '/';
  222. var nameCategoryMap = {};
  223. var sections = [];
  224. var content = document.getElementById( 'content' );
  225. for ( var section in list ) {
  226. var h2 = document.createElement( 'h2' );
  227. h2.textContent = section;
  228. content.appendChild( h2 );
  229. for ( var category in list[ section ] ) {
  230. var div = document.createElement( 'div' );
  231. var h3 = document.createElement( 'h3' );
  232. h3.textContent = category;
  233. div.appendChild( h3 );
  234. var ul = document.createElement( 'ul' );
  235. div.appendChild( ul );
  236. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  237. var page = list[ section ][ category ][ i ];
  238. var li = document.createElement( 'li' );
  239. var a = document.createElement( 'a' );
  240. a.setAttribute( 'href', '#' );
  241. ( function( s, c, p ) {
  242. a.addEventListener( 'click', function( e ) {
  243. goTo( s, c, p );
  244. e.preventDefault();
  245. } )
  246. } )( section, category, page[ 0 ] )
  247. a.textContent = page[ 0 ];
  248. li.appendChild( a );
  249. ul.appendChild( li );
  250. nameCategoryMap[page[0]] = {
  251. section: section,
  252. category: category,
  253. name: page[0],
  254. element: a
  255. };
  256. }
  257. content.appendChild( div );
  258. sections.push( ul );
  259. }
  260. }
  261. panel.appendChild( content )
  262. function layoutList() {
  263. sections.forEach( function( el ) {
  264. var collapsed = true;
  265. Array.prototype.slice.apply( el.children ).forEach( function( item ) {
  266. if( !item.classList.contains( 'filtered' ) ) {
  267. collapsed = false;
  268. return;
  269. }
  270. } );
  271. if( collapsed ) {
  272. el.parentElement.classList.add( 'filtered' );
  273. } else {
  274. el.parentElement.classList.remove( 'filtered' );
  275. }
  276. } );
  277. }
  278. filterInput.addEventListener( 'input', function( e ) {
  279. updateFilter();
  280. } );
  281. clearFilterButton.addEventListener( 'click', function( e ) {
  282. filterInput.value = '';
  283. updateFilter();
  284. e.preventDefault();
  285. } );
  286. function updateFilter() {
  287. var exp = new RegExp( filterInput.value, 'gi' );
  288. for( var j in nameCategoryMap ) {
  289. var res = nameCategoryMap[ j ].name.match( exp );
  290. if( res && res.length > 0 ) {
  291. nameCategoryMap[ j ].element.parentElement.classList.remove( 'filtered' );
  292. var str = nameCategoryMap[ j ].name;
  293. for( var i = 0; i < res.length; i++ ) {
  294. str = str.replace( res[ i ], '<b>' + res[ i ] + '</b>' );
  295. }
  296. nameCategoryMap[ j ].element.innerHTML = str;
  297. } else {
  298. nameCategoryMap[ j ].element.parentElement.classList.add( 'filtered' );
  299. nameCategoryMap[ j ].element.textContent = nameCategoryMap[ j ].name;
  300. }
  301. }
  302. layoutList();
  303. }
  304. function encodeUrl( path ) {
  305. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  306. }
  307. function decodeUrl( path ) {
  308. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  309. }
  310. // Page loading
  311. function goTo( section, category, name ) {
  312. // Fully resolve links that only provide a name
  313. if(arguments.length == 1) {
  314. var location = nameCategoryMap[section];
  315. section = location.section;
  316. category = location.category;
  317. name = location.name;
  318. }
  319. var title = 'three.js - documentation - ' + section + ' - ' + name;
  320. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  321. window.location.hash = url;
  322. window.document.title = title;
  323. viewer.src = pages[ section ][ category ][ name ] + '.html';
  324. panel.classList.add( 'collapsed' );
  325. }
  326. function goToHash() {
  327. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  328. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  329. }
  330. window.addEventListener( 'hashchange', goToHash, false );
  331. if ( window.location.hash.length > 0 ) goToHash();
  332. </script>
  333. </body>
  334. </html>