diff options
author | Teddy Wing | 2020-03-22 16:28:11 +0100 |
---|---|---|
committer | Teddy Wing | 2020-03-22 16:28:11 +0100 |
commit | b4ce866006e835e55f91426e2957d1ec24b72e91 (patch) | |
tree | d941718ac38d0e6da59e05d2769e23c08ed1d142 /godoc-links.user.js | |
parent | 5af1c2d08ae9923c6899eb435edba2853b285916 (diff) | |
download | godoc-links-b4ce866006e835e55f91426e2957d1ec24b72e91.tar.bz2 |
Add an init function
Delegate to the appropriate function based on the current site.
Diffstat (limited to 'godoc-links.user.js')
-rw-r--r-- | godoc-links.user.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/godoc-links.user.js b/godoc-links.user.js index 6222cdb..0543fc4 100644 --- a/godoc-links.user.js +++ b/godoc-links.user.js @@ -1,3 +1,14 @@ +function init () { + switch (window.location.hostname) { + case 'godoc.org': + godoc(); + case 'pkg.go.dev': + pkg_go_dev(); + case 'github.com': + github(); + } +} + // Make the 'import "..."' package name a link to the package source. function godoc () { document.body.innerHTML = document.body.innerHTML @@ -51,3 +62,6 @@ function github_add_godoc_link () { function github_package_name () { return window.location.href.split('/').slice(2, 5).join('/'); } + + +init(); |