fay-jquery 0.4.0.1 → 0.5
raw patch · 2 files changed
+16/−18 lines, 2 files
Files
- fay-jquery.cabal +2/−1
- src/JQuery.hs +14/−17
fay-jquery.cabal view
@@ -1,5 +1,5 @@ name: fay-jquery-version: 0.4.0.1+version: 0.5 synopsis: jQuery bindings for Fay. description: jQuery bindings for Fay. homepage: https://github.com/faylang/fay-jquery@@ -21,6 +21,7 @@ library hs-source-dirs: src+ ghc-options: -Wall exposed-modules: JQuery build-depends: fay-base >= 0.18 , fay-text >= 0.2
src/JQuery.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE TypeSynonymInstances #-} module JQuery where @@ -12,7 +13,7 @@ import Fay.Text import FFI-import Prelude+import Prelude hiding (succ) data JQuery @@ -261,20 +262,21 @@ holdReady = ffi "jQuery['holdReady'](%1)" -- jQuery()-selectElement :: Element -> Fay JQuery-selectElement = ffi "jQuery(%1)"+-- http://api.jquery.com/jQuery/+class Selectable a -selectObject :: a -> Fay JQuery-selectObject = ffi "jQuery(%1)"+instance Selectable Text+instance Selectable Element+instance Selectable JQuery -select :: Text -> Fay JQuery+select :: Selectable a => a -> Fay JQuery select = ffi "jQuery(%1)" selectEmpty :: Fay JQuery selectEmpty = ffi "jQuery()" -createJQuery :: Text -> a -> Fay JQuery-createJQuery = ffi "jQuery(%1, %2)"+selectInContext :: (Selectable a, Selectable b) => a -> b -> Fay JQuery+selectInContext = ffi "jQuery(%1, %2)" ready :: Fay () -> Fay () ready = ffi "jQuery(%1)"@@ -399,7 +401,7 @@ anim ty el = Animation ty Fast Nothing el speed :: Speed -> Animation -> Animation-speed spd anim = anim { _speed = spd }+speed spd ani = ani { _speed = spd } chainAnim :: Animation -> Animation -> Animation chainAnim a1 a2 = a1 { _nextAnimation = Just a2 }@@ -407,6 +409,7 @@ chainAnims :: [Animation] -> Animation chainAnims [a] = a chainAnims (a:as) = a `chainAnim` chainAnims as+chainAnims [] = error (unpack "chainAnims: empty list") runAnimation :: Animation -> Fay () runAnimation a = do@@ -886,17 +889,11 @@ hasElement :: Element -> JQuery -> Fay JQuery hasElement = ffi "%2['has'](%1)" -is :: Text -> JQuery -> Fay JQuery+is :: Selectable a => a -> JQuery -> Fay Bool is = ffi "%2['is'](%1)" -isWith :: (Double -> Bool) -> JQuery -> Fay JQuery+isWith :: (Int -> Bool) -> JQuery -> Fay JQuery isWith = ffi "%2['is'](%1)"--isJQuery :: JQuery -> JQuery -> Fay JQuery-isJQuery = ffi "%2['is'](%1)"--isElement :: Element -> JQuery -> Fay JQuery-isElement = ffi "%2['is'](%1)" last :: JQuery -> Fay JQuery last = ffi "%1['last']()"