Skip to content

Instantly share code, notes, and snippets.

@noviluni
Last active November 18, 2020 19:52
Show Gist options
  • Save noviluni/a17a5dc2b88f48fb9b3e3cc925c6be88 to your computer and use it in GitHub Desktop.
Save noviluni/a17a5dc2b88f48fb9b3e3cc925c6be88 to your computer and use it in GitHub Desktop.
var solutions = {
"Albania": 0, "Austria": 2, "Bélgica": 3, "Bulgaria": 4, "Bosnia y Herzegovina": 5,
"Bielorrusia": 6, "Suiza": 7, "República Checa": 8, "Alemania": 9, "Dinamarca": 10,
"España": 11, "Estonia": 12, "Finlandia": 13, "Francia": 14, "Reino Unido": 15,
"Grecia": 16, "Croacia": 17, "Hungría": 18, "Islandia": 19, "Irlanda": 20,
"Italia": 21, "Kosovo": 22, "Lituania": 23, "Luxemburgo": 24, "Letonia": 25,
"Moldavia": 26, "Macedonia del Norte": 27, "Países Bajos": 28, "Montenegro": 29,
"Noruega": 30, "Polonia": 31, "Portugal": 32, "Rumania": 33, "Rusia": 34,
"República de Serbia": 35, "Eslovenia": 36, "Eslovaquia": 37, "Suecia": 38,
"Ucrania": 39, "Georgia": 40, "Turquía": 41, "Mónaco": 42, "Liechtenstein": 43,
"San Marino": 44, "Ciudad del Vaticano": 45, "Andorra": 46, "Malta": 47,
"Chipre": 48
}
// Get starting layer
var starting_point = parseInt(Object.keys(map._layers)[3])
// Adjust solutions
for (var key in solutions) {
solutions[key] += starting_point;
}
function solve_question() {
let country_name = $('.objetivo').html()
if (country_name) {
let solution = solutions[country_name]
map._layers[solution].fire('click')
}
}
setInterval(solve_question, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment