summaryrefslogtreecommitdiffabout
path: root/dict.ml
diff options
context:
space:
mode:
Diffstat (limited to 'dict.ml')
-rw-r--r--dict.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/dict.ml b/dict.ml
index bbfb575..c23dc8d 100644
--- a/dict.ml
+++ b/dict.ml
@@ -108,11 +108,12 @@ let results_html =
let () =
let main = Dom_html.getElementById "main" in
let input_node = Tyxml_js.To_dom.of_input input_box in
+ let page_uri = Dom_html.window##.location##.href |> Js.to_string |> Uri.of_string in
+
Lwt.async (fun _ ->
Lwt_js_events.domContentLoaded () >>= fun _ ->
main##appendChild (Tyxml_js.To_dom.of_node search_box) |> ignore;
main##appendChild (Tyxml_js.To_dom.of_node results_html) |> ignore;
- let page_uri = Dom_html.window##.location##.href |> Js.to_string |> Uri.of_string in
begin match Uri.fragment page_uri with
| Some frag ->
input_node##.value := (Js.string frag);
@@ -127,6 +128,8 @@ let () =
Lwt_js_events.input input_node (fun _ _ ->
let text = Js.to_string ((Tyxml_js.To_dom.of_input input_box)##.value) in
set_search text;
+ let uri = Uri.with_fragment page_uri (Some text) in
+ Dom_html.window##.location##.href := Js.string (Uri.to_string uri);
return ()
)
)