Skip to content

Instantly share code, notes, and snippets.

@Guidhouse
Last active September 19, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Guidhouse/99aceb10fab8dda9ad814298a9dc4276 to your computer and use it in GitHub Desktop.
Save Guidhouse/99aceb10fab8dda9ad814298a9dc4276 to your computer and use it in GitHub Desktop.
escape rooms
//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