index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>three.js / examples</title>
  5. <meta charset="utf-8">
  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. font-size: 20px;
  39. font-weight: normal;
  40. }
  41. a {
  42. color: #2194CE;
  43. text-decoration: none;
  44. }
  45. #panel {
  46. position: fixed;
  47. left: 0px;
  48. width: 310px;
  49. height: 100%;
  50. overflow: auto;
  51. background: #fafafa;
  52. }
  53. #panel #content {
  54. padding: 0px 20px 20px 20px;
  55. }
  56. #panel #content .link {
  57. color: #2194CE;
  58. text-decoration: none;
  59. cursor: pointer;
  60. display: block;
  61. }
  62. #panel #content .selected {
  63. color: #ff0000;
  64. }
  65. #panel #content .link:hover {
  66. text-decoration: underline;
  67. }
  68. #viewer {
  69. position: absolute;
  70. border: 0px;
  71. left: 310px;
  72. width: calc(100% - 310px);
  73. height: 100%;
  74. overflow: auto;
  75. }
  76. #button {
  77. position: fixed;
  78. bottom: 20px;
  79. right: 20px;
  80. padding: 8px;
  81. color: #fff;
  82. background-color: #555;
  83. opacity: 0.7;
  84. }
  85. #button:hover {
  86. cursor: pointer;
  87. opacity: 1;
  88. }
  89. /* mobile */
  90. #expandButton {
  91. display: none;
  92. position: absolute;
  93. right: 20px;
  94. top: 12px;
  95. width: 32px;
  96. height: 32px;
  97. }
  98. #expandButton span {
  99. height: 2px;
  100. background-color: #2194CE;
  101. width: 16px;
  102. position: absolute;
  103. left: 8px;
  104. top: 10px;
  105. }
  106. #expandButton span:nth-child(1) {
  107. top: 16px;
  108. }
  109. #expandButton span:nth-child(2) {
  110. top: 22px;
  111. }
  112. @media all and ( max-width: 640px ) {
  113. h1{
  114. margin-top: 20px;
  115. margin-bottom: 20px;
  116. }
  117. #panel{
  118. position: absolute;
  119. left: 0;
  120. top: 0;
  121. height: 480px;
  122. width: 100%;
  123. right: 0;
  124. z-index: 100;
  125. overflow: hidden;
  126. border-bottom: 1px solid #dedede;
  127. }
  128. #content{
  129. position: absolute;
  130. left: 0;
  131. top: 60px;
  132. right: 0;
  133. bottom: 0;
  134. font-size: 17px;
  135. line-height: 22px;
  136. overflow: auto;
  137. }
  138. #viewer{
  139. position: absolute;
  140. left: 0;
  141. top: 56px;
  142. width: 100%;
  143. height: calc(100% - 56px);
  144. }
  145. #expandButton{
  146. display: block;
  147. }
  148. #panel.collapsed{
  149. height: 56px;
  150. }
  151. }
  152. </style>
  153. </head>
  154. <body>
  155. <script type="text/javascript">
  156. var _gaq = _gaq || [];
  157. _gaq.push(['_setAccount', 'UA-86951-15']);
  158. _gaq.push(['_trackPageview']);
  159. (function() {
  160. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  161. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  162. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  163. })();
  164. </script>
  165. <div id="panel" class="collapsed">
  166. <h1><a href="http://threejs.org">three.js</a> / examples</h1>
  167. <a id="expandButton" href="#">
  168. <span></span>
  169. <span></span>
  170. <span></span>
  171. </a>
  172. <div id="content"></div>
  173. </div>
  174. <iframe id="viewer" allowfullscreen onmousewheel=""></iframe>
  175. <script src="files.js"></script>
  176. <script>
  177. var panel = document.getElementById( 'panel' );
  178. var content = document.getElementById( 'content' );
  179. var viewer = document.getElementById( 'viewer' );
  180. var expandButton = document.getElementById( 'expandButton' );
  181. expandButton.addEventListener( 'click', function ( event ) {
  182. panel.classList.toggle( 'collapsed' );
  183. event.preventDefault();
  184. } );
  185. // iOS8 workaround
  186. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  187. viewer.addEventListener( 'load', function ( event ) {
  188. viewer.contentWindow.innerWidth -= 10;
  189. viewer.contentWindow.innerHeight -= 2;
  190. } );
  191. }
  192. var container = document.createElement( 'div' );
  193. content.appendChild( container );
  194. var button = document.createElement( 'div' );
  195. button.id = 'button';
  196. button.textContent = 'View source';
  197. button.addEventListener( 'click', function ( event ) {
  198. var array = location.href.split( '/' );
  199. array.pop();
  200. window.open( 'view-source:' + array.join( '/' ) + '/' + selected + '.html' );
  201. }, false );
  202. button.style.display = 'none';
  203. document.body.appendChild( button );
  204. var links = {};
  205. var selected = null;
  206. for ( var key in files ) {
  207. var section = files[ key ];
  208. var div = document.createElement( 'h2' );
  209. div.textContent = key;
  210. container.appendChild( div );
  211. for ( var i = 0; i < section.length; i ++ ) {
  212. ( function ( file ) {
  213. var name = file.split( '_' );
  214. name.shift();
  215. name = name.join( ' / ' );
  216. var link = document.createElement( 'a' );
  217. link.className = 'link';
  218. link.textContent = name;
  219. link.href = "#" + file;
  220. link.addEventListener( 'click', function ( event ) {
  221. if ( event.button === 0 ) {
  222. event.preventDefault();
  223. panel.classList.toggle( 'collapsed' );
  224. load( file );
  225. }
  226. } );
  227. container.appendChild( link );
  228. links[ file ] = link;
  229. } )( section[ i ] );
  230. }
  231. }
  232. var load = function ( file ) {
  233. if ( selected !== null ) links[ selected ].className = 'link';
  234. links[ file ].className = 'link selected';
  235. window.location.hash = file;
  236. viewer.src = file + '.html';
  237. viewer.focus();
  238. button.style.display = '';
  239. selected = file;
  240. };
  241. if ( window.location.hash !== '' ) {
  242. load( window.location.hash.substring( 1 ) );
  243. }
  244. </script>
  245. </body>
  246. </html>