Skip to content

Instantly share code, notes, and snippets.

@ear1grey
Created February 22, 2014 22:44
Show Gist options
  • Save ear1grey/9163511 to your computer and use it in GitHub Desktop.
Save ear1grey/9163511 to your computer and use it in GitHub Desktop.
Scrape the list of students on a unit from the staff portal at Uni of Portsmouth, as JSON.
(function() {
var i, y, result = [], x = document.querySelectorAll("input[type=checkbox]");
for (i in x) {
y = x[i].defaultValue;
if (y) {
var r = {}
r.orig = y;
r.email = y.split(",")[0].trim();
r.name = y.split(",")[1].trim();
r.jupiter = r.email.substr(2).replace('@myport.ac.uk', '');
result.push( r );
};
}
return JSON.stringify(result);
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment