Browse Source

Manual: Fix primitives page. (#30997)

Michael Herzog 10 months ago
parent
commit
dcabbf7343
2 changed files with 16 additions and 9 deletions
  1. 14 7
      manual/resources/lesson.js
  2. 2 2
      manual/resources/threejs-primitives.js

+ 14 - 7
manual/resources/lesson.js

@@ -48,15 +48,22 @@
 
 	}
 
-	let text = document.body.innerHTML;
+	const parts = window.location.href.split( '/' );
+	const filename = parts[ parts.length - 1 ];
 
-	text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '<a href="$1" target="_blank">$1</a>' ); // [link:url]
-	text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '<a href="$1" target="_blank">$2</a>' ); // [link:url title]
-	text = text.replace( /\[example:([\w\_]+)\]/gi, '[example:$1 $1]' ); // [example:name] to [example:name title]
-	text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, '<a href="../../examples/#$1" target="_blank">$2</a>' ); // [example:name title]
-	text = text.replace( /\`(.*?)\`/gs, '<code class="notranslate" translate="no">$1</code>' ); // `code`
+	if ( filename !== 'primitives.html' ) {
 
-	document.body.innerHTML = text;
+		let text = document.body.innerHTML;
+
+		text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '<a href="$1" target="_blank">$1</a>' ); // [link:url]
+		text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '<a href="$1" target="_blank">$2</a>' ); // [link:url title]
+		text = text.replace( /\[example:([\w\_]+)\]/gi, '[example:$1 $1]' ); // [example:name] to [example:name title]
+		text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, '<a href="../../examples/#$1" target="_blank">$2</a>' ); // [example:name title]
+		text = text.replace( /\`(.*?)\`/gs, '<code class="notranslate" translate="no">$1</code>' ); // `code`
+
+		document.body.innerHTML = text;
+
+	}
 
 	if ( window.prettyPrint ) {
 

+ 2 - 2
manual/resources/threejs-primitives.js

@@ -830,7 +830,7 @@ const geometry = new THREE.WireframeGeometry(
 
 		const a = document.createElement( 'a' );
 		a.setAttribute( 'target', '_blank' );
-		a.href = href || `https://threejs.org/docs/#api/geometries/${name}`;
+		a.href = href || `https://threejs.org/docs/#api/en/geometries/${name}`;
 		const code = document.createElement( 'code' );
 		code.textContent = name;
 		a.appendChild( code );
@@ -842,7 +842,7 @@ const geometry = new THREE.WireframeGeometry(
 	function addDeepLink( parent, name, href ) {
 
 		const a = document.createElement( 'a' );
-		a.href = href || `https://threejs.org/docs/#api/geometries/${name}`;
+		a.href = href || `https://threejs.org/docs/#api/en/geometries/${name}`;
 		a.textContent = name;
 		a.className = 'deep-link';
 		parent.appendChild( a );

粤ICP备19079148号