aboutsummaryrefslogtreecommitdiffstats
path: root/godoc-links.user.js
diff options
context:
space:
mode:
authorTeddy Wing2020-03-22 15:43:24 +0100
committerTeddy Wing2020-03-22 15:43:24 +0100
commitaeb7a52f9252c8295d43c50927bd74a8e4567877 (patch)
tree7bc3948e1cb32ce4edd553eb6af145fd5d064143 /godoc-links.user.js
parent5a07b8d04d216653695410aee8d03d2a990e8464 (diff)
downloadgodoc-links-aeb7a52f9252c8295d43c50927bd74a8e4567877.tar.bz2
github.com: Add a function to get the Go package name from the URL
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 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('/');
+}