index.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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: 0px;
  33. width: 260px;
  34. height: 100%;
  35. overflow: auto;
  36. background: #fafafa;
  37. }
  38. #panel h1 {
  39. margin-top: 30px;
  40. margin-bottom: 40px;
  41. margin-left: 20px;
  42. font-size: 25px;
  43. font-weight: normal;
  44. }
  45. #panel h2 {
  46. color: #454545;
  47. font-size: 18px;
  48. font-weight: normal;
  49. margin-top: 20px;
  50. margin-left: 20px;
  51. }
  52. #panel h3 {
  53. color: #666;
  54. font-size: 16px;
  55. font-weight: normal;
  56. margin-top: 20px;
  57. margin-left: 20px;
  58. }
  59. #panel ul {
  60. list-style-type: none;
  61. padding: 0px;
  62. margin-left: 20px;
  63. }
  64. #viewer {
  65. border: 0px;
  66. width: 100%;
  67. height: 100%;
  68. overflow: auto;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <div id="panel"></div>
  74. <iframe id="viewer"></iframe>
  75. <script src="list.js"></script>
  76. <script>
  77. var panel = document.getElementById( 'panel' );
  78. var viewer = document.getElementById( 'viewer' );
  79. var html = '<h1><a href="http://threejs.org">three.js</a> / docs</h1>';
  80. var DELIMITER = '/';
  81. var nameCategoryMap = {};
  82. for ( var section in list ) {
  83. html += '<h2>' + section + '</h2>';
  84. html += '<ul>';
  85. for ( var category in list[ section ] ) {
  86. html += '<h3>' + category + '</h3>';
  87. html += '<ul>';
  88. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  89. var page = list[ section ][ category ][ i ];
  90. html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
  91. nameCategoryMap[page[0]] = {
  92. section: section,
  93. category: category,
  94. name: page[0]
  95. };
  96. }
  97. html += '</ul>';
  98. }
  99. html += '</ul>';
  100. }
  101. panel.innerHTML += html;
  102. function encodeUrl( path ) {
  103. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  104. }
  105. function decodeUrl( path ) {
  106. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  107. }
  108. // Page loading
  109. function goTo( section, category, name ) {
  110. // Fully resolve links that only provide a name
  111. if(arguments.length == 1) {
  112. var location = nameCategoryMap[section];
  113. section = location.section;
  114. category = location.category;
  115. name = location.name;
  116. }
  117. var title = 'three.js - documentation - ' + section + ' - ' + name;
  118. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  119. window.location.hash = url;
  120. window.document.title = title;
  121. viewer.src = pages[ section ][ category ][ name ] + '.html';
  122. }
  123. function goToHash() {
  124. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  125. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  126. }
  127. window.addEventListener( 'hashchange', goToHash, false );
  128. if ( window.location.hash.length > 0 ) goToHash();
  129. </script>
  130. </body>
  131. </html>