From 18571c279d9b00aa8c82cfa1a6418c7d19309889 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 22 Jun 2026 10:11:02 +0200 Subject: [PATCH 1/2] Manual: Fix link navigation. (#33858) --- manual/resources/lesson.js | 60 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/manual/resources/lesson.js b/manual/resources/lesson.js index e20afd59d8de9e..7a8824c5415ccc 100644 --- a/manual/resources/lesson.js +++ b/manual/resources/lesson.js @@ -3,9 +3,41 @@ ( function () { + if ( ! window.frameElement && window.location.protocol !== 'file:' ) { + + // not in iframe: redirect to the framed manual + + const re = /^(.*?\/manual\/)(.*?)$/; + const [ , baseURL, articlePath ] = re.exec( window.location.href ); + const href = `${baseURL}#${articlePath.replace( '.html', '' )}`; + window.location.replace( href ); // lgtm[js/client-side-unvalidated-url-redirection] + + } + + const parts = window.location.href.split( '/' ); + const filename = parts[ parts.length - 1 ]; + + if ( filename !== 'primitives.html' && filename !== 'prerequisites.html' ) { + + let text = document.body.innerHTML; + + text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '$1' ); // [link:url] + text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '$2' ); // [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, '$2' ); // [example:name title] + text = text.replace( /\`(.*?)\`/gs, '$1' ); // `code` + + document.body.innerHTML = text; + + } + if ( window.frameElement ) { // in iframe + // Bind link handlers after the innerHTML above has been (re)written, + // otherwise the reassignment discards the freshly attached listeners + // and clicks fall back to native iframe navigation, leaving the parent + // page's URL hash and sidebar out of sync. document.querySelectorAll( 'a' ).forEach( a => { // we have to send all links to the parent @@ -34,34 +66,6 @@ } ); window.parent.setTitle( document.title ); - } else { - - if ( window.location.protocol !== 'file:' ) { - - const re = /^(.*?\/manual\/)(.*?)$/; - const [ , baseURL, articlePath ] = re.exec( window.location.href ); - const href = `${baseURL}#${articlePath.replace( '.html', '' )}`; - window.location.replace( href ); // lgtm[js/client-side-unvalidated-url-redirection] - - } - - } - - const parts = window.location.href.split( '/' ); - const filename = parts[ parts.length - 1 ]; - - if ( filename !== 'primitives.html' && filename !== 'prerequisites.html' ) { - - let text = document.body.innerHTML; - - text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '$1' ); // [link:url] - text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '$2' ); // [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, '$2' ); // [example:name title] - text = text.replace( /\`(.*?)\`/gs, '$1' ); // `code` - - document.body.innerHTML = text; - } if ( window.prettyPrint ) { From 70ea716718752e84fa3223b73d5bd875ceac8a1e Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 22 Jun 2026 10:18:42 +0200 Subject: [PATCH 2/2] Update misc_exporter_gltf_normals.html Fix import. --- examples/misc_exporter_gltf_normals.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/misc_exporter_gltf_normals.html b/examples/misc_exporter_gltf_normals.html index 4c87c75a991786..33acaa5d4de3d7 100644 --- a/examples/misc_exporter_gltf_normals.html +++ b/examples/misc_exporter_gltf_normals.html @@ -27,7 +27,7 @@