Add standalone bicycle library theme, search now opens the popup of the found object

This commit is contained in:
Pieter Vander Vennet 2021-01-06 02:09:04 +01:00
parent a35b80afbb
commit c359d43b15
15 changed files with 260 additions and 43 deletions

View file

@ -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))

View file

@ -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);
}