bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5f941495b665305caea08bde945c90994864d717
parent 50ce3b1a9a864e7139781305b71a099207dff69d
Author: Eli Barzilay <eli@racket-lang.org>
Date:   Mon, 19 May 2008 13:13:21 +0000

added scribble-common.js

svn: r9885

original commit: 17b03a9adf4097281f5df70310ca4c2d6075a668

Diffstat:
Acollects/scribble/scribble-common.js | 41+++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+), 0 deletions(-)

diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js @@ -0,0 +1,41 @@ +// Common functionality for PLT documentation pages + +function GetCookie(key) { + if (document.cookie.length <= 0) return null; + var cookiestrs = document.cookie.split(/; */); + for (var i in cookiestrs) { + var cur = cookiestrs[i]; + var eql = cur.indexOf('='); + if (eql >= 0 && cur.substring(0,eql) == key) + return unescape(cur.substring(eql+1)); + } + return null; +} + +function SetCookie(key, val) { + var d = new Date(); + d.setTime(d.getTime()+(365*24*60*60*1000)); + document.cookie = + key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; +} + +function GotoPLTRoot() { + var u = GetCookie("PLT_Root"); + if (u == null) return true; // no cookie: use plain up link + location = u; + return false; +} + +function SetPLTRoot() { + SetCookie("PLT_Root", location); +} + +function DoSearchKey(event, field) { + var val = field.value; + if (event && event.keyCode == 13 && val.indexOf("...search...") < 0) { + var u = GetCookie("PLT_Root"); + if (u == null) u = "../"; // default: go up + u = u.replace(/[^\/\\]*$/, "") + "plt-search.html"; + location = u + "?q=" + escape(val); + } +}