mirror of
https://github.com/golang/go.git
synced 2025-11-01 01:00:56 +00:00
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:
parent
381ab58e2c
commit
6ab8d24d72
26 changed files with 669 additions and 658 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue