aboutsummaryrefslogtreecommitdiffstats
path: root/godoc-links.user.js
diff options
context:
space:
mode:
authorTeddy Wing2020-03-22 18:11:28 +0100
committerTeddy Wing2020-03-22 18:11:28 +0100
commitf0ac4a15de3efa042bc1e105e1ba99612f4f0736 (patch)
tree8ee842f931e7b7469e58d8ea86351b5e8dcc84c6 /godoc-links.user.js
parentb287bfb4777dfb1109c7b83de29c4b8e8f2e643a (diff)
downloadgodoc-links-f0ac4a15de3efa042bc1e105e1ba99612f4f0736.tar.bz2
pkg.go.dev: Add a link to the GoDoc docs in the header
Diffstat (limited to 'godoc-links.user.js')
-rw-r--r--godoc-links.user.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/godoc-links.user.js b/godoc-links.user.js
index c1f44ba..ab5ac3d 100644
--- a/godoc-links.user.js
+++ b/godoc-links.user.js
@@ -52,6 +52,18 @@ function pkg_go_dev () {
var parent_el = import_path_el.parentNode;
parent_el.removeChild(import_path_el);
parent_el.prepend(link_el);
+
+ pkg_go_dev_add_godoc_link(parent_el, import_path_el.textContent);
+}
+
+
+// Add a link in the header to the GoDoc version of the docs.
+function pkg_go_dev_add_godoc_link (container_el, import_path) {
+ var link_el = document.createElement('a');
+ link_el.href = 'https://godoc.org/' + import_path;
+ link_el.textContent = '(GoDoc)';
+
+ container_el.appendChild(link_el);
}