diff src/c/urweb.c @ 695:500e93aa436f

sleep and better Scriptcheck
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Apr 2009 15:56:47 -0400
parents 7ea0df9e56b6
children 79a49c509007
line wrap: on
line diff
--- a/src/c/urweb.c	Sat Apr 04 14:55:36 2009 -0400
+++ b/src/c/urweb.c	Sat Apr 04 15:56:47 2009 -0400
@@ -693,14 +693,24 @@
   if (ctx->script_header[0] == 0)
     return "";
   else {
-    char *r = uw_malloc(ctx, strlen(ctx->script_header) + 18 + buf_used(&ctx->script));
-    sprintf(r, "%s<script>%s</script>",
+    char *r = uw_malloc(ctx, strlen(ctx->script_header) + 42 + buf_used(&ctx->script));
+    sprintf(r, "%s<script type=\"text/javascript\">%s</script>",
             ctx->script_header,
             ctx->script.start);
     return r;
   }
 }
 
+uw_Basis_string uw_Basis_maybe_onload(uw_context ctx, uw_Basis_string s) {
+  if (s[0] == 0)
+    return "";
+  else {
+    char *r = uw_malloc(ctx, 11 + strlen(s));
+    sprintf(r, " onload='%s'", s);
+    return r;
+  }
+}
+
 const char *uw_Basis_get_settings(uw_context ctx, uw_unit u) {
   if (ctx->client == NULL)
     return "";