Skip to content

Commit c807b92

Browse files
committed
Remove unecessary reload, and make it more reliant
1 parent 4879c38 commit c807b92

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

app/Main.qml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"content-hub": "mapsexporter.contenthub"
1313
}
1414
},
15-
"version": "0.1.6",
15+
"version": "0.1.7",
1616
"maintainer": "Pierre Parent <pro@pierre-parent.fr>",
1717
"framework" : "ubuntu-sdk-20.04"
1818
}

0 commit comments

Comments
 (0)