Created
April 8, 2020 15:22
-
-
Save David-Lor/c70e9b964183f99cda2d40b223fcbcdb to your computer and use it in GitHub Desktop.
(Portainer) Show node name on page title
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 Portainer-Show node name on page title | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
let nodeName = undefined; | |
function setTitle() { | |
const endpointName = document.getElementsByClassName("endpoint-name")[0]; | |
if (endpointName && endpointName.innerText && !nodeName) { | |
nodeName = endpointName.innerText; | |
document.title = `${document.title} | ${nodeName}`; | |
console.log(`Changed page title to include Portainer node name: ${nodeName}`); | |
} | |
} | |
if (document.title === "Portainer") { | |
window.onhashchange = setTitle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Preview: