index.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. <div id="panel"></div>
  73. <iframe id="viewer"></iframe>
  74. <script src="list.js"></script>
  75. <script>
  76. var panel = document.getElementById( 'panel' );
  77. var viewer = document.getElementById( 'viewer' );
  78. var html = '<h1><a href="http://threejs.org">three.js</a> / docs</h1>';
  79. var DELIMITER = '/';
  80. var nameCategoryMap = {};
  81. for ( var section in list ) {
  82. html += '<h2>' + section + '</h2>';
  83. html += '<ul>';
  84. for ( var category in list[ section ] ) {
  85. html += '<h3>' + category + '</h3>';
  86. html += '<ul>';
  87. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  88. var page = list[ section ][ category ][ i ];
  89. html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
  90. nameCategoryMap[page[0]] = {
  91. section: section,
  92. category: category,
  93. name: page[0]
  94. };
  95. }
  96. html += '</ul>';
  97. }
  98. html += '</ul>';
  99. }
  100. panel.innerHTML += html;
  101. function encodeUrl( path ) {
  102. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  103. }
  104. function decodeUrl( path ) {
  105. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  106. }
  107. // Page loading
  108. function goTo( section, category, name ) {
  109. // Fully resolve links that only provide a name
  110. if(arguments.length == 1) {
  111. var location = nameCategoryMap[section];
  112. section = location.section;
  113. category = location.category;
  114. name = location.name;
  115. }
  116. var title = 'three.js - documentation - ' + section + ' - ' + name;
  117. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  118. window.location.hash = url;
  119. window.document.title = title;
  120. viewer.src = pages[ section ][ category ][ name ] + '.html';
  121. }
  122. function goToHash() {
  123. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  124. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  125. }
  126. window.addEventListener( 'hashchange', goToHash, false );
  127. if ( window.location.hash.length > 0 ) goToHash();
  128. </script>
  129. </body>
  130. </html>