Przeglądaj źródła

update: add Arabic lang support

Hassan Muhamad 5 lat temu
rodzic
commit
7a105b18fa
1 zmienionych plików z 286 dodań i 282 usunięć
  1. 286 282
      docs/index.html

+ 286 - 282
docs/index.html

@@ -1,479 +1,483 @@
 <!DOCTYPE html>
 <html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<title>three.js docs</title>
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link rel="shortcut icon" href="../files/favicon.ico" />
-		<link rel="stylesheet" type="text/css" href="../files/main.css">
-		<!-- console sandbox -->
-		<script src="../build/three.min.js" async defer></script>
-	</head>
-	<body>
-		<div id="panel">
-
-			<div id="header">
-				<h1><a href="http://threejs.org">three.js</a></h1>
-
-				<div id="sections">
-					<span class="selected">docs</span>
-					<a href="../examples/#webgl_animation_cloth">examples</a>
-				</div>
-
-				<div id="expandButton"></div>
-			</div>
 
-			<div id="panelScrim"></div>
-
-			<div id="contentWrapper">
-				<div id="inputWrapper">
-					<input placeholder="" type="text" id="filterInput" autocorrect="off" autocapitalize="off" spellcheck="false" />
-					<div id="exitSearchButton"></div>
-					<select id="language">
-						<option value="en">en</option>
-						<option value="zh">中文</option>
-					</select>
-				</div>
-				<div id="content"></div>
+<head>
+	<meta charset="utf-8">
+	<title>three.js docs</title>
+	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+	<link rel="shortcut icon" href="../files/favicon.ico" />
+	<link rel="stylesheet" type="text/css" href="../files/main.css">
+	<!-- console sandbox -->
+	<script src="../build/three.min.js" async defer></script>
+</head>
+
+<body>
+	<div id="panel">
+
+		<div id="header">
+			<h1><a href="http://threejs.org">three.js</a></h1>
+
+			<div id="sections">
+				<span class="selected">docs</span>
+				<a href="../examples/#webgl_animation_cloth">examples</a>
 			</div>
 
+			<div id="expandButton"></div>
 		</div>
 
-		<iframe name="viewer"></iframe>
+		<div id="panelScrim"></div>
+
+		<div id="contentWrapper">
+			<div id="inputWrapper">
+				<input placeholder="" type="text" id="filterInput" autocorrect="off" autocapitalize="off"
+					spellcheck="false" />
+				<div id="exitSearchButton"></div>
+				<select id="language">
+					<option value="en">en</option>
+					<option value="ar">ar</option>
+					<option value="zh">中文</option>
+				</select>
+			</div>
+			<div id="content"></div>
+		</div>
 
-		<script src="list.js"></script>
+	</div>
 
-		<script>
+	<iframe name="viewer"></iframe>
 
-			var hash = window.location.hash.substring( 1 );
+	<script src="list.js"></script>
 
-			// Localisation
+	<script>
 
-			var language = 'en';
+		var hash = window.location.hash.substring(1);
 
