user documentation root is now stored in a cookie

svn: r9978

original commit: 1e9e508ec02be10f9a45450bdd6cf8292bb43682
This commit is contained in:
Eli Barzilay 2008-05-27 15:12:31 +00:00
parent 290490a455
commit a45e38adfc

View File

@ -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) {