Skip to content

Instantly share code, notes, and snippets.

@DavidEGx
Last active February 11, 2022 09:48
Show Gist options
  • Save DavidEGx/2bdf90eaf4205b7ae5c4d10af1450304 to your computer and use it in GitHub Desktop.
Save DavidEGx/2bdf90eaf4205b7ae5c4d10af1450304 to your computer and use it in GitHub Desktop.
BGA display letters on empty places
/*
Usage:
1. Go to some BGA Carcassonne game, review,
and jump to the point you are interested in.
2. Open developer console (F12)
3. Go to console tab.
4. Paste code below.
Alternative to that, you can create a new bookmark in your browser pointing at:
javascript:(function()%7Bconst%20chars%20%3D%20%5B'A'%2C%20'B'%2C%20'C'%2C%20'D'%2C%20'E'%2C%20'F'%2C%20'G'%2C%20'H'%2C%20'I'%2C%20'J'%2C%20'K'%2C%20'L'%2C%20'M'%2C%20'N'%2C%20'O'%2C%20'P'%2C%20'Q'%2C%20'R'%2C%20'S'%2C%20'T'%2C%20'U'%2C%20'V'%2C%20'W'%2C%20'X'%2C%20'Y'%2C%20'Z'%2C%20'1'%2C%20'2'%2C%20'3'%2C%20'4'%2C%20'5'%2C%20'6'%2C%20'7'%2C%20'8'%2C%20'9'%2C%20'a'%2C%20'b'%2C%20'c'%2C%20'd'%2C%20'e'%2C%20'f'%2C%20'g'%2C%20'h'%2C%20'i'%2C%20'j'%2C%20'k'%2C%20'l'%2C%20'm'%2C%20'n'%2C%20'o'%2C%20'p'%2C%20'q'%2C%20'r'%2C%20's'%2C%20't'%2C%20'u'%2C%20'v'%2C%20'w'%2C%20'x'%2C%20'y'%2C%20'z'%20%5D%3B%0Alet%20charIdx%20%3D%200%3B%0A%0Afor%20(let%20space%20of%20document.querySelectorAll('.place%3Anot(.disabled)'))%20%7B%0A%20%20space.textContent%20%20%20%20%20%3D%20chars%5BcharIdx%2B%2B%5D%3B%0A%20%20space.style.fontSize%20%20%3D%20(parseInt(space.style.width)%20*%200.75)%20%2B%20'px'%3B%0A%20%20space.style.textAlign%20%3D%20'center'%3B%0A%20%20space.style.color%20%20%20%20%20%3D%20'rgb(255%2C255%2C255%2C0.45)'%3B%0A%7D%7D)()%3B
Then you just need to go to the game and click on the bookmark.
TODO: Need to incorporate this into https://github.com/DavidEGx/bga-carcassonne-reviewer
*/
const chars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ];
let charIdx = 0;
for (let space of document.querySelectorAll('.place:not(.disabled)')) {
space.textContent = chars[charIdx++];
space.style.fontSize = (parseInt(space.style.width) * 0.75) + 'px';
space.style.textAlign = 'center';
space.style.color = 'rgb(255,255,255,0.45)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment