Created
November 3, 2022 12:51
-
-
Save dajnz/f5af6003ed3a912dba9557770ea0b1a1 to your computer and use it in GitHub Desktop.
Klavogonki Anti Traktor script
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
;(function () { | |
let findAttackerLinks = () => { | |
const ATTACKER_NAME = 'gaychik_monster'; | |
let playerNameLinks = document.querySelectorAll('a[class*="profile"][href^="/profile"]'); | |
if (playerNameLinks.length === 0) return []; | |
let playerNameLinksArr = Array.prototype.slice.call(playerNameLinks); | |
let attackerLinks = []; | |
playerNameLinksArr.forEach(link => { | |
let playerName = link.textContent.trim(); | |
if (playerName === ATTACKER_NAME) { | |
attackerLinks.push(link); | |
} | |
}); | |
return attackerLinks; | |
} | |
let hideGameBlock = (profileLinkElement) => { | |
let newGameBlock = profileLinkElement.closest('div[id^="game"]'); | |
if (newGameBlock === null) return; | |
newGameBlock.style.display = 'none'; | |
} | |
let attackerHider = () => { | |
let links = findAttackerLinks(); | |
links.forEach(link => { | |
hideGameBlock(link) | |
}) | |
window.setTimeout(attackerHider, 50); | |
} | |
window.setTimeout(attackerHider, 100); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment