From c656e209102e6fd427e0f4dedf8905d7325beb7d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 27 May 2021 22:38:39 +0200 Subject: [PATCH] update build --- bookmarklet.html | 5 +++-- cljs/bookmarklet.cljs | 17 +++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bookmarklet.html b/bookmarklet.html index b637cc1..7dddbe0 100644 --- a/bookmarklet.html +++ b/bookmarklet.html @@ -1,6 +1,7 @@ + @@ -38,8 +39,8 @@ (.open oreq "GET" "cljs/bookmarklet.cljs") (.send oreq) - + - + diff --git a/cljs/bookmarklet.cljs b/cljs/bookmarklet.cljs index 8d04191..79b0585 100644 --- a/cljs/bookmarklet.cljs +++ b/cljs/bookmarklet.cljs @@ -62,7 +62,7 @@ (def *initial-code (r/atom nil)) ;; Initialize code -(let [{:keys [gist]} (query-params)] +(let [{:keys [gist code name]} (query-params)] (cond gist (do (reset! *initial-name "---") @@ -74,7 +74,10 @@ (when bookmark-name (reset! *initial-name bookmark-name)) (reset! *initial-code code))))) - + code + (do + (reset! *initial-name (or name "My first bookmarklet")) + (reset! *initial-code code)) :else (do (reset! *initial-name "My first bookmarklet") @@ -124,11 +127,13 @@ [editor *code] [:br] [:br] - "Click the link below"[:br] - "or"[:br] - "Drag the link to the bookmarks bar" [:br] + "Click the following link or drag it to the bookmarks bar: " [(fn [] [(fn [] [:a {:href (bookmarklet-href @*code)} @*bookmark-name])]) - *code]])) + *code] + [:br] + [(fn [] + [:a {:href (str "?name=" (js/encodeURIComponent @*bookmark-name) + "&code=" (js/encodeURIComponent @*code))} "Copy this link to share ⤴️"])]])) (rdom/render [workspace] (.getElementById js/document "app"))