Skip to content

Instantly share code, notes, and snippets.

@wadouk
Created November 26, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadouk/4d855e14691ef6b8a242157471219b6c to your computer and use it in GitHub Desktop.
Save wadouk/4d855e14691ef6b8a242157471219b6c to your computer and use it in GitHub Desktop.
Fix kubernetes doc jump menu
// ==UserScript==
// @name K8s doc enhancer
// @version 1
// @grant none
// @include http*://*kubernetes.io/docs/*
// @run-at document-idle
// ==/UserScript==
var base = /(.+)io(\/.+)/.exec(location.href)
function patch(href) {
return href.replace(/(.+docs\.kubernetes\.io)/, function (all, bas, host) {
return bas + base[2]
})
}
Array.from(document.querySelectorAll(".global-nav li ul li a")).forEach(function (t) {
var p = patch(t.getAttribute('href'))
t.setAttribute('href', p)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment