index.html 9.5 KB

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