fix search box path when there is no PLT_Root cookie
svn: r10720 original commit: 5726d77d87a698407942222214d9056443281b1d
This commit is contained in:
parent
3d4b9088cd
commit
eaedcae9f0
|
@ -189,7 +189,7 @@
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(define search-box ; appears on every page
|
(define (make-search-box top-path) ; appears on every page
|
||||||
(let ([sa string-append]
|
(let ([sa string-append]
|
||||||
[emptylabel "...search manuals..."]
|
[emptylabel "...search manuals..."]
|
||||||
[dimcolor "#888"])
|
[dimcolor "#888"])
|
||||||
|
@ -201,7 +201,8 @@
|
||||||
[type "text"]
|
[type "text"]
|
||||||
[value ,emptylabel]
|
[value ,emptylabel]
|
||||||
[title "Enter a search string to search the manuals"]
|
[title "Enter a search string to search the manuals"]
|
||||||
[onkeypress ,(format "return DoSearchKey(event, this, ~s);" (version))]
|
[onkeypress ,(format "return DoSearchKey(event, this, ~s, ~s);"
|
||||||
|
(version) top-path)]
|
||||||
[onfocus ,(sa "this.style.color=\"black\"; "
|
[onfocus ,(sa "this.style.color=\"black\"; "
|
||||||
"this.style.textAlign=\"left\"; "
|
"this.style.textAlign=\"left\"; "
|
||||||
"if (this.value == \""emptylabel"\") this.value=\"\";")]
|
"if (this.value == \""emptylabel"\") this.value=\"\";")]
|
||||||
|
@ -209,6 +210,8 @@
|
||||||
" this.style.color=\""dimcolor"\";"
|
" this.style.color=\""dimcolor"\";"
|
||||||
" this.style.textAlign=\"center\";"
|
" this.style.textAlign=\"center\";"
|
||||||
" this.value=\""emptylabel"\"; }")]))))
|
" this.value=\""emptylabel"\"; }")]))))
|
||||||
|
(define search-box (make-search-box "../"))
|
||||||
|
(define top-search-box (make-search-box ""))
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; main mixin
|
;; main mixin
|
||||||
|
@ -643,7 +646,7 @@
|
||||||
`[onclick . ,(format "return GotoPLTRoot(\"~a\");" (version))]))
|
`[onclick . ,(format "return GotoPLTRoot(\"~a\");" (version))]))
|
||||||
(define navleft
|
(define navleft
|
||||||
`(span ([class "navleft"])
|
`(span ([class "navleft"])
|
||||||
,search-box
|
,(if up-path search-box top-search-box)
|
||||||
,@(render
|
,@(render
|
||||||
sep-element
|
sep-element
|
||||||
(and up-path (make-element top-link top-content))
|
(and up-path (make-element top-link top-content))
|
||||||
|
|
|
@ -44,11 +44,11 @@ function NormalizePath(path) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoSearchKey(event, field, ver) {
|
function DoSearchKey(event, field, ver, top_path) {
|
||||||
var val = field.value;
|
var val = field.value;
|
||||||
if (event && event.keyCode == 13) {
|
if (event && event.keyCode == 13) {
|
||||||
var u = GetCookie("PLT_Root."+ver, null);
|
var u = GetCookie("PLT_Root."+ver, null);
|
||||||
if (u == null) u = "../"; // default: go up
|
if (u == null) u = top_path; // default: go to the top path
|
||||||
location = u + "search/index.html" + "?q=" + escape(val);
|
location = u + "search/index.html" + "?q=" + escape(val);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user