Last active
September 23, 2025 18:45
-
-
Save tomalec/94ec4e3137815087e1377a96a54b0e66 to your computer and use it in GitHub Desktop.
Disable annoying prompts in XTB
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 XTB CSS fixes | |
// @namespace http://tampermonkey.net/ | |
// @version 2025-09-23.2 | |
// @updateURL https://gist.github.com/tomalec/94ec4e3137815087e1377a96a54b0e66/raw/xtb_ui_fix.user.js | |
// @downloadURL https://gist.github.com/tomalec/94ec4e3137815087e1377a96a54b0e66/raw/xtb_ui_fix.user.js | |
// @description Remove annoying toasts | |
// @author tomalec | |
// @match https://xstation5.xtb.com/ | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=xtb.com | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.info("'XTB CSS fixes' userscript is connected"); | |
GM_addStyle(` | |
.xs-toasts-content, | |
.xs-alert-container, | |
.xs-alerts-container, | |
xs6-home-view-sidebar { | |
display: none !important; | |
} | |
`); | |
// Tweak history table. Listen to `<xs6-history>` element getting active to injest styles to its shadowRoot. | |
const sheet = new CSSStyleSheet(); | |
// Apply a rule to the sheet | |
sheet.replaceSync("th{ min-width: 120px !important;}"); | |
const targetNode = document.querySelector("xs6-history"); | |
const config = { attributes: true, childList: false, subtree: false }; | |
const callback = (mutationList, observer) => { | |
for (const mutation of mutationList) { | |
if (mutation.type === "attributes") { | |
console.log(`The ${mutation.attributeName} attribute was modified.`); | |
if( targetNode.hasAttribute('module-active') ) { | |
console.log(targetNode.shadowRoot, targetNode.shadowRoot.querySelector('xs6-history_featureclosedpositions') ) | |
targetNode.shadowRoot.querySelector('xs6-history_featureclosedpositions').shadowRoot.adoptedStyleSheets = [ sheet ]; | |
} | |
} | |
} | |
}; | |
const observer = new MutationObserver(callback); | |
observer.observe(targetNode, config); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment