# HG changeset patch # User Adam Chlipala # Date 1252421749 14400 # Node ID 321a2d6feb4064a82997db259d0575a9bfe5ad66 # Parent b873feb3eb5271b6b673337622449cb18c920ea3 dragList demo working, save for Gecko load delay and highlighting diff -r b873feb3eb52 -r 321a2d6feb40 demo/more/dragList.ur --- a/demo/more/dragList.ur Tue Sep 08 10:18:19 2009 -0400 +++ b/demo/more/dragList.ur Tue Sep 08 10:55:49 2009 -0400 @@ -10,11 +10,12 @@ onmouseover={di <- get draggingItem; case di of None => return () - | Some di => item1 <- get di; - item2 <- get itemSource; - set di item2; - set itemSource item1}> - {[s]}}/> + | Some di => original <- get di; + movedOver <- get itemSource; + set di movedOver; + set itemSource original; + set draggingItem (Some itemSource)}> + {[s]}) (signal itemSource)}/> ) itemSources} @@ -26,8 +27,13 @@ :: "Sus scrofa ussuricus" :: "Sus scrofa cristatus" :: "Sus scrofa taiwanus" :: []); - return - {bears} - {beers} - {boars} - + return + + + + + {bears} + {beers} + {boars} + + diff -r b873feb3eb52 -r 321a2d6feb40 demo/more/dragList.urp --- a/demo/more/dragList.urp Tue Sep 08 10:18:19 2009 -0400 +++ b/demo/more/dragList.urp Tue Sep 08 10:55:49 2009 -0400 @@ -1,4 +1,5 @@ -debug +allow url ../../dragList.css $/list +$/monad dragList diff -r b873feb3eb52 -r 321a2d6feb40 demo/more/out/dragList.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/more/out/dragList.css Tue Sep 08 10:55:49 2009 -0400 @@ -0,0 +1,18 @@ +ul { + width: 200px; + list-style-image: url(http://script.aculo.us/images/bullet.gif); +} + +li { + color: #7E9E50; + font: 20px Georgia; + background-color: #ECF3E1; + border:1px solid #C5DEA1; + cursor: move; + margin: 0px; +} + +h2 { + font: 42px/30px Georgia, serif; + color: #7E9E50; +} diff -r b873feb3eb52 -r 321a2d6feb40 demo/more/prose --- a/demo/more/prose Tue Sep 08 10:18:19 2009 -0400 +++ b/demo/more/prose Tue Sep 08 10:55:49 2009 -0400 @@ -1,3 +1,7 @@

These are some extra demo applications written in Ur/Web. See the main demo for a more tutorial-like progression through language and library features.

+dragList.urp + +This is an Ur/Web version of the "draggable lists" demo program from Links. + grid1.urp diff -r b873feb3eb52 -r 321a2d6feb40 lib/ur/monad.ur --- a/lib/ur/monad.ur Tue Sep 08 10:18:19 2009 -0400 +++ b/lib/ur/monad.ur Tue Sep 08 10:55:49 2009 -0400 @@ -8,6 +8,10 @@ fun ignore [m ::: Type -> Type] (_ : monad m) [t] (v : m t) = x <- v; return () +fun mp [m] (_ : monad m) [a] [b] f m = + v <- m; + return (f v) + fun foldR [K] [m] (_ : monad m) [tf :: K -> Type] [tr :: {K} -> Type] (f : nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] => diff -r b873feb3eb52 -r 321a2d6feb40 lib/ur/monad.urs --- a/lib/ur/monad.urs Tue Sep 08 10:18:19 2009 -0400 +++ b/lib/ur/monad.urs Tue Sep 08 10:55:49 2009 -0400 @@ -4,6 +4,9 @@ val ignore : m ::: (Type -> Type) -> monad m -> t ::: Type -> m t -> m unit +val mp : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type + -> (a -> b) -> m a -> m b + val foldR : K --> m ::: (Type -> Type) -> monad m -> tf :: (K -> Type) -> tr :: ({K} -> Type) diff -r b873feb3eb52 -r 321a2d6feb40 src/c/urweb.c --- a/src/c/urweb.c Tue Sep 08 10:18:19 2009 -0400 +++ b/src/c/urweb.c Tue Sep 08 10:55:49 2009 -0400 @@ -2556,6 +2556,7 @@ char *start = strstr(ctx->page.start, ""); if (start) { buf_check(&ctx->page, buf_used(&ctx->page) - 4 + len); + start = strstr(ctx->page.start, ""); memmove(start + len, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3); ctx->page.front += len - 4; memcpy(start, ctx->script_header, len); @@ -2566,13 +2567,13 @@ char *start = strstr(ctx->page.start, ""); if (start) { buf_check(&ctx->page, buf_used(&ctx->page) - 4 + lenP); + start = strstr(ctx->page.start, ""); memmove(start + lenP, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3); ctx->page.front += lenP - 4; memcpy(start, ctx->script_header, lenH); memcpy(start + lenH, "", 9); - printf("start=%s\n", start); } } }