Skip to content

Instantly share code, notes, and snippets.

@vermi321
Created October 23, 2024 17:50
Show Gist options
  • Save vermi321/4dcf6947c827bed6a4d5087ca928791d to your computer and use it in GitHub Desktop.
Save vermi321/4dcf6947c827bed6a4d5087ca928791d to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Hide annoying TradingView things
// @namespace http://tampermonkey.net/
// @version 2024-08-31
// @description try to take over the world!
// @author vermi321
// @match https://www.tradingview.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tradingview.com
// @grant none
// ==/UserScript==
(async () => {
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const hide = (selector) => {
const el = document.querySelector(selector);
if (el) {
el.style.display="none";
}
}
const removeClassNames = (target, classNames) => {
const el = document.querySelector(target);
if (el) {
classNames.forEach(className => el.classList.remove(className))
}
}
const hideAllTheThings = () => {
hide(`[data-dialog-name="gopro"]`);
hide(`[data-id="chart-toasts-container"]`);
removeClassNames('body', ['i-no-scroll'])
}
const control = document.createElement('div');
control.innerHTML = `
<style>
.uiControlls {
position: fixed;
top: 6px;
right: 510px;
background: #fff;
z-index: 99999;
}
</style>
<button class="uiControlls">🙈</button>
`
document.body.appendChild(control)
document.querySelector('.uiControlls').addEventListener('click', hideAllTheThings);
while(true) {
hideAllTheThings();
await sleep(10000);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment