commit 6ca3facd598f9e0e973f99735476acfc9d7b25d4
parent dc3ada6fdc80944ba30d4d09545c5a72ce3ec587
Author: Eli Barzilay <eli@racket-lang.org>
Date: Tue, 24 Nov 2009 09:11:09 +0000
Make it possible to register multiple onload handlers.
(Needed because all pages must have an onload, and the search page needs an
additional initialization function.)
svn: r17032
original commit: 142d33d67f3e7e67e5c613fbbb81beb842b299ba
Diffstat:
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss
@@ -611,8 +611,8 @@
(list style-file)
style-extra-files))
,(scribble-js-contents script-file (lookup-path script-file alt-paths)))
- (body ((id ,(or (extract-part-body-id d ri)
- "scribble-plt-scheme-org")))
+ (body ([id ,(or (extract-part-body-id d ri)
+ "scribble-plt-scheme-org")])
,@(render-toc-view d ri)
(div ([class "maincolumn"])
(div ([class "main"])
diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js
@@ -80,6 +80,10 @@ function NormalizePath(path) {
return path;
}
+// `noscript' is problematic in some browsers (always renders as a
+// block), use this hack instead (does not always work!)
+// document.write("<style>mynoscript { display:none; }</style>");
+
// Interactions ---------------------------------------------------------------
function DoSearchKey(event, field, ver, top_path) {
@@ -100,6 +104,13 @@ function TocviewToggle(glyph,id) {
glyph.innerHTML = expand ? "▼" : "►";
}
-// `noscript' is problematic in some browsers (always renders as a
-// block), use this hack instead (does not always work!)
-// document.write("<style>mynoscript { display:none; }</style>");
+// Page Init ------------------------------------------------------------------
+
+// Note: could make a function that inspects and uses window.onload to chain to
+// a previous one, but this file needs to be required first anyway, since it
+// contains utilities for all other files.
+var on_load_funcs = [];
+function AddOnLoad(fun) { on_load_funcs.push(fun); }
+window.onload = function() {
+ for (var i=0; i<on_load_funcs.length; i++) on_load_funcs[i]();
+};