Browse Source

minor improvements

master
Christian Mueller 12 years ago
parent
commit
2624222611
  1. 12
      src-cljs/main.cljs
  2. 2
      src/NoteHub/views/common.clj
  3. 11
      src/NoteHub/views/css.clj

12
src-cljs/main.cljs

@ -41,13 +41,13 @@ @@ -41,13 +41,13 @@
(.reset md5)
; try to detect iOS
(def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))
(def ios-detected? (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))
(def timer nil)
(def timerDelay
; TODO: also test for Android
(if ios-detected 800 400))
(if ios-detected? 800 400))
(defn update-preview
"Updates the preview"
@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
(do
(js/clearTimeout timer)
(let [content (val $draft)
; the delay between the last typing and preview update is dynamic
; and increases with the length of the text
delay (Math/min timerDelay (* timerDelay (/ (count content) 400)))]
(def timer
(js/setTimeout
@ -70,9 +72,9 @@ @@ -70,9 +72,9 @@
(if (= "update" (val $action))
(update-preview)
(val $draft ""))
; foces setting is impossible in iOS, so we border the field instead
(if ios-detected
(set! (.-className $draft) (str (.-className $draft) "ui-border"))
; focus setting is impossible in iOS, so we border the field instead
(if ios-detected?
(set! (.-className $draft) (str (.-className $draft) " ui-border"))
(.focus $draft))))
; show the preview & publish buttons as soon as the user starts typing.

2
src/NoteHub/views/common.clj

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
(ns NoteHub.views.common
(:use
[NoteHub.settings :only [get-message]]
[NoteHub.views.css-generator]
[NoteHub.views.css]
[noir.core :only [defpartial]]
[noir.options :only [dev-mode?]]
[hiccup.util :only [escape-html]]

11
src/NoteHub/views/css_generator.clj → src/NoteHub/views/css.clj

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
(ns NoteHub.views.css-generator
(ns NoteHub.views.css
(:use
[cssgen]
[cssgen.types :only [px %]]
@ -93,12 +93,13 @@ @@ -93,12 +93,13 @@
:opacity 0.8
:font-size :1em
:background background)
(rule ".landing-button, table, tr, td, textarea, fieldset"
:border :none)
(rule ".landing-button"
:box-shadow [0 :2px :5px :#aaa]
:text-decoration :none
:font-size :1.5em
:background :#0a2
:border :none
:border-radius :10px
:padding :10px
helvetica-neue
@ -126,8 +127,7 @@ @@ -126,8 +127,7 @@
(rule "& > td:first-child"
:text-align :right)))
(rule "table,tr,td"
:margin 0
:border :none)
:margin 0)
(rule "td"
:padding :0.5em)
(rule ".one-third-column"
@ -174,14 +174,11 @@ @@ -174,14 +174,11 @@
:border-radius :5px
:font-family :Courier
:font-size :1em
:border :none
:height :500px)
(rule ".hidden"
:display :none)
(rule ".central-element"
central-element)
(rule "fieldset"
:border :none)
(rule "h1"
:font-size :2em)
(rule "#dashed-line"
Loading…
Cancel
Save