Skip to content
Browse files

Merge branch 'master' of https://github.com/spockz/uhc-jscript

  • Loading branch information...
2 parents 632b506 + 5cdfed7 commit b47a947f7a9679589ecd902c54bc9bf023023b1f @norm2782 norm2782 committed Jan 5, 2012
View
2 uhc-jscript/src/Language/UHC/JScript/ECMA/String.hs
@@ -115,7 +115,7 @@ foreign import jscript "%1.toLocaleUpperCase()"
foreign import jscript "%1.trim()"
trim :: JSString -> JSString
-foreign import jscript "%1.lenght"
+foreign import jscript "%1.length"
length :: JSString -> Int
foreign import prim "primStringToPackedString"
View
24 uhc-jscript/src/Language/UHC/JScript/JQuery/Droppable.hs
@@ -0,0 +1,24 @@
+module Language.UHC.JScript.JQuery.Droppable where
+
+import Language.UHC.JScript.ECMA.Bool
+
+import Language.UHC.JScript.Primitives
+import Language.UHC.JScript.Types
+import Language.UHC.JScript.JQuery.JQuery
+
+data Droppable = Droppable { hoverClass :: JSString,
+ drop :: JUIEventHandler}
+
+data JSDroppablePtr
+type JSDroppable = JSPtr JSDroppablePtr
+
+droppable :: JQuery -> Droppable -> IO ()
+droppable jq drop =
+ do jsdrop <- mkJSDroppable drop
+ _droppable jq jsdrop
+
+foreign import jscript "{}"
+ mkJSDroppable :: Droppable -> IO JSDroppable
+
+foreign import jscript "%1.droppable(%2)"
+ _droppable :: JQuery -> JSDroppable -> IO ()
View
27 uhc-jscript/src/Language/UHC/JScript/JQuery/JQuery.hs
@@ -77,6 +77,10 @@ foreign import jscript "%1.find(%2)"
foreign import jscript "%1.find(%2)"
findObject :: JQuery -> JQuery -> IO JQuery
+foreign import jscript "%1.val()"
+ valString :: JQuery -> IO JSString
+
+
-------------------------------------------------------------------------------
-- Manipulation
@@ -146,16 +150,16 @@ foreign import jscript "%1.blur()"
data JUIPtr
type JUI = JSPtr JUIPtr
-type EventHandler = JQuery -> JEventResult
-type UIEventHandler = JQuery -> JUI -> JEventResult -- TODO: Split this off to JQueryUI or something :)
-
-
-type JEventResult = IO Bool
+type EventHandler = JQuery -> JEventResult
+type UIEventHandler = JQuery -> JUI -> JEventResult -- TODO: Split this off to JQueryUI or something :)
+type UIThisEventHandler = JQuery -> JQuery -> JUI -> JEventResult
-type JEventHandler = JSFunPtr EventHandler
-type JUIEventHandler = JSFunPtr UIEventHandler
+type JEventResult = IO Bool
-type JEventType = String
+type JEventHandler = JSFunPtr EventHandler
+type JUIEventHandler = JSFunPtr UIEventHandler
+type JUIThisEventHandler = JSFunPtr UIThisEventHandler
+type JEventType = String
bind :: JQuery -> JEventType -> JEventHandler -> IO ()
bind jq event eh = do _bind jq (toJS event) eh
@@ -191,6 +195,13 @@ foreign import jscript "wrapper"
foreign import jscript "wrapper"
mkJUIEventHandler :: UIEventHandler -> IO JUIEventHandler
+foreign import jscript "wrapper"
+ mkJUIThisEventHandler :: UIThisEventHandler -> IO JUIThisEventHandler
+
+
+foreign import jscript "wrappedJQueryUIEvent(%1)"
+ wrappedJQueryUIEvent :: JUIThisEventHandler -> IO JUIEventHandler
+
-------------------------------------------------------------------------------
-- DOM Manipulation

0 comments on commit b47a947

Please sign in to comment.
Something went wrong with that request. Please try again.