Created
October 12, 2020 19:12
-
-
Save WillForan/0641e40e8d7bbda8710904ccf3acfc72 to your computer and use it in GitHub Desktop.
count territories: update each gamesByEmail.com Gambit players status box w/ territory count
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
colors={'255, 255, 0': 'Yellow', '0, 255, 0': 'Green', '255, 0, 255': 'Magenta', '255, 0, 0': 'Red', '0, 255, 255': 'Cyan', '0, 0, 255': 'Blue' }; | |
cnt={}; | |
a=[... document.querySelectorAll('div[style~="background-color:"]')].map(x=>colors[x.getAttribute('style').replace(/.*background-color: rgb\((.*?)\); color.*/,'$1')]).forEach(function(x) {cnt[x] = cnt[x]===undefined?1:cnt[x]+1}); | |
Object.keys(cnt).forEach(k=>$('font[title="'+k+'"]').children[2].innerHTML+= ", " + cnt[k] + "terr.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment