|
|
|
@ -16,11 +16,17 @@ |
|
|
|
[$id] |
|
|
|
[$id] |
|
|
|
(anim ($ :body) {:scrollTop ((js->clj (.offset $id)) "top")} 500)) |
|
|
|
(anim ($ :body) {:scrollTop ((js->clj (.offset $id)) "top")} 500)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; try to detect iOS |
|
|
|
|
|
|
|
(def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)")) |
|
|
|
|
|
|
|
|
|
|
|
; set focus to the draft textarea (if there is one) |
|
|
|
; set focus to the draft textarea (if there is one) |
|
|
|
(when $draft |
|
|
|
(when $draft |
|
|
|
(do |
|
|
|
(do |
|
|
|
(val $draft "") |
|
|
|
(val $draft "") |
|
|
|
(.focus $draft))) |
|
|
|
; foces setting is impossible in iOS, so we border the field instead |
|
|
|
|
|
|
|
(if ios-detected |
|
|
|
|
|
|
|
(.addClass $draft "ui-border") |
|
|
|
|
|
|
|
(.focus $draft)))) |
|
|
|
|
|
|
|
|
|
|
|
; show the preview & publish buttons as soon as the user starts typing. |
|
|
|
; show the preview & publish buttons as soon as the user starts typing. |
|
|
|
(.keypress $draft |
|
|
|
(.keypress $draft |
|
|
|
@ -40,6 +46,8 @@ |
|
|
|
(show $preview-start-line) |
|
|
|
(show $preview-start-line) |
|
|
|
(scroll-to $preview-start-line))))))) |
|
|
|
(scroll-to $preview-start-line))))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; when the publish button is clicked, compute the hash of the entered text and |
|
|
|
|
|
|
|
; provided session key and assign to the field session-value |
|
|
|
(.click ($ :#publish-button) |
|
|
|
(.click ($ :#publish-button) |
|
|
|
(fn [e] |
|
|
|
(fn [e] |
|
|
|
(val ($ :#session-value) |
|
|
|
(val ($ :#session-value) |
|
|
|
|