golang.org redesign

R=r, rsc, gri
CC=golang-dev, iant, ken2, lvd, nigeltao_golang, stephenm
https://golang.org/cl/2182042
This commit is contained in:
Andrew Gerrand 2010-09-16 14:01:02 +10:00
parent 381ab58e2c
commit 6ab8d24d72
26 changed files with 669 additions and 658 deletions

View file

@ -11,17 +11,32 @@
/* We want to do some stuff on page load (after the HTML is rendered).
So listen for that:
*/
if (window.addEventListener){
window.addEventListener('load', godocs_onload, false);
} else if (window.attachEvent){
window.attachEvent('onload', godocs_onload);
function bindEvent(el, e, fn) {
if (el.addEventListener){
el.addEventListener(e, fn, false);
} else if (el.attachEvent){
el.attachEvent('on'+e, fn);
}
}
bindEvent(window, 'load', godocs_onload);
function godocs_onload() {
godocs_bindSearchEvents();
godocs_generateTOC();
godocs_addTopLinks();
}
function godocs_bindSearchEvents() {
var search = document.getElementById('search');
function clearInactive() {
if (search.className == "inactive") {
search.value = "";
search.className = "";
}
}
bindEvent(search, 'focus', clearInactive);
}
/* Generates a table of contents: looks for h2 and h3 elements and generates
* links. "Decorates" the element with id=="nav" with this table of contents.
*/