-			if ( /^(api|manual|examples)/.test( hash ) ) {
+		// Localisation
 
-				var hashLanguage = /^(api|manual|examples)\/(en|zh)\//.exec( hash );
+		var language = 'en';
 
-				if ( hashLanguage === null ) {
+		if (/^(api|manual|examples)/.test(hash)) {
 
-					// Route old non-localised api links
+			var hashLanguage = /^(api|manual|examples)\/(en|ar|zh)\//.exec(hash);
 
-					window.location.hash = hash.replace( /^(api|manual|examples)/, '$1/en' );
+			if (hashLanguage === null) {
 
-				} else {
+				// Route old non-localised api links
 
-					language = hashLanguage[ 2 ];
+				window.location.hash = hash.replace(/^(api|manual|examples)/, '$1/en');
 
-				}
+			} else {
+
+				language = hashLanguage[2];
 
 			}
 
-			//
+		}
 
-			var languageSelect = document.getElementById( 'language' );
-			languageSelect.value = language;
-			languageSelect.addEventListener( 'change', function ( event ) {
+		//
 
-				setLanguage( this.value );
+		var languageSelect = document.getElementById('language');
+		languageSelect.value = language;
+		languageSelect.addEventListener('change', function (event) {
 
-			} );
+			setLanguage(this.value);
 
-			function setLanguage( value ) {
+		});
 
-				language = value;
+		function setLanguage(value) {
 
-				createNavigation();
-				updateFilter();
-				autoChangeUrlLanguage( language );
+			language = value;
 
-			}
+			createNavigation();
+			updateFilter();
+			autoChangeUrlLanguage(language);
 
-			var panel = document.getElementById( 'panel' );
-			var content = document.getElementById( 'content' );
-			var expandButton = document.getElementById( 'expandButton' );
-			var exitSearchButton = document.getElementById( 'exitSearchButton' );
-			var panelScrim = document.getElementById( 'panelScrim' );
-			var filterInput = document.getElementById( 'filterInput' );
-			var iframe = document.querySelector( 'iframe' );
+		}
 
-			var pageProperties = {};
-			var titles = {};
-			var categoryElements = [];
+		var panel = document.getElementById('panel');
+		var content = document.getElementById('content');
+		var expandButton = document.getElementById('expandButton');
+		var exitSearchButton = document.getElementById('exitSearchButton');
+		var panelScrim = document.getElementById('panelScrim');
+		var filterInput = document.getElementById('filterInput');
+		var iframe = document.querySelector('iframe');
 
-			var navigation;
+		var pageProperties = {};
+		var titles = {};
+		var categoryElements = [];
 
-			// Functionality for hamburger button (on small devices)
+		var navigation;
 
-			expandButton.onclick = function ( event ) {
+		// Functionality for hamburger button (on small devices)
 
-				event.preventDefault();
-				panel.classList.toggle( 'open' );
+		expandButton.onclick = function (event) {
 
-			};
+			event.preventDefault();
+			panel.classList.toggle('open');
 
-			panelScrim.onclick = function ( event ) {
+		};
 
-				event.preventDefault();
-				panel.classList.toggle( 'open' );
+		panelScrim.onclick = function (event) {
 
-			};
+			event.preventDefault();
+			panel.classList.toggle('open');
 
+		};
 
-			// Functionality for search/filter input field
-			filterInput.onfocus = function ( event ) {
 
-				panel.classList.add( 'searchFocused' );
+		// Functionality for search/filter input field
+		filterInput.onfocus = function (event) {
 
-			};
+			panel.classList.add('searchFocused');
 
-			filterInput.onblur = function ( event ) {
+		};
 
-				if ( filterInput.value === '' ) {
+		filterInput.onblur = function (event) {
 
-					panel.classList.remove( 'searchFocused' );
+			if (filterInput.value === '') {
 
-				}
+				panel.classList.remove('searchFocused');
 
-			};
+			}
 
-			exitSearchButton.onclick = function ( event ) {
+		};
 
-				filterInput.value = '';
-				updateFilter();
-				panel.classList.remove( 'searchFocused' );
+		exitSearchButton.onclick = function (event) {
 
-			};
+			filterInput.value = '';
+			updateFilter();
+			panel.classList.remove('searchFocused');
 
-			filterInput.oninput = function ( event ) {
+		};
 
-				updateFilter();
+		filterInput.oninput = function (event) {
 
-			};
+			updateFilter();
 
-			// Activate content and title change on browser navigation
+		};
 
-			window.onpopstate = createNewIframe;
+		// Activate content and title change on browser navigation
 
-			// Create the navigation panel and configure the iframe
+		window.onpopstate = createNewIframe;
 
-			createNavigation();
-			createNewIframe();
+		// Create the navigation panel and configure the iframe
 
-			// Navigation Panel
+		createNavigation();
+		createNewIframe();
 
-			function createLink( pageName, pageURL ) {
+		// Navigation Panel
 
-				var link = document.createElement( 'a' );
-				link.href = pageURL + '.html';
-				link.textContent = pageName;
-				link.setAttribute( 'target', 'viewer' );
-				link.addEventListener( 'click', function ( event ) {
+		function createLink(pageName, pageURL) {
 
-					if ( event.button !== 0 || event.ctrlKey || event.altKey || event.metaKey ) return;
+			var link = document.createElement('a');
+			link.href = pageURL + '.html';
+			link.textContent = pageName;
+			link.setAttribute('target', 'viewer');
+			link.addEventListener('click', function (event) {
 
-					window.location.hash = pageURL;
-					panel.classList.remove( 'open' );
+				if (event.button !== 0 || event.ctrlKey || event.altKey || event.metaKey) return;
 
+				window.location.hash = pageURL;
+				panel.classList.remove('open');
 
-					content.querySelectorAll( 'a' ).forEach( function ( item ) {
 
-						item.classList.remove( 'selected' );
+				content.querySelectorAll('a').forEach(function (item) {
 
-					} );
+					item.classList.remove('selected');
 
-					link.classList.add( 'selected' );
+				});
 
-				} );
+				link.classList.add('selected');
 
-				return link;
+			});
 
-			}
+			return link;
 
-			function createNavigation() {
+		}
 
-				if ( navigation !== undefined ) {
+		function createNavigation() {
 
-					content.removeChild( navigation );
+			if (navigation !== undefined) {
 
-				}
+				content.removeChild(navigation);
 
-				// Create the navigation panel using data from list.js
+			}
 
-				navigation = document.createElement( 'div' );
-				content.appendChild( navigation );
+			// Create the navigation panel using data from list.js
 
-				var localList = list[ language ];
+			navigation = document.createElement('div');
+			content.appendChild(navigation);
 
-				for ( var section in localList ) {
+			var localList = list[language];
 
-					// Create sections
+			for (var section in localList) {
 
-					var categories = localList[ section ];
+				// Create sections
 
-					var sectionHead = document.createElement( 'h2' );
-					sectionHead.textContent = section;
-					navigation.appendChild( sectionHead );
+				var categories = localList[section];
 
-					for ( var category in categories ) {
+				var sectionHead = document.createElement('h2');
+				sectionHead.textContent = section;
+				navigation.appendChild(sectionHead);
 
-						// Create categories
+				for (var category in categories) {
 
-						var pages = categories[ category ];
+					// Create categories
 
-						var categoryContainer = document.createElement( 'div' );
-						navigation.appendChild( categoryContainer );
+					var pages = categories[category];
 
-						var categoryHead = document.createElement( 'h3' );
-						categoryHead.textContent = category;
-						categoryContainer.appendChild( categoryHead );
+					var categoryContainer = document.createElement('div');
+					navigation.appendChild(categoryContainer);
 
-						var categoryContent = document.createElement( 'ul' );
-						categoryContainer.appendChild( categoryContent );
+					var categoryHead = document.createElement('h3');
+					categoryHead.textContent = category;
+					categoryContainer.appendChild(categoryHead);
 
-						for ( var pageName in pages ) {
+					var categoryContent = document.createElement('ul');
+					categoryContainer.appendChild(categoryContent);
 
-							// Create page links
+					for (var pageName in pages) {
 
-							var pageURL = pages[ pageName ];
+						// Create page links
 
-							// Localisation
+						var pageURL = pages[pageName];
 
-							var listElement = document.createElement( 'li' );
-							categoryContent.appendChild( listElement );
+						// Localisation
 
-							var linkElement = createLink( pageName, pageURL );
-							listElement.appendChild( linkElement );
+						var listElement = document.createElement('li');
+						categoryContent.appendChild(listElement);
 
-							// Gather the main properties for the current subpage
+						var linkElement = createLink(pageName, pageURL);
+						listElement.appendChild(linkElement);
 
-							pageProperties[ pageName ] = {
-								section: section,
-								category: category,
-								pageURL: pageURL,
-								linkElement: linkElement
-							};
+						// Gather the main properties for the current subpage
 
-							// Gather the document titles (used for easy access on browser navigation)
+						pageProperties[pageName] = {
+							section: section,
+							category: category,
+							pageURL: pageURL,
+							linkElement: linkElement
+						};
 
-							titles[ pageURL ] = pageName;
+						// Gather the document titles (used for easy access on browser navigation)
 
-						}
+						titles[pageURL] = pageName;
 
-						// Gather the category elements for easy access on filtering
+					}
 
-						categoryElements.push( categoryContent );
+					// Gather the category elements for easy access on filtering
 
-					}
+					categoryElements.push(categoryContent);
 
 				}
 
 			}
 
-			// Auto change language url. If a reader open a document in English, when he click "zh", the document he read will auto change into Chinese version
+		}
 
-			function autoChangeUrlLanguage( language ) {
+		// Auto change language url. If a reader open a document in English, when he click "zh", the document he read will auto change into Chinese version
 
-				var hash = location.hash;
-				if ( hash === '' ) return;
-				var docType = hash.substr( 0, hash.indexOf( '/' ) + 1 );
-				var docLink = hash.substr( hash.indexOf( '/' ) + 1 );
-				docLink = docLink.substr( docLink.indexOf( '/' ) );
-				location.href = docType + language + docLink;
+		function autoChangeUrlLanguage(language) {
 
-			}
+			var hash = location.hash;
+			if (hash === '') return;
+			var docType = hash.substr(0, hash.indexOf('/') + 1);
+			var docLink = hash.substr(hash.indexOf('/') + 1);
+			docLink = docLink.substr(docLink.indexOf('/'));
+			location.href = docType + language + docLink;
 
-			// Filtering
+		}
 
-			function updateFilter() {
+		// Filtering
 
-				// (uncomment the following line and the "Query strings" section, if you want query strings):
-				// updateQueryString();
+		function updateFilter() {
 
-				var regExp = new RegExp( filterInput.value, 'gi' );
+			// (uncomment the following line and the "Query strings" section, if you want query strings):
+			// updateQueryString();
 
-				for ( var pageName in pageProperties ) {
+			var regExp = new RegExp(filterInput.value, 'gi');
 
-					var linkElement = pageProperties[ pageName ].linkElement;
-					var categoryClassList = linkElement.parentElement.classList;
-					var filterResults = pageName.match( regExp );
+			for (var pageName in pageProperties) {
 
-					if ( filterResults && filterResults.length > 0 ) {
+				var linkElement = pageProperties[pageName].linkElement;
+				var categoryClassList = linkElement.parentElement.classList;
+				var filterResults = pageName.match(regExp);
 
-						// Accentuate matching characters
+				if (filterResults && filterResults.length > 0) {
 
-						for ( var i = 0; i < filterResults.length; i ++ ) {
+					// Accentuate matching characters
 
-							var result = filterResults[ i ];
+					for (var i = 0; i < filterResults.length; i++) {
 
-							if ( result !== '' ) {
+						var result = filterResults[i];
 
-								pageName = pageName.replace( result, '<b>' + result + '</b>' );
+						if (result !== '') {
 
-							}
+							pageName = pageName.replace(result, '<b>' + result + '</b>');
 
 						}
 
-						categoryClassList.remove( 'hidden' );
-						linkElement.innerHTML = pageName;
+					}
 
-					} else {
+					categoryClassList.remove('hidden');
+					linkElement.innerHTML = pageName;
 
-						// Hide all non-matching page names
+				} else {
 
-						categoryClassList.add( 'hidden' );
+					// Hide all non-matching page names
 
-					}
+					categoryClassList.add('hidden');
 
 				}
 
-				displayFilteredPanel();
-
 			}
 
-			function displayFilteredPanel() {
+			displayFilteredPanel();
 
-				// Show/hide categories depending on their content
-				// First check if at least one page in this category is not hidden
+		}
 
-				categoryElements.forEach( function ( category ) {
+		function displayFilteredPanel() {
 
-					var pages = category.children;
-					var pagesLength = pages.length;
-					var sectionClassList = category.parentElement.classList;
+			// Show/hide categories depending on their content
+			// First check if at least one page in this category is not hidden
 
-					var hideCategory = true;
+			categoryElements.forEach(function (category) {
 
-					for ( var i = 0; i < pagesLength; i ++ ) {
+				var pages = category.children;
+				var pagesLength = pages.length;
+				var sectionClassList = category.parentElement.classList;
 
-						var pageClassList = pages[ i ].classList;
+				var hideCategory = true;
 
-						if ( ! pageClassList.contains( 'hidden' ) ) {
+				for (var i = 0; i < pagesLength; i++) {
 
-							hideCategory = false;
+					var pageClassList = pages[i].classList;
 
-						}
+					if (!pageClassList.contains('hidden')) {
+
+						hideCategory = false;
 
 					}
 
-					// If and only if all page names are hidden, hide the whole category
+				}
 
-					if ( hideCategory ) {
+				// If and only if all page names are hidden, hide the whole category
 
-						sectionClassList.add( 'hidden' );
+				if (hideCategory) {
 
-					} else {
+					sectionClassList.add('hidden');
 
-						sectionClassList.remove( 'hidden' );
+				} else {
 
-					}
+					sectionClassList.remove('hidden');
 
-				} );
+				}
 
-			}
+			});
 
-			// Routing
+		}
 
-			function setUrlFragment( pageName ) {
+		// Routing
 
-				// Handle navigation from the subpages (iframes):
-				// First separate the memeber (if existing) from the page name,
-				// then identify the subpage's URL and set it as URL fragment (re-adding the member)
+		function setUrlFragment(pageName) {
 
-				var splitPageName = decomposePageName( pageName, '.', '.' );
+			// Handle navigation from the subpages (iframes):
+			// First separate the memeber (if existing) from the page name,
+			// then identify the subpage's URL and set it as URL fragment (re-adding the member)
 
-				var currentProperties = pageProperties[ splitPageName[ 0 ] ];
+			var splitPageName = decomposePageName(pageName, '.', '.');
 
-				if ( currentProperties ) {
+			var currentProperties = pageProperties[splitPageName[0]];
 
-					window.location.hash = currentProperties.pageURL + splitPageName[ 1 ];
+			if (currentProperties) {
 
-					createNewIframe();
+				window.location.hash = currentProperties.pageURL + splitPageName[1];
 
-				}
+				createNewIframe();
 
 			}
 
-			function createNewIframe() {
+		}
 
-				// Change the content displayed in the iframe
-				// First separate the member part of the fragment (if existing)
+		function createNewIframe() {
 
-				var hash = window.location.hash.substring( 1 );
-				var splitHash = decomposePageName( hash, '.', '#' );
+			// Change the content displayed in the iframe
+			// First separate the member part of the fragment (if existing)
 
-				// Creating a new Iframe instead of assigning a new src is
-				// a cross-browser solution to allow normal browser navigation;
-				// - only assigning a new src would result in two history states each time.
+			var hash = window.location.hash.substring(1);
+			var splitHash = decomposePageName(hash, '.', '#');
 
-				// Note: iframe.contentWindow.location.replace(hash) should work, too,
-				// but it doesn't work in Edge with links from the subpages!
+			// Creating a new Iframe instead of assigning a new src is
+			// a cross-browser solution to allow normal browser navigation;
+			// - only assigning a new src would result in two history states each time.
 
-				var oldIframe;
-				var subtitle;
+			// Note: iframe.contentWindow.location.replace(hash) should work, too,
+			// but it doesn't work in Edge with links from the subpages!
 
-				oldIframe = iframe;
-				iframe = oldIframe.cloneNode();
+			var oldIframe;
+			var subtitle;
 
-				if ( hash ) {
+			oldIframe = iframe;
+			iframe = oldIframe.cloneNode();
 
-					iframe.src = splitHash[ 0 ] + '.html' + splitHash[ 1 ];
-					subtitle = titles[ splitHash[ 0 ] ] + splitHash[ 1 ] + ' – ';
+			if (hash) {
 
-				} else {
+				iframe.src = splitHash[0] + '.html' + splitHash[1];
+				subtitle = titles[splitHash[0]] + splitHash[1] + ' – ';
 
-					iframe.src = '';
-					subtitle = '';
-
-				}
+			} else {
 
-				document.body.replaceChild( iframe, oldIframe );
-				document.title = subtitle + 'three.js docs';
+				iframe.src = '';
+				subtitle = '';
 
 			}
 
-			function decomposePageName( pageName, oldDelimiter, newDelimiter ) {
+			document.body.replaceChild(iframe, oldIframe);
+			document.title = subtitle + 'three.js docs';
 
-				// Helper function for separating the member (if existing) from the pageName
-				// For example: 'Geometry.morphTarget' can be converted to
-				// ['Geometry', '.morphTarget'] or ['Geometry', '#morphTarget']
-				// Note: According RFC 3986 no '#' allowed inside of an URL fragment!
+		}
 
-				var parts = [];
+		function decomposePageName(pageName, oldDelimiter, newDelimiter) {
 
-				var dotIndex = pageName.indexOf( oldDelimiter );
+			// Helper function for separating the member (if existing) from the pageName
+			// For example: 'Geometry.morphTarget' can be converted to
+			// ['Geometry', '.morphTarget'] or ['Geometry', '#morphTarget']
+			// Note: According RFC 3986 no '#' allowed inside of an URL fragment!
 
-				if ( dotIndex !== - 1 ) {
+			var parts = [];
 
-					parts = pageName.split( oldDelimiter );
-					parts[ 1 ] = newDelimiter + parts[ 1 ];
+			var dotIndex = pageName.indexOf(oldDelimiter);
 
-				} else {
+			if (dotIndex !== - 1) {
 
-					parts[ 0 ] = pageName;
-					parts[ 1 ] = '';
+				parts = pageName.split(oldDelimiter);
+				parts[1] = newDelimiter + parts[1];
 
-				}
+			} else {
 
-				return parts;
+				parts[0] = pageName;
+				parts[1] = '';
 
 			}
 
-			//
+			return parts;
+
+		}
+
+		//
 
-			console.log( [
-				'    __     __',
-				' __/ __\\  / __\\__   ____   _____   _____',
-				'/ __/  /\\/ /  /___\\/ ____\\/ _____\\/ _____\\',
-				'\\/_   __/ /   _   / /  __/ / __  / / __  /_   __   _____',
-				'/ /  / / /  / /  / /  / / /  ___/ /  ___/\\ _\\/ __\\/ _____\\',
-				'\\/__/  \\/__/\\/__/\\/__/  \\/_____/\\/_____/\\/__/ /  / /  ___/',
-				'                                         / __/  /  \\__  \\',
-				'                                         \\/____/\\/_____/'
-			].join( '\n' ) );
+		console.log([
+			'    __     __',
+			' __/ __\\  / __\\__   ____   _____   _____',
+			'/ __/  /\\/ /  /___\\/ ____\\/ _____\\/ _____\\',
+			'\\/_   __/ /   _   / /  __/ / __  / / __  /_   __   _____',
+			'/ /  / / /  / /  / /  / / /  ___/ /  ___/\\ _\\/ __\\/ _____\\',
+			'\\/__/  \\/__/\\/__/\\/__/  \\/_____/\\/_____/\\/__/ /  / /  ___/',
+			'                                         / __/  /  \\__  \\',
+			'                                         \\/____/\\/_____/'
+		].join('\n'));
 
-		</script>
+	</script>
 
-	</body>
+</body>
 
-</html>
+</html>