       (om/root
         app-state
         (fn [app owner]
-          (run-altmetric-embeds)
+          (js/setTimeout run-altmetric-embeds 100)
           (om/component (embed app)))
-        embed-element))))
+        embed-element)
+      (om/root
+        app-state
+        (fn [app owner]
+          (om/component (embed-code app)))
+        code-element))))
 
 (init)

    (om/update! data (fn [state]
                       (apply assoc state all-vals)))))

(defn embed [data]
  (dom/div #js {:className "altmetric-embed"
                :data-badge-popover (:popover data)
                :data-badge-details (:badge-details data)
                :data-badge-type (:badge-type data)
                :data-doi (:doi data)
                :data-hide-no-mentions (:hide-no-mentions data)}
           nil))

(defn embed-form [data owner]
  (let [change-data (partial update-app data)]
    (dom/form
      nil

(ns golden-kestrel.core
  (:require
    [clojure.string :as string]
    [clojure.set :as set]
    [om.core :as om :include-macros true]
    [om.dom :as dom :include-macros true]))

