diff --git a/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.css b/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.css new file mode 100644 index 0000000000..335a26efe9 --- /dev/null +++ b/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.css @@ -0,0 +1,11 @@ + +.RootPathInfo { + margin-top: 1em; + display: none; +} + +.RootPathAction { + display: block; + font-size: 80%; + white-space: nowrap; +} diff --git a/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.js b/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.js new file mode 100644 index 0000000000..3188816b54 --- /dev/null +++ b/pkgs/racket-pkgs/racket-index/scribblings/main/private/root-info.js @@ -0,0 +1,21 @@ + +AddOnLoad(function(){ + var u = GetCookie("PLT_Root."+racket_root_version, null); + if (u) { + var info = document.getElementById("rootPathInfo"); + info.style.display = "block"; + } +}) + +function GoToRootPath() { + return GotoPLTRoot(racket_root_version, "index.html"); +} + +function DisableRootPath() { + SetCookie("PLT_Root."+racket_root_version, ""); + + var info = document.getElementById("rootPathInfo"); + info.style.display = "none"; + + return false; +} diff --git a/pkgs/racket-pkgs/racket-index/scribblings/main/private/utils.rkt b/pkgs/racket-pkgs/racket-index/scribblings/main/private/utils.rkt index 0ff4b4f475..dda8bbf597 100644 --- a/pkgs/racket-pkgs/racket-index/scribblings/main/private/utils.rkt +++ b/pkgs/racket-pkgs/racket-index/scribblings/main/private/utils.rkt @@ -40,7 +40,9 @@ ;; the second argument specifies installation/user specific, and if ;; it's missing, then it's a page with a single version -(define (main-page id [installation-specific? '?] #:force-racket-css? [force-racket-css? #f]) +(define (main-page id [installation-specific? '?] + #:force-racket-css? [force-racket-css? #f] + #:show-root-info? [show-root-info? #f]) (define info (page-info id)) (define title-string (car info)) (define root (cadr info)) @@ -54,10 +56,15 @@ (title #:style (make-style #f (list* 'no-toc 'toc-hidden - (if (not force-racket-css?) - null - (list - (make-css-addition (collection-file-path "racket.css" "scribble")))))) + (append + (if force-racket-css? + (list (make-css-addition (collection-file-path "racket.css" "scribble"))) + null) + (if (not show-root-info?) + null + (list + (make-css-addition (collection-file-path "root-info.css" "scribblings/main/private")) + (make-js-addition (collection-file-path "root-info.js" "scribblings/main/private"))))))) title-string #; ;; the "(installation)" part shouldn't be visible on the web, but @@ -74,6 +81,9 @@ (front-toc-items up-path))) (make-splice `(,page-title ,@toc + ,@(if show-root-info? + (list @script{var racket_root_version = "@(version)"@";"}) + '()) ,@(if user-doc? (list @script{SetPLTRoot("@(version)", "@up-path")@";"}) '())))) diff --git a/pkgs/racket-pkgs/racket-index/scribblings/main/search.scrbl b/pkgs/racket-pkgs/racket-index/scribblings/main/search.scrbl index 43ee0aee26..6492018cd2 100644 --- a/pkgs/racket-pkgs/racket-index/scribblings/main/search.scrbl +++ b/pkgs/racket-pkgs/racket-index/scribblings/main/search.scrbl @@ -1,8 +1,6 @@ #lang scribble/doc @(require "private/utils.rkt" "private/make-search.rkt") -@main-page['search #t - ;; "racket.css" needs to be installed for search results: - #:force-racket-css? #t] +@main-page['search #t] @make-search[#f] diff --git a/pkgs/racket-pkgs/racket-index/scribblings/main/start.scrbl b/pkgs/racket-pkgs/racket-index/scribblings/main/start.scrbl index 0bebb924dc..fb8e3e01ae 100644 --- a/pkgs/racket-pkgs/racket-index/scribblings/main/start.scrbl +++ b/pkgs/racket-pkgs/racket-index/scribblings/main/start.scrbl @@ -1,16 +1,28 @@ #lang scribble/doc -@(require scribble/manual "private/utils.rkt" "private/manuals.rkt") +@(require scribble/manual + scribble/core + scribble/html-properties + "private/utils.rkt" + "private/manuals.rkt") -@main-page['start #t - ;; "racket.css" needs to be installed so it can be shared: - #:force-racket-css? #t] +@main-page['start #t #:show-root-info? #t] + +@(define path-info-style (style "RootPathInfo" (list (attributes '((id . "rootPathInfo")))))) +@(define go-style (style "RootPathAction" (list (attributes '((onclick . "return GoToRootPath();")))))) +@(define disable-style (style "RootPathAction" (list (attributes '((onclick . "return DisableRootPath();")))))) @not-on-the-web{ @margin-note*{ This is an installation-specific listing. Running @exec{raco docs} (or @exec{Racket Documentation} on Windows or Mac OS X) may open a different page with local and user-specific - documentation, including documentation for installed packages.}} + documentation, including documentation for installed packages. + + @elem[#:style path-info-style]{Searching or following a + ``top'' link will use go to a different starting point that + includes user-specific information. + @hyperlink["#"]{@elem[#:style go-style]{[Go to user-specific start]}} + @hyperlink["#"]{@elem[#:style disable-style]{[Forget user-specific start]}}}}} @(make-start-page #f)