NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Lichess broadcast spoiler protecter
// @namespace Violentmonkey
// @match https://lichess.org/broadcast/**
// @grant none
// @version 1.1
// @author H29A
// @description Removes the display of results for completed matches in the broadcast tab
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function hideSpoilers() {
const spoilers = document.querySelectorAll('.result');
const statusDiv = document.querySelector('div.status');
const resultTag = document.querySelector('res');
const matchTable = document.querySelector('.study__tags');
statusDiv.style.display = "none";
resultTag.style.display = "none";
matchTable.style.display = "none";
spoilers.forEach((spoiler) => {
spoiler.style.display = "none";
});
}
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
const newNodes = mutation.addedNodes;
if (newNodes.length > 0) {
newNodes.forEach((node) => {
if (node.classList && node.classList.contains('analyse__board')) {
hideSpoilers();
//observer.disconnect();
}
});
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();