Last active
December 26, 2023 14:54
-
-
Save mingming-cn/d515bf25d9d9c278ccf2982248ea21ed to your computer and use it in GitHub Desktop.
This file contains 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 Grafana Theme light | |
// @namespace https://mingming.wang/ | |
// @version 0.1.0 | |
// @description grafana theme light | |
// @author mingming-cn | |
// @match http://*.u4/* | |
// @icon https://grafana.com/static/assets/img/fav32.png | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @homePage https://gist.githubusercontent.com/mingming-cn/d515bf25d9d9c278ccf2982248ea21ed | |
// @updateURL https://gist.githubusercontent.com/mingming-cn/d515bf25d9d9c278ccf2982248ea21ed/raw/044208dbe90b12eb0afa1b55015996abca13566e/grafana-theme-light.js | |
// ==/UserScript== | |
window.addEventListener('load', function() { | |
'use strict'; | |
waitForKeyElements(".app-grafana", changeTheme); | |
function changeTheme (jNode) { | |
if(jNode && !jNode.hasClass("theme-light")){ | |
let param = '&theme=light'; | |
if (window.document.location.href.indexOf('?') < 0) { | |
param = '?theme=light'; | |
} | |
window.document.location.href += param; | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment