diff --git a/src/babillard.ml b/src/babillard.ml
index 29695a2..3c66c05 100644
--- a/src/babillard.ml
+++ b/src/babillard.ml
@@ -225,12 +225,9 @@ let parse_image image =
(* make up random name if no name was given *)
Uuidm.to_string (Uuidm.v4_gen random_state ())
in
- if not (is_valid_image content) then
- Error "invalid image"
- else if String.length alt > 1000 then
- Error "Image description too long"
- else
- Ok (Some (name, content, alt))
+ if not (is_valid_image content) then Error "invalid image"
+ else if String.length alt > 1000 then Error "Image description too long"
+ else Ok (Some (name, content, alt))
(*TODO switch to markdown !*)
(* insert html into the comment, and keep tracks of citations :
diff --git a/src/babillard_page.eml.html b/src/babillard_page.eml.html
index 47954df..42f52d0 100644
--- a/src/babillard_page.eml.html
+++ b/src/babillard_page.eml.html
@@ -6,7 +6,7 @@ let f request =
-
+
% if Option.is_some @@ Dream.session "nick" request then begin
New Thread
% end;
diff --git a/src/content/assets/css/style.css b/src/content/assets/css/style.css
index 04c233c..99a6a14 100644
--- a/src/content/assets/css/style.css
+++ b/src/content/assets/css/style.css
@@ -69,6 +69,26 @@ blockquote.blockquote {
color: green;
}
+.quoteLink {
+ background-color: #FCE4EC;
+ padding: 2px;
+ text-align: center;
+ color: #5a5a5a;
+ font-size: 10px;
+ border-radius: 12px;
+ border: 2px solid DodgerBlue;
+}
+
+.quoteLink:focus {
+ background-color: #FCE4EC;
+ padding: 2px;
+ text-align: center;
+ color: #5a5a5a;
+ font-size: 10px;
+ border-radius: 12px;
+ border: 2px solid DodgerBlue;
+}
+
.postForm {
background-color: #FCE4EC;
margin: 5px 5px 5px 5px;
diff --git a/src/js/js_map.ml b/src/js/js_map.ml
index 26532c5..0a8371b 100644
--- a/src/js/js_map.ml
+++ b/src/js/js_map.ml
@@ -101,12 +101,16 @@ module Geolocalize = struct
in
ignore @@ Jv.call Leaflet.map "setView" [| latlng; Jv.of_int 13 |]
- let geolocalize () =
+ let geolocalize _ =
log "geolocalize@.";
let l = Brr_io.Geolocation.of_navigator Brr.G.navigator in
ignore @@ Fut.await (Brr_io.Geolocation.get l) update_location
- let () = Jv.set Jv.global "geolocalize" (Jv.repr geolocalize)
+ let () =
+ let button = Jv.get Jv.global "geolocalize" in
+ ignore
+ @@ Jv.call button "addEventListener"
+ [| Jv.of_string "click"; Jv.repr geolocalize |]
end
module Marker = struct
diff --git a/src/js/js_post_form.ml b/src/js/js_post_form.ml
index f9f0c99..17cedfb 100644
--- a/src/js/js_post_form.ml
+++ b/src/js/js_post_form.ml
@@ -2,7 +2,7 @@ let log = Format.printf
(* called by clicking post_id *)
(* insert id into reply form *)
-let insert_quote post_id =
+let insert_quote post_id _event =
log "quote@.";
Option.iter
(fun comment_textarea ->
@@ -15,7 +15,23 @@ let insert_quote post_id =
Jv.(find global "replyComment");
Jv.undefined
-let () = Jv.set Jv.global "insert_quote" (Jv.repr insert_quote)
+let () =
+ log "add inser_quote event on post links@.";
+ let document = Jv.get Jv.global "document" in
+ let quote_links =
+ Jv.to_jv_list
+ @@ Jv.call document "getElementsByClassName" [| Jv.of_string "quoteLink" |]
+ in
+ log "quote_links leng %d@." (List.length quote_links);
+ let add_click quote_link =
+ let post_id =
+ Jv.call quote_link "getAttribute" [| Jv.of_string "data-id" |]
+ in
+ ignore
+ @@ Jv.call quote_link "addEventListener"
+ [| Jv.of_string "click"; Jv.repr (insert_quote post_id) |]
+ in
+ List.iter add_click quote_links
(* make image description field visible when a file is selected*)
let make_visible el _event =
diff --git a/src/js/js_pretty_post.ml b/src/js/js_pretty_post.ml
index 66bf5f0..0ac4c83 100644
--- a/src/js/js_pretty_post.ml
+++ b/src/js/js_pretty_post.ml
@@ -43,7 +43,7 @@ let render_time date_span =
in
ignore @@ Jv.set date_span "innerHTML" (Jv.of_string date)
-let make_pretty _ =
+let make_pretty _event =
log "make pretty@.";
let document = Jv.get Jv.global "document" in
diff --git a/src/newthread_page.eml.html b/src/newthread_page.eml.html
index b3e1d82..85c6d84 100644
--- a/src/newthread_page.eml.html
+++ b/src/newthread_page.eml.html
@@ -13,7 +13,7 @@ let f request =