diff options
| author | Teddy Wing | 2020-03-22 15:04:43 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2020-03-22 15:04:43 +0100 | 
| commit | 9451a0e91de5248b2bce1626bab8c9189a3a72d4 (patch) | |
| tree | 3b1033cc9f3ba72c515a2c402994d591d09d977b | |
| parent | 4c9c33f634077f20a38f71cddf393813ce423273 (diff) | |
| download | godoc-links-9451a0e91de5248b2bce1626bab8c9189a3a72d4.tar.bz2 | |
Add link to source code on pkg.go.dev
Link to the package's source code on pkg.go.dev's documentation page.
| -rw-r--r-- | godoc-links.user.js | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/godoc-links.user.js b/godoc-links.user.js index 3a202ee..52f2596 100644 --- a/godoc-links.user.js +++ b/godoc-links.user.js @@ -1 +1,14 @@  document.body.innerHTML = document.body.innerHTML.replace(/import "([^"]+)"/, 'import "<a href="https://$1">$1</a>"') + + +function pkg_go_dev () { +	var import_path_el = document.querySelector('.DetailsHeader-breadcrumbCurrent'); + +	var link_el = document.createElement('a'); +	link_el.textContent = import_path_el.textContent; +	link_el.href = 'https://' + import_path_el.textContent; + +	var parent_el = import_path_el.parentNode; +	parent_el.removeChild(import_path_el); +	parent_el.prepend(link_el); +} | 
