File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,20 @@ let wasm = null;
3434let loadedImage = null ;
3535let renderToken = 0 ;
3636
37+ function urlWasmVersionnee ( ) {
38+ try {
39+ if ( typeof document . querySelector !== "function" ) return "hexagonify.wasm" ;
40+ const scriptCourant = document . querySelector ( 'script[src*="app.js"]' ) ;
41+ if ( ! scriptCourant ?. src ) return "hexagonify.wasm" ;
42+ const urlScript = new URL ( scriptCourant . src , window . location . href ) ;
43+ const urlWasm = new URL ( "hexagonify.wasm" , urlScript ) ;
44+ if ( urlScript . search ) urlWasm . search = urlScript . search ;
45+ return urlWasm . toString ( ) ;
46+ } catch ( err ) {
47+ return "hexagonify.wasm" ;
48+ }
49+ }
50+
3751function afficherOverlay ( actif ) {
3852 const overlay = document . getElementById ( "processing-overlay" ) ;
3953 if ( overlay ) overlay . classList . toggle ( "actif" , actif ) ;
@@ -43,7 +57,7 @@ async function chargerWasm() {
4357 const status = document . getElementById ( "wasm-status" ) ;
4458 const btnApply = document . getElementById ( "btn-apply" ) ;
4559 try {
46- const response = await fetch ( "hexagonify.wasm" ) ;
60+ const response = await fetch ( urlWasmVersionnee ( ) ) ;
4761 if ( ! response . ok ) throw new Error ( `Fichier WASM indisponible (${ response . status } ).` ) ;
4862 const bytes = await response . arrayBuffer ( ) ;
4963 if ( bytes . byteLength < 8 ) throw new Error ( "Fichier WASM vide ou tronque." ) ;
You can’t perform that action at this time.
0 commit comments