module Graphics.UI.Threepenny.JQuery where
import Control.Arrow
import Data.String
import Data.Char
import Data.Default
import Data.Maybe
import Graphics.UI.Threepenny.Core
data Easing = Swing | Linear
deriving (Easing -> Easing -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Easing -> Easing -> Bool
$c/= :: Easing -> Easing -> Bool
== :: Easing -> Easing -> Bool
$c== :: Easing -> Easing -> Bool
Eq,Int -> Easing
Easing -> Int
Easing -> [Easing]
Easing -> Easing
Easing -> Easing -> [Easing]
Easing -> Easing -> Easing -> [Easing]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Easing -> Easing -> Easing -> [Easing]
$cenumFromThenTo :: Easing -> Easing -> Easing -> [Easing]
enumFromTo :: Easing -> Easing -> [Easing]
$cenumFromTo :: Easing -> Easing -> [Easing]
enumFromThen :: Easing -> Easing -> [Easing]
$cenumFromThen :: Easing -> Easing -> [Easing]
enumFrom :: Easing -> [Easing]
$cenumFrom :: Easing -> [Easing]
fromEnum :: Easing -> Int
$cfromEnum :: Easing -> Int
toEnum :: Int -> Easing
$ctoEnum :: Int -> Easing
pred :: Easing -> Easing
$cpred :: Easing -> Easing
succ :: Easing -> Easing
$csucc :: Easing -> Easing
Enum,Int -> Easing -> ShowS
[Easing] -> ShowS
Easing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Easing] -> ShowS
$cshowList :: [Easing] -> ShowS
show :: Easing -> String
$cshow :: Easing -> String
showsPrec :: Int -> Easing -> ShowS
$cshowsPrec :: Int -> Easing -> ShowS
Show)
instance Default Easing where def :: Easing
def = Easing
Linear
fadeIn :: Element -> Int -> Easing -> IO () -> UI ()
fadeIn :: Element -> Int -> Easing -> IO () -> UI ()
fadeIn Element
el Int
duration Easing
easing IO ()
complete = do
JSObject
callback <- forall a. IsHandler a => a -> UI JSObject
ffiExport IO ()
complete
JSFunction () -> UI ()
runFunction forall a b. (a -> b) -> a -> b
$ forall a. FFI a => String -> a
ffi String
"$(%1).animate({opacity: 1}, %2 * 1, %3, %4)"
Element
el Int
duration (forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower (forall a. Show a => a -> String
show Easing
easing)) JSObject
callback
fadeOut :: Element -> Int -> Easing -> IO () -> UI ()
fadeOut :: Element -> Int -> Easing -> IO () -> UI ()
fadeOut Element
el Int
duration Easing
easing IO ()
complete = do
JSObject
callback <- forall a. IsHandler a => a -> UI JSObject
ffiExport IO ()
complete
JSFunction () -> UI ()
runFunction forall a b. (a -> b) -> a -> b
$ forall a. FFI a => String -> a
ffi String
"$(%1).animate({opacity: 0}, %2 * 1, %3, %4)"
Element
el Int
duration (forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower (forall a. Show a => a -> String
show Easing
easing)) JSObject
callback
sendValue :: Element -> Event String
sendValue :: Element -> Event String
sendValue = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. FromJSON a => EventData -> a
unsafeFromJSON forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Element -> Event EventData
domEvent String
"sendvalue"
setFocus :: Element -> UI ()
setFocus :: Element -> UI ()
setFocus = JSFunction () -> UI ()
runFunction forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. FFI a => String -> a
ffi String
"$(%1).focus()"
scrollToBottom :: Element -> UI ()
scrollToBottom :: Element -> UI ()
scrollToBottom = JSFunction () -> UI ()
runFunction forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. FFI a => String -> a
ffi String
"jquery_scrollToBottom(%1)"