diff options
Diffstat (limited to 'src/genpass/core.cljs')
-rw-r--r-- | src/genpass/core.cljs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/genpass/core.cljs b/src/genpass/core.cljs deleted file mode 100644 index f0ca298..0000000 --- a/src/genpass/core.cljs +++ /dev/null @@ -1,43 +0,0 @@ -(ns genpass.core - (:require - [reagent.core :as r] - [genpass.gen :refer [genpwd]])) - -(def password (r/atom (genpwd))) - -(defn magic-selection-trick-took-from-so [e] - (let [this (.-target e)] - (if (and (.getSelection js/window) (.createRange js/document)) - (let [selection (.getSelection js/window) - range (.createRange js/document)] - (.selectNodeContents range this) - (.removeAllRanges selection) - (.addRange selection range)) - (if (and (.-selection js/document) (-> js/document .-body .createTextRange)) - (let [range (-> js/document .-body .createTextRange)] - (.moveToElementText range this) - (.select range)))))) - - -(defn home-page [] - [:div - [:nav.navbar - {:role "navigation" - :aria-label "main navigation"} - [:div.navbar-brand>a.navbar-item>h1 - [:a {:href "https://gitlab.com/gabrielgio/genpass"} "Genpass source code"]]] - [:div.section.container - [:div.field.has-text-centered - [:span.title.is-3 {:on-click magic-selection-trick-took-from-so} @password]] - [:div.field.is-grouped.is-grouped-centered - [:div.control - [:input.button.is-primary - {:value "Generate" - :type "button" - :on-click #(reset! password (genpwd))}]]]]]) - -(defn mount-root [] - (r/render [home-page] (.getElementById js/document "app"))) - -(defn init! [] - (mount-root)) |