From 142d33d67f3e7e67e5c613fbbb81beb842b299ba Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 24 Nov 2009 09:11:09 +0000 Subject: [PATCH] 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 --- collects/scribble/html-render.ss | 4 ++-- collects/scribble/scribble-common.js | 17 ++++++++++++++--- collects/scribblings/main/private/search.js | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index fcbe10093b..1e36b257e7 100644 --- 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 index e530417211..4ff914dc00 100644 --- 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(""); + // 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(""); +// 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