Holiday Hack 2019: Appendix A: Hide Others TamperMonkey
Appendix A: Hide Others Tampermonkey
To clean up the game and make KringleCon a bit less crowded and make it easier to find things in the game, I used JavaScript to remove the other players from the map.
In the Inspector window, I see the players are each a div
with classes ent
and player
:
I’ll also notice that I have the class me
.
I can add a style visibility: hidden
to one of those divisions, and the player disappears. I’ll use that to create a loop that runs each second, find each player that isn’t me, and sets them to hidden.
As a TamperMonkey script, here’s the source:
// ==UserScript==
// @name Hide Others
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hide other players in KingleCon
// @author 0xdf
// @match https://kringlecon.com/
// @grant none
// ==/UserScript==
window.setInterval(hideplayers, 1000);
function hideplayers(){
document.querySelectorAll('.player').forEach(function (player) {
if (!player.className.includes("me")) {
player.style.visibility = 'hidden';
}
})
};