@@ -82,7 +82,6 @@ MainView {
8282 var str= parts .length ? parts[0 ].trim () : t .trim ();
8383 var str2= str .replace (" ," , " ,\n " )
8484 overlayText .text = " Taking you to\n " + str2;
85- mapView .reload ();
8685 overlayPanel .visible = true ;
8786 delayedTimer .start ();
8887 }
@@ -122,19 +121,20 @@ MainView {
122121 repeat: true
123122 onTriggered: {
124123 // Récupère l'URL réelle de la WebView
125- mapView .runJavaScript (" window.location.href;" , function (result ) {
126- var urlStr = result;
124+ var urlStr = mapView .url .toString ();
127125 var n= 5 ;
128126 var latMatch;
129127 var lonMatch;
130- while ( ! (latMatch && lonMatch) && n < urlStr .length )
128+ // Search for long lat, starting by the end of the url
129+ while ( ! (latMatch && lonMatch) && n + 6 < urlStr .length )
131130 {
132- n= n+ 3 ;
133- var urlres= urlStr .slice (- n);
134- latMatch = urlres .match (/ !3d([-0-9 . ] + )/ );
135- if (latMatch)
136- lonMatch = urlres .match (/ !4d([-0-9 . ] + )/ );
131+ n= n+ 6 ;
132+ var urlres= urlStr .slice (- n);
133+ latMatch = urlres .match (/ !3d([-0-9 . ] + )/ );
134+ if (latMatch)
135+ lonMatch = urlres .match (/ !4d([-0-9 . ] + )/ );
137136 }
137+
138138 if ( ! (latMatch && lonMatch) ) {
139139 latMatch = urlStr .match (/ !3d([-0-9 . ] + )/ );
140140 lonMatch = urlStr .match (/ !4d([-0-9 . ] + )/ );
@@ -149,7 +149,6 @@ MainView {
149149 } else {
150150 console .log (" Coordonnées introuvables dans l'URL: " + urlStr);
151151 }
152- });
153152 }
154153 }
155154
0 commit comments