Closed wellemut closed 5 months ago
@alex0107 damit so ein link wieder funktioniert: https://kartevonmorgen.org/#/?entry=414e91009f3f4bc2813323dedb718756
Musst du da was einstellen oder muss Navid etwas programmieren? Ich meine, mit der Landingpage von Navid hatten die redirects eigentlich funktioniert. Richtige weiterleitungsziel wäre https://www.kartevonmorgen.org/m/main/e/414e91009f3f4bc2813323dedb718756
Das ist jetzt auf der Website hinterlegt. Das sollte eigentlich alles oder zumindest das meiste abdecken....wenn was fehlt einfach melden
if (window.location.href.indexOf("/#/") > -1) {
var path = window.location.hash;
const startCharsToRemove = `#/?`;
let numberOfCharsToDrop = 0;
for (numberOfCharsToDrop; numberOfCharsToDrop !== startCharsToRemove.length; numberOfCharsToDrop++) {
if (startCharsToRemove[numberOfCharsToDrop] !== path[numberOfCharsToDrop]) {
break;
}
}
const trimmedPath = path.substring(numberOfCharsToDrop);
const params = new Proxy(new URLSearchParams(trimmedPath), {
get: (searchParams, prop) => searchParams.get(prop),
});
// entry
// center
// zoom
// search
// dropdowns
let newpath = '/m/' + (params.dropdowns ? params.dropdowns : 'main');
if (params.zoom)
params.zoom = params.zoom.replaceAll(",", " ");
if (params.entry) {
newpath += '/e/' + params.entry;
if (params.center)
newpath += '?c=' + params.center;
if (params.zoom)
newpath += '&z=' + params.zoom;
} else {
newpath += '?c=' + params.center + '&z=' + params.zoom;
}
if (params.search) {
const [newSearch, tagsFromSearchInput] = extractTagsFromSearchQuery(params.search);
if (tagsFromSearchInput)
newpath += '&search=' + encodeURIComponent(newSearch) + '&tag=' + tagsFromSearchInput;
else
newpath += '&search=' + encodeURIComponent(newSearch);
}
if (params.left) {
if (params.left == "hide")
newpath += '&sidebar=hidden';
}
let url = "https://www.kartevonmorgen.org" + newpath;
console.log(url);
window.location.href = url;
}
function extractTagsFromSearchQuery(search) {
if (!search) {
return [search, []];
}
var tokens = search.split(' ');
var tags = [];
var newSearch = '';
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token.startsWith('#')) {
tags.push(token.substring(1));
} else {
newSearch = newSearch + ' ' + token;
}
}
newSearch = newSearch.trim();
return [newSearch, tags];
}
perfekt @alex0107 ich glaube jetzt funktioniert wieder alles!
Describe the bug Many Networks are using our maps in their webpages with an old iframe, like https://www.transition-initiativen.org/liste-der-transition-initiativen. But behind their iframes they use the old tag-filters with # in searchbar: https://www.kartevonmorgen.org/#/?center=51.007,6.996&zoom=5.83&search=%23transitiontown
-> Problem: The part &search=%23transitiontown is completly lost!
To Reproduce Steps to reproduce the behavior:
Expected behavior The URL command
&search=%23
or&search=#
should be redirected to&tag=
or at least&search=%23
So https://www.kartevonmorgen.org/#/?center=51.007,6.996&zoom=5.83&search=%23transitiontown should become
@navid-kalaei is this redirection a question of map-app or @alex0107 is this a configuration in the hosting?
Screenshots Old Version: https://v0.kartevonmorgen.org/#/?center=51.392,9.141&zoom=6.00&search=%23transitiontown&dropdowns=kvm
New Verson: https://www.kartevonmorgen.org/m/main?c=51.0070%2C6.9960&z=5.83&tag=transitiontown
Additional context Previous issue on this problem: https://github.com/kartevonmorgen/kartevonmorgen.ts/issues/94