Last active
August 28, 2023 11:45
-
-
Save DanielShterenberg/480c471b1f15b90850fc04bfffe9d634 to your computer and use it in GitHub Desktop.
Hide scores in courtside1891.basketball (Paste in TamperMonkey)
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 Hide Basketball Scores | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide scores from courtside1891.basketball | |
// @author You | |
// @match https://www.courtside1891.basketball/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
// Function to remove the scores | |
function removeScores() { | |
const classesToRemove = ['.game-rail-card__team', '.game-rail-card__content', '.game-card-v2__team-score']; | |
classesToRemove.forEach(className => { | |
const elements = document.querySelectorAll(className); | |
elements.forEach(el => { | |
el.remove(); | |
}); | |
}); | |
} | |
// Initial removal of scores | |
removeScores(); | |
// Create an observer instance linked to the callback function | |
const observer = new MutationObserver(function(mutationsList, observer) { | |
for(let mutation of mutationsList) { | |
if (mutation.type === 'childList') { | |
removeScores(); | |
} | |
} | |
}); | |
// Start observing the document with the configured parameters | |
observer.observe(document.body, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment