index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. html {
  14. height: 100%;
  15. }
  16. body {
  17. margin: 0;
  18. padding: 0 0 0 260px;
  19. height: 100%;
  20. color: #555;
  21. font-family: 'inconsolata';
  22. font-size: 15px;
  23. line-height: 18px;
  24. overflow: hidden;
  25. }
  26. a {
  27. color: #2194CE;
  28. text-decoration: none;
  29. }
  30. #panel {
  31. position: fixed;
  32. left: 0;
  33. width: 260px;
  34. height: 100%;
  35. overflow: auto;
  36. }
  37. #panel h1 {
  38. margin-top: 20px;
  39. margin-bottom: 40px;
  40. margin-left: 20px;
  41. font-size: 25px;
  42. font-weight: normal;
  43. }
  44. #panel h2 {
  45. color: #454545;
  46. font-size: 18px;
  47. font-weight: normal;
  48. margin-top: 20px;
  49. margin-left: 20px;
  50. }
  51. #panel h3 {
  52. color: #666;
  53. font-size: 16px;
  54. font-weight: normal;
  55. margin-top: 20px;
  56. margin-left: 20px;
  57. }
  58. #panel ul {
  59. list-style-type: none;
  60. padding: 0px;
  61. margin-left: 20px;
  62. }
  63. #viewer {
  64. border: 0px;
  65. width: 100%;
  66. height: 100%;
  67. overflow: auto;
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <script type="text/javascript">
  73. var _gaq = _gaq || [];
  74. _gaq.push(['_setAccount', 'UA-86951-15']);
  75. _gaq.push(['_trackPageview']);
  76. (function() {
  77. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  78. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  79. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  80. })();
  81. </script>
  82. <div id="panel"></div>
  83. <iframe id="viewer"></iframe>
  84. <script src="list.js"></script>
  85. <script>
  86. var panel = document.getElementById( 'panel' );
  87. var viewer = document.getElementById( 'viewer' );
  88. var html = '<h1><a href="http://threejs.org">three.js</a> / docs</h1>';
  89. var DELIMITER = '/';
  90. var nameCategoryMap = {};
  91. for ( var section in list ) {
  92. html += '<h2>' + section + '</h2>';
  93. html += '<ul>';
  94. for ( var category in list[ section ] ) {
  95. html += '<h3>' + category + '</h3>';
  96. html += '<ul>';
  97. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  98. var page = list[ section ][ category ][ i ];
  99. html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
  100. nameCategoryMap[page[0]] = {
  101. section: section,
  102. category: category,
  103. name: page[0]
  104. };
  105. }
  106. html += '</ul>';
  107. }
  108. html += '</ul>';
  109. }
  110. panel.innerHTML += html;
  111. function encodeUrl( path ) {
  112. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  113. }
  114. function decodeUrl( path ) {
  115. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  116. }
  117. // Page loading
  118. function goTo( section, category, name ) {
  119. // Fully resolve links that only provide a name
  120. if(arguments.length == 1) {
  121. var location = nameCategoryMap[section];
  122. section = location.section;
  123. category = location.category;
  124. name = location.name;
  125. }
  126. var title = 'three.js - documentation - ' + section + ' - ' + name;
  127. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  128. window.location.hash = url;
  129. window.document.title = title;
  130. viewer.src = pages[ section ][ category ][ name ] + '.html';
  131. }
  132. function goToHash() {
  133. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  134. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  135. }
  136. window.addEventListener( 'hashchange', goToHash, false );
  137. if ( window.location.hash.length > 0 ) goToHash();
  138. </script>
  139. </body>
  140. </html>
粤ICP备19079148号