Created
July 14, 2025 15:06
-
-
Save theodric/369718233115f28680749ab0d917678f to your computer and use it in GitHub Desktop.
ViolentMonkey implementation of dark mode for Mikrotik web UI
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 Mikrotik Router Dark Mode | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Invert colors for Mikrotik router UI to create a dark mode effect | |
// @match http://10.10.11.254/webfig/* | |
// @match https://10.10.11.254/webfig/* | |
// @match http://gw/webfig/* | |
// @match http://gw.satcom/webfig/* | |
// @match http://gw.satcom.rowls/webfig/* | |
// @grant none | |
// @author ChatGPT | |
// @description 7/15/2024, 2:35:35 PM | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Create a style element to hold our CSS | |
const style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = ` | |
html { | |
filter: invert(100%); | |
background-color: #000; | |
} | |
img, video, object, embed { | |
filter: invert(100%); | |
} | |
`; | |
// Append the style element to the head of the document | |
document.head.appendChild(style); | |
// Optionally, if there are iframes, invert them as well | |
const iframes = document.getElementsByTagName('iframe'); | |
for (let i = 0; i < iframes.length; i++) { | |
const iframe = iframes[i]; | |
iframe.onload = function() { | |
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; | |
const iframeStyle = iframeDoc.createElement('style'); | |
iframeStyle.type = 'text/css'; | |
iframeStyle.innerHTML = ` | |
html { | |
filter: invert(100%); | |
background-color: #000; | |
} | |
img, video, object, embed { | |
filter: invert(100%); | |
} | |
`; | |
iframeDoc.head.appendChild(iframeStyle); | |
}; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment