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
This commit is contained in:
Eli Barzilay 2009-11-24 09:11:09 +00:00
parent 6d19862ce7
commit 142d33d67f
3 changed files with 17 additions and 6 deletions

View File

@ -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"])

View File

@ -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 ? "&#9660;" : "&#9658;";
}
// `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]();
};

View File

@ -882,6 +882,6 @@ function SetHighlightColor(inp) {
}
set_highlight_color = SetHighlightColor;
window.onload = InitializeSearch;
AddOnLoad(InitializeSearch);
})();