diff --git a/contrib/httpd/default-responders.factor b/contrib/httpd/default-responders.factor
index 5767d3be23..5c9e0642ef 100644
--- a/contrib/httpd/default-responders.factor
+++ b/contrib/httpd/default-responders.factor
@@ -20,10 +20,9 @@ global [
"callback" [ callback-responder ] add-simple-responder
! Javascript source used by ajax libraries
- "javascript" [
+ "resources" [
[
- "contrib/httpd/javascript/" resource-path
- "doc-root" set
+ "" resource-path "doc-root" set
file-responder
] with-scope
] add-simple-responder
diff --git a/contrib/httpd/html.factor b/contrib/httpd/html.factor
index 44d5d8d1c1..3b81aa0656 100644
--- a/contrib/httpd/html.factor
+++ b/contrib/httpd/html.factor
@@ -18,9 +18,9 @@ IN: html
: style-css, ( flag -- )
dup
{ italic bold-italic } member?
- "font-style: " % "italic" "normal" ? % ";" %
+ "font-style: " % "italic" "normal" ? % "; " %
{ bold bold-italic } member?
- "font-weight: " % "bold" "normal" ? % ";" % ;
+ "font-weight: " % "bold" "normal" ? % "; " % ;
: size-css, ( size -- )
"font-size: " % # "pt; " % ;
@@ -148,7 +148,7 @@ M: html-stream stream-format ( str style stream -- )
: make-outliner-quot
[
-
+
with-html-stream
] curry ;
@@ -156,7 +156,7 @@ M: html-stream stream-format ( str style stream -- )
: html-outliner ( caption contents -- )
"+ " get-random-id dup >r
rot make-outliner-quot updating-anchor call
-
=id span> ;
+
=id "display: none; " =style span> ;
: outliner-tag ( style quot -- )
outline pick hash [ html-outliner ] [ call ] if* ;
@@ -172,12 +172,27 @@ M: html-stream with-nested-stream ( quot style stream -- )
] outliner-tag
] with-stream* ;
+: border-spacing-css,
+ "padding: " % first2 max 2 /i # "px; " % ;
+
+: table-style ( style -- str )
+ [
+ H{
+ { table-border [ border-css, ] }
+ { table-gap [ border-spacing-css, ] }
+ } hash-apply
+ ] "" make ;
+
+: table-attrs ( style -- )
+ table-style " border-collapse: collapse;" append =style ;
+
M: html-stream with-stream-table ( grid quot style stream -- )
[
-
rot [
+ rot [
[
-
- pick pick stdio get with-nested-stream |
+
+ pick H{ } swap with-nesting
+ |
] each
] each 2drop
] with-stream* ;
diff --git a/contrib/httpd/prototype-js.factor b/contrib/httpd/prototype-js.factor
index 968f04afd4..77185973e5 100644
--- a/contrib/httpd/prototype-js.factor
+++ b/contrib/httpd/prototype-js.factor
@@ -11,7 +11,8 @@ strings ;
: include-prototype-js ( -- )
#! Write out the HTML script tag to include the prototype
#! javascript library.
- ;
: updating-javascript ( id quot -- string )
@@ -20,9 +21,19 @@ strings ;
t register-html-callback swap
[ "new Ajax.Updater(\"" % % "\",\"" % % "\", { method: \"get\" });" % ] "" make ;
+: toggle-javascript ( string id -- string )
+ [
+ "if(Element.visible(\"" % dup % "\"))" %
+ "Element.hide(\"" % dup % "\");" %
+ "else {" %
+ swap %
+ " Element.show(\"" % % "\"); }" %
+ ] "" make ;
+
: updating-anchor ( text id quot -- )
#! Write the HTML for an anchor that when clicked will
#! call the given quotation on the server. The output generated
#! from that quotation will replace the DOM element on the page with
#! the given id. The 'text' is the anchor text.
- write ;
+ over >r updating-javascript r> toggle-javascript
+ write ;