Last active
September 19, 2019 09:24
-
-
Save Guidhouse/99aceb10fab8dda9ad814298a9dc4276 to your computer and use it in GitHub Desktop.
escape rooms
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
//first step | |
document.location = "https://nota.dk/om-nota/kontakt?department=206185" | |
//second step | |
names = [];terrorists=[]; monks = [];janitors =[]; | |
document.querySelectorAll(".node--corp-employee").forEach((el) => {names.push(el);}); | |
var n = 0 | |
while(names[n]){ | |
rnd = Math.floor(Math.random(3) * Math.floor(3)); | |
if(rnd === 1 && terrorists.length <= 5){ terrorists.push(names[n]);} | |
else if(rnd === 2 && monks.length <= 5){ monks.push(names[n]); } | |
else if(janitors.length <= 5) {janitors.push(names[n]); } | |
else {names.push(names[n]);} | |
n++; | |
} | |
terrorists.forEach((el) => { | |
cell = names[0].parentElement; cell.innerHTML = el.outerHTML; names.shift(); cell.style.backgroundColor = 'lightblue'; | |
}); | |
monks.forEach((el) => { | |
cell = names[0].parentElement; cell.innerHTML = el.outerHTML; names.shift(); cell.style.backgroundColor = 'wheat'; | |
}); | |
janitors.forEach((el) => { | |
cell = names[0].parentElement; cell.innerHTML = el.outerHTML; names.shift(); cell.style.backgroundColor = 'lightgreen'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment