Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / cmd / present / static / dir.js
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/cmd/present/static/dir.js b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/cmd/present/static/dir.js
new file mode 100644 (file)
index 0000000..00ad22c
--- /dev/null
@@ -0,0 +1,41 @@
+// 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);