1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:38:33 -06:00
go/cmd/present/static/dir.js
Agniva De Sarker 693125cf94 all: run prettier on js and css
Command used: docker run --rm -it --volume "$PWD":/wd agniva/prettier "**/*.{js,css}"

Updates golang/go#21719

Change-Id: I892718781206430a8f85da38a762b54191ce023a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183878
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-05-28 15:31:44 +00:00

42 lines
1.0 KiB
JavaScript

// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// copied from $GOROOT/doc/godocs.js
function bindEvent(el, e, fn) {
if (el.addEventListener) {
el.addEventListener(e, fn, false);
} else if (el.attachEvent) {
el.attachEvent('on' + e, fn);
}
}
function godocs_bindSearchEvents() {
var search = document.getElementById('search');
if (!search) {
// no search box (index disabled)
return;
}
function clearInactive() {
if (search.className == 'inactive') {
search.value = '';
search.className = '';
}
}
function restoreInactive() {
if (search.value !== '') {
return;
}
if (search.type != 'search') {
search.value = search.getAttribute('placeholder');
}
search.className = 'inactive';
}
restoreInactive();
bindEvent(search, 'focus', clearInactive);
bindEvent(search, 'blur', restoreInactive);
}
bindEvent(window, 'load', godocs_bindSearchEvents);