Skip to content

Instantly share code, notes, and snippets.

@juanvallejo
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save juanvallejo/9927344 to your computer and use it in GitHub Desktop.

Select an option

Save juanvallejo/9927344 to your computer and use it in GitHub Desktop.
IDEA Script: Automatically "rates" a professor's idea survey in the most humanly-seeming way.
//paste this into chrome console
var win = window.frames[1];
var doc = win ? win.document.documentElement : document;
var inputs = doc.getElementsByTagName("input");
if(win && inputs && inputs.length) {
console.log("Loading, please wait...");
console.log("Realizing realizations...");
console.log("Loading loading sign...");
var inp;
for(var i=0;i<inputs.length;i++) {
inp = inputs[i];
if(inp.value % 5 == 0) {
var rand = parseInt(Math.random()*100)+1;
var choice = 5;
if(rand > 40) {
choice = parseInt(Math.random()*3)+3;
} else {
choice = parseInt(Math.random()*2)+4;
}
var chosen = inp.parentNode.parentNode.children[choice].children[0];
chosen.checked = true;
// console.log("input "+i+" checked!");
}
}
console.log("Judging your lack of care for important feedback...");
console.log("Laziness is truly a virtue.");
"Done.";
} else {
console.log("Sorry, this script needs to be modified to work on this page.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment