Created
November 26, 2018 16:42
-
-
Save wadouk/4d855e14691ef6b8a242157471219b6c to your computer and use it in GitHub Desktop.
Fix kubernetes doc jump menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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