commit a45e38adfcdbf44adca30b25372d89d729ba8464
parent 290490a455f3404aa6c5e26dd878c972b68201ec
Author: Eli Barzilay <eli@racket-lang.org>
Date: Tue, 27 May 2008 15:12:31 +0000
user documentation root is now stored in a cookie
svn: r9978
original commit: 1e9e508ec02be10f9a45450bdd6cf8292bb43682
Diffstat:
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js
@@ -19,15 +19,25 @@ function SetCookie(key, val) {
key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/";
}
-function GotoPLTRoot() {
- var u = GetCookie("PLT_Root");
+function GotoPLTRoot(ver) {
+ var u = GetCookie("PLT_Root."+ver);
if (u == null) return true; // no cookie: use plain up link
location = u;
return false;
}
-function SetPLTRoot() {
- SetCookie("PLT_Root", location);
+function SetPLTRoot(ver, relative) {
+ var root = location.protocol + "//" + location.host
+ + NormalizePath(location.pathname.replace(/[^\/]*$/, relative));
+ SetCookie("PLT_Root."+ver, root);
+}
+
+normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/];
+function NormalizePath(path) {
+ var tmp, i;
+ for (i = 0; i < normalize_rxs.length; i++)
+ while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp;
+ return path;
}
function DoSearchKey(event, field) {