get input from html
This commit is contained in:
parent
61746c417f
commit
41a1387bdb
2 changed files with 13 additions and 5 deletions
|
@ -5,7 +5,8 @@
|
||||||
<title>masto-embed</title>
|
<title>masto-embed</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mastodon-timeline">
|
<div id="masto-embed" account_id="2"
|
||||||
|
host_url="https://social.meissa-gmbh.de">
|
||||||
Here the timeline will appear.
|
Here the timeline will appear.
|
||||||
</div>
|
</div>
|
||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
|
|
|
@ -18,15 +18,22 @@
|
||||||
[dda.masto-embed.api :as api]
|
[dda.masto-embed.api :as api]
|
||||||
[clojure.pprint :as pprint :refer [pprint]]))
|
[clojure.pprint :as pprint :refer [pprint]]))
|
||||||
|
|
||||||
(def mastodon-config
|
(def masto-embed "masto-embed")
|
||||||
(api/create-config "2" "https://social.meissa-gmbh.de"))
|
|
||||||
|
(defn mastodon-config-from-document []
|
||||||
|
(let [masto-embed (.getElementById js/document masto-embed)
|
||||||
|
host-url (.getAttribute masto-embed "host_url")
|
||||||
|
account-id (.getAttribute masto-embed "account_id")]
|
||||||
|
(api/create-config account-id host-url)))
|
||||||
|
|
||||||
(defn render-to-document
|
(defn render-to-document
|
||||||
[input]
|
[input]
|
||||||
(-> js/document
|
(-> js/document
|
||||||
(.getElementById "mastodon-timeline")
|
(.getElementById masto-embed)
|
||||||
(.-innerHTML)
|
(.-innerHTML)
|
||||||
(set! input)))
|
(set! input)))
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
(api/get-mastodon-timeline mastodon-config render-to-document))
|
(api/get-mastodon-timeline
|
||||||
|
(mastodon-config-from-document)
|
||||||
|
render-to-document))
|
Loading…
Reference in a new issue