From 92625ecc2390806cc9e5895cfa3d416c9c71d44a Mon Sep 17 00:00:00 2001 From: Swrup Date: Fri, 18 Feb 2022 20:17:24 +0100 Subject: [PATCH] remove camelCase --- src/babillard_page.eml.html | 2 +- src/content/assets/css/style.css | 21 +++++++++++---------- src/js/js_newthread.ml | 4 ++-- src/js/js_post_form.ml | 6 +++--- src/js/js_pretty_post.ml | 8 ++++---- src/newthread_page.eml.html | 26 +++++++++++++------------- src/permap.ml | 11 ++++------- src/pp_babillard.ml | 20 ++++++++++---------- src/thread_page.eml.html | 18 +++++++++--------- 9 files changed, 57 insertions(+), 59 deletions(-) diff --git a/src/babillard_page.eml.html b/src/babillard_page.eml.html index 42f52d0..b5f93bb 100644 --- a/src/babillard_page.eml.html +++ b/src/babillard_page.eml.html @@ -8,7 +8,7 @@ let f request =
% if Option.is_some @@ Dream.session "nick" request then begin - New Thread + New Thread % end;
diff --git a/src/content/assets/css/style.css b/src/content/assets/css/style.css index 99a6a14..e6323b0 100644 --- a/src/content/assets/css/style.css +++ b/src/content/assets/css/style.css @@ -35,7 +35,7 @@ blockquote.blockquote { display: table; } -.postInfo { +.post-info { display: block; width: 100%; } @@ -44,23 +44,23 @@ blockquote.blockquote { color: #FFB300; } -.postComment { +.post-comment { display: block; padding-top: 10px; color: #333333; } -.postImageContainer { +.post-image-container { float: left; padding: 5px 5px 5px 5px; } -.postImage { +.post-image { max-width: 250px; height: auto; } -.postImageBig { +.post-image-big { max-width: 750px; height: auto; } @@ -69,7 +69,7 @@ blockquote.blockquote { color: green; } -.quoteLink { +.quote-link { background-color: #FCE4EC; padding: 2px; text-align: center; @@ -79,7 +79,7 @@ blockquote.blockquote { border: 2px solid DodgerBlue; } -.quoteLink:focus { +.quote-link:focus { background-color: #FCE4EC; padding: 2px; text-align: center; @@ -89,7 +89,7 @@ blockquote.blockquote { border: 2px solid DodgerBlue; } -.postForm { +.post-form { background-color: #FCE4EC; margin: 5px 5px 5px 5px; border: 2px solid #FFB300; @@ -102,14 +102,15 @@ blockquote.blockquote { visibility: hidden; } -#altLabel { +#alt-label { display:none; } + #alt { display:none; } -.threadSubject { +.thread-subject { margin: auto; width: 50%; text-align: center; diff --git a/src/js/js_newthread.ml b/src/js/js_newthread.ml index bf48327..991f0ee 100644 --- a/src/js/js_newthread.ml +++ b/src/js/js_newthread.ml @@ -15,8 +15,8 @@ let on_click e = let lat = Jv.get lat_lng "lat" in let lng = Jv.get lat_lng "lng" in - let lat_input = Jv.get Jv.global "lat_input" in - let lng_input = Jv.get Jv.global "lng_input" in + let lat_input = Jv.get Jv.global "lat-input" in + let lng_input = Jv.get Jv.global "lng-input" in ignore @@ Jv.call lat_input "setAttribute" [| Jv.of_string "value"; lat |]; ignore @@ Jv.call lng_input "setAttribute" [| Jv.of_string "value"; lng |]; diff --git a/src/js/js_post_form.ml b/src/js/js_post_form.ml index 17cedfb..746dd4e 100644 --- a/src/js/js_post_form.ml +++ b/src/js/js_post_form.ml @@ -12,7 +12,7 @@ let insert_quote post_id _event = [| Jv.of_string "\n>>"; post_id; Jv.of_string " " |] in ignore @@ Jv.set comment_textarea "value" new_content ) - Jv.(find global "replyComment"); + Jv.(find global "reply-comment"); Jv.undefined let () = @@ -20,7 +20,7 @@ let () = let document = Jv.get Jv.global "document" in let quote_links = Jv.to_jv_list - @@ Jv.call document "getElementsByClassName" [| Jv.of_string "quoteLink" |] + @@ Jv.call document "getElementsByClassName" [| Jv.of_string "quote-link" |] in log "quote_links leng %d@." (List.length quote_links); let add_click quote_link = @@ -43,7 +43,7 @@ let () = Option.iter (fun file_input -> let alt_input = Jv.get Jv.global "alt" in - let alt_label = Jv.get Jv.global "altLabel" in + let alt_label = Jv.get Jv.global "alt-label" in ignore @@ Jv.call file_input "addEventListener" [| Jv.of_string "change"; Jv.repr (make_visible alt_input) |]; diff --git a/src/js/js_pretty_post.ml b/src/js/js_pretty_post.ml index 0ac4c83..ae70ed0 100644 --- a/src/js/js_pretty_post.ml +++ b/src/js/js_pretty_post.ml @@ -5,11 +5,11 @@ type image_size = | Small let of_string = function - | "postImage" -> Some Small - | "postImageBig" -> Some Big + | "post-image" -> Some Small + | "post-image-big" -> Some Big | _ -> None -let to_string = function Small -> "postImage" | Big -> "postImageBig" +let to_string = function Small -> "post-image" | Big -> "post-image-big" (*change postImage class to make it bigger/smaller on click*) let image_click post_image event = @@ -56,7 +56,7 @@ let make_pretty _event = (*add event image_click to all postImage*) let post_images = Jv.to_jv_list - @@ Jv.call document "getElementsByClassName" [| Jv.of_string "postImage" |] + @@ Jv.call document "getElementsByClassName" [| Jv.of_string "post-image" |] in let add_click el = ignore diff --git a/src/newthread_page.eml.html b/src/newthread_page.eml.html index 85c6d84..11cc53c 100644 --- a/src/newthread_page.eml.html +++ b/src/newthread_page.eml.html @@ -17,24 +17,24 @@ let f request =
-<%s! Dream.form_tag ~action:"/babillard/new_thread" ~enctype:`Multipart_form_data request %> - - +<%s! Dream.form_tag ~action:"/new_thread" ~enctype:`Multipart_form_data request %> + + - - + + - - + + - - + + - - + + - - + +
diff --git a/src/permap.ml b/src/permap.ml index dfd4444..220ac3c 100644 --- a/src/permap.ml +++ b/src/permap.ml @@ -137,11 +137,11 @@ let newthread_post request = | `Ok [ ("alt", [ (_, alt) ]) ; ("file", file) - ; ("lat_input", [ (_, lat) ]) - ; ("lng_input", [ (_, lng) ]) + ; ("lat-input", [ (_, lat) ]) + ; ("lng-input", [ (_, lng) ]) ; ("subject", [ (_, subject) ]) ; ("tags", [ (_, tags) ]) - ; ("threadComment", [ (_, comment) ]) + ; ("thread-comment", [ (_, comment) ]) ] -> ( match (Float.of_string_opt lat, Float.of_string_opt lng) with | None, _ -> render_unsafe "Invalide coordinate" request @@ -192,7 +192,7 @@ let reply_post request = | `Ok [ ("alt", [ (_, alt) ]) ; ("file", file) - ; ("replyComment", [ (_, comment) ]) + ; ("reply-comment", [ (_, comment) ]) ; ("tags", [ (_, tags) ]) ] -> ( let parent_id = Dream.param "thread_id" request in @@ -216,9 +216,6 @@ let reply_post request = | `Wrong_session _ | `Wrong_content_type -> Dream.empty `Bad_Request ) -let redirect_to_babillard _request = - Dream.respond ~status:`Moved_Permanently ~headers:[ ("Location", "/") ] "" - let () = Dream.run ~secret:"yolo" ~port:3696 @@ Dream.logger @@ Dream.cookie_sessions diff --git a/src/pp_babillard.ml b/src/pp_babillard.ml index 3fdc5c2..4fb8c46 100644 --- a/src/pp_babillard.ml +++ b/src/pp_babillard.ml @@ -23,9 +23,9 @@ let view_post ?is_thread_preview id = (*TODO image info like file name and size on top of image*) Format.fprintf fmt {| -
+
- %s + %s
|} @@ -34,7 +34,7 @@ let view_post ?is_thread_preview id = in let pp_print_reply fmt reply = - Format.fprintf fmt {|>>%s|} reply + Format.fprintf fmt {|>>%s|} reply reply in let pp_print_replies fmt replies = @@ -63,7 +63,7 @@ let view_post ?is_thread_preview id = {| # - + %a |} @@ -76,7 +76,7 @@ let view_post ?is_thread_preview id = let post_info_view fmt () = Format.fprintf fmt {| -