From aeb7a52f9252c8295d43c50927bd74a8e4567877 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 22 Mar 2020 15:43:24 +0100 Subject: github.com: Add a function to get the Go package name from the URL --- godoc-links.user.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'godoc-links.user.js') diff --git a/godoc-links.user.js b/godoc-links.user.js index 8b7c17a..ccdaee7 100644 --- a/godoc-links.user.js +++ b/godoc-links.user.js @@ -35,3 +35,15 @@ function github_add_godoc_link () { link_el.href = ''; link_el.textContent = '(GoDoc)'; } + + +// Turns: +// +// https://github.com/google/uuid/blob/master/go.mod +// +// into: +// +// github.com/google/uuid +function github_package_name () { + return window.location.href.split('/').slice(2, 5).join('/'); +} -- cgit v1.2.3