Skip to content

Commit

Permalink
Permit arbitrary JS script snippets; fall back to local jQuery if CDN…
Browse files Browse the repository at this point in the history
… version fails
  • Loading branch information
ursetto committed Jul 5, 2013
1 parent 1b41f9f commit 745d046
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions chickadee-config-nginx.scm
Expand Up @@ -30,6 +30,8 @@
(chickadee-css-files (list (cache-bust "chickadee.css")))
(chickadee-early-js-files (list (uri "/cdoc/modernizr.respond.93248.js")))
(chickadee-js-files (list (uri "http://code.jquery.com/jquery-1.9.0.min.js")
;; Local jQuery fallback from HTML5 Boilerplate
"window.jQuery || document.write('<script src=\"/cdoc/jquery-1.9.0.min.js\"><\\/script>')"
(cache-bust "chickadee-jquery.js")
(cache-bust "prettify-bundle.js")))

Expand Down
2 changes: 1 addition & 1 deletion chickadee-config.scm
Expand Up @@ -28,7 +28,7 @@
(incremental-search-uri (uri "/cdoc/ajax/prefix"))
(chickadee-css-files (list (uri "/cdoc/chickadee.css")))
(chickadee-early-js-files (list (uri "/cdoc/modernizr.respond.93248.js")))
(chickadee-js-files (list (uri "/cdoc/jquery-1.9.0.min.js") ;; Use local jquery, or we have no offline fallback.
(chickadee-js-files (list (uri "/cdoc/jquery-1.9.0.min.js") ;; Use local jquery only.
(uri "/cdoc/chickadee-jquery.js")
;(uri "/cdoc/prettify-bundle.js") ;; Uncomment if using prettify-js highlighter.
))
Expand Down
7 changes: 5 additions & 2 deletions chickadee.scm
Expand Up @@ -59,8 +59,11 @@
`(meta (@ (http-equiv "content-type")
(content "text/html; charset=" ,c)))))
(define (javascript u)
`(script (@ (type "text/javascript")
(src ,(uri->string u)))))
(if (uri-reference? u)
`(script (@ (type "text/javascript")
(src ,(uri->string u))))
`(script (@ (type "text/javascript"))
(lit ,u))))
(define (css-link u)
`(link (@ (rel stylesheet)
(href ,(uri->string u))
Expand Down

0 comments on commit 745d046

Please sign in to comment.