index.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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;
  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. }
  29. #panel {
  30. position: fixed;
  31. width: 260px;
  32. height: 100%;
  33. overflow: auto;
  34. }
  35. #panel h1 {
  36. margin-top: 20px;
  37. margin-left: 20px;
  38. font-size: 25px;
  39. font-weight: normal;
  40. }
  41. #panel h1 a {
  42. color: #444;
  43. text-decoration: none;
  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. margin-left: 260px;
  67. width: -webkit-calc(100% - 260px);
  68. width: -moz-calc(100% - 260px);
  69. width: calc(100% - 260px);
  70. height: 100%;
  71. overflow: auto;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. <div id="panel"></div>
  77. <iframe id="viewer"></iframe>
  78. <script src="list.js"></script>
  79. <script>
  80. var REVISION = '57';
  81. var panel = document.getElementById( 'panel' );
  82. var viewer = document.getElementById( 'viewer' );
  83. var html = '<h1><a href="http://threejs.org">three.js</a><span style="font-size: 50%; vertical-align: super;"> r' + REVISION + '</span></h1>';
  84. var DELIMITER = '/';
  85. var nameCategoryMap = {};
  86. for ( var section in list ) {
  87. html += '<h2>' + section + '</h2>';
  88. html += '<ul>';
  89. for ( var category in list[ section ] ) {
  90. html += '<h3>' + category + '</h3>';
  91. html += '<ul>';
  92. for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
  93. var page = list[ section ][ category ][ i ];
  94. html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
  95. nameCategoryMap[page[0]] = {
  96. section: section,
  97. category: category,
  98. name: page[0]
  99. };
  100. }
  101. html += '</ul>';
  102. }
  103. html += '</ul>';
  104. }
  105. panel.innerHTML += html;
  106. function encodeUrl( path ) {
  107. return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
  108. }
  109. function decodeUrl( path ) {
  110. return path.replace(/_/g, ' ').replace(/\./g, ' / ');
  111. }
  112. // Page loading
  113. function goTo( section, category, name ) {
  114. // Fully resolve links that only provide a name
  115. if(arguments.length == 1) {
  116. var location = nameCategoryMap[section];
  117. section = location.section;
  118. category = location.category;
  119. name = location.name;
  120. }
  121. var title = 'three.js - documentation - ' + section + ' - ' + name;
  122. var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
  123. window.location.hash = url;
  124. window.document.title = title;
  125. viewer.src = pages[ section ][ category ][ name ] + '.html';
  126. }
  127. function goToHash() {
  128. var hash = window.location.hash.substring( 1 ).split(DELIMITER);
  129. goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
  130. }
  131. window.addEventListener( 'hashchange', goToHash, false );
  132. if ( window.location.hash.length > 0 ) goToHash();
  133. </script>
  134. </body>
  135. </html>