forked from MapComplete/MapComplete
Add standalone bicycle library theme, search now opens the popup of the found object
This commit is contained in:
parent
a35b80afbb
commit
c359d43b15
15 changed files with 260 additions and 43 deletions
|
@ -2,11 +2,17 @@ import {UIEventSource} from "../UIEventSource";
|
|||
|
||||
export default class Hash {
|
||||
|
||||
public static Get() : UIEventSource<string>{
|
||||
public static hash : UIEventSource<string> = Hash.Get();
|
||||
|
||||
private static Get() : UIEventSource<string>{
|
||||
const hash = new UIEventSource<string>(window.location.hash.substr(1));
|
||||
hash.addCallback(h => {
|
||||
if(h === undefined || h === ""){
|
||||
window.location.hash = "";
|
||||
return;
|
||||
}
|
||||
h = h.replace(/\//g, "_");
|
||||
return window.location.hash = "#" + h;
|
||||
window.location.hash = "#" + h;
|
||||
});
|
||||
window.onhashchange = () => {
|
||||
hash.setData(window.location.hash.substr(1))
|
||||
|
|
|
@ -62,7 +62,7 @@ export class QueryParameters {
|
|||
|
||||
parts.push(encodeURIComponent(key) + "=" + encodeURIComponent(QueryParameters.knownSources[key].data))
|
||||
}
|
||||
history.replaceState(null, "", "?" + parts.join("&") + "#" + Hash.Get().data);
|
||||
history.replaceState(null, "", "?" + parts.join("&") + "#" + Hash.hash.data);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue