index.html 3.6 KB
Newer Older
1 2
<!doctype html>
<html lang="en">
M
Mr.doob 已提交
3
	<head>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
		<meta charset="utf-8">
		<title>three.js - documentation</title>
		<style>
			@font-face {
				font-family: 'inconsolata';
				src: url('files/inconsolata.woff') format('woff');
				font-weight: normal;
				font-style: normal;
			}

			html {
				height: 100%;
			}

			body {
				margin: 0;
				padding: 0;
				height: 100%;
				color: #555;
				font-family: 'inconsolata';
				font-size: 15px;
				line-height: 18px;
				overflow: hidden;
			}

			a {

				color: #2194CE;

			}

			#panel	{

				position: fixed;

				width: 260px;
				height: 100%;

				overflow: auto;

			}

				#panel h1 {
					margin-top: 20px;
					margin-left: 20px;
					font-size: 25px;
					font-weight: normal;
				}

				#panel h1 a {
					color: #444;
					text-decoration: none;
				}

				#panel h2 {
					color: #454545;
					font-size: 18px;
					font-weight: normal;

					margin-top: 20px;
					margin-left: 20px;
				}

				#panel h3 {
					color: #666;
					font-size: 16px;
					font-weight: normal;

					margin-top: 20px;
					margin-left: 20px;
				}

				#panel ul {
					list-style-type: none;
					padding: 0px;
					margin-left: 20px;
				}

			#viewer {
				border: 0px;
				margin-left: 260px;
				width: -webkit-calc(100% - 260px);
				width: -moz-calc(100% - 260px);
				width: calc(100% - 260px);
				height: 100%;
				overflow: auto;
			}

		</style>
M
Mr.doob 已提交
93
	</head>
94 95 96 97 98 99
	<body>
		<div id="panel"></div>
		<iframe id="viewer"></iframe>

		<script src="list.js"></script>
		<script>
M
r62  
Mr.doob 已提交
100
			var REVISION = '62';
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

			var panel = document.getElementById( 'panel' );
			var viewer = document.getElementById( 'viewer' );

			var html = '<h1><a href="http://threejs.org">three.js</a><span style="font-size: 50%; vertical-align: super;"> r' + REVISION + '</span></h1>';

			var DELIMITER = '/';
			var nameCategoryMap = {};

			for ( var section in list ) {

				html += '<h2>' + section + '</h2>';

				html += '<ul>';

				for ( var category in list[ section ] ) {

					html += '<h3>' + category + '</h3>';

					html += '<ul>';

					for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {

						var page = list[ section ][ category ][ i ];

						html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';

						nameCategoryMap[page[0]] = {
							section: section,
							category: category,
							name: page[0]
						};

					}

					html += '</ul>';

				}

				html += '</ul>';

			}

			panel.innerHTML += html;

			function encodeUrl( path ) {

				return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');

			}

			function decodeUrl( path ) {

				return path.replace(/_/g, ' ').replace(/\./g, ' / ');

			}

			// Page loading

			function goTo( section, category, name ) {

				// Fully resolve links that only provide a name
				if(arguments.length == 1) {
					var location = nameCategoryMap[section];
					section = location.section;
					category = location.category;
					name = location.name;
				}

				var title = 'three.js - documentation - ' + section + ' - ' + name;
				var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);

				window.location.hash = url;
				window.document.title = title;


				viewer.src = pages[ section ][ category ][ name ] + '.html';

			}

			function goToHash() {

				var hash = window.location.hash.substring( 1 ).split(DELIMITER);
				goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );

			}

			window.addEventListener( 'hashchange', goToHash, false );

			if ( window.location.hash.length > 0 ) goToHash();

		</script>
	</body>
M
Mr.doob 已提交
194
</html>