{"size": 1679, "ext": "js", "max_stars_repo_path": "assets/ajax.js", "max_stars_repo_name": "polmes/etherocracy", "max_stars_repo_stars_event_min_datetime": "2017-10-17T15:43:35.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-05T12:44:06.000Z", "max_issues_repo_path": "assets/ajax.js", "max_issues_repo_name": "polmes/etherocracy", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "assets/ajax.js", "max_forks_repo_name": "polmes/etherocracy", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.2884615385, "max_line_length": 79, "alphanum_fraction": 0.6057176891}
function checkID() {
	var req = new XMLHttpRequest();
	req.open('POST', 'http://localhost:31416/check', true);
	req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	let content = 'dni=' + document.getElementById('ID').value;
	req.send(content);
	req.onload = () => {
		if (req.readyState === req.DONE) {
			if (req.status === 200) {
				let ans = JSON.parse(req.response);
				// console.log(ans);

				if (ans.census === "error") {
					document.getElementById("registered").style.color = "red";
				} else if (ans.census == "success") {
					document.getElementById("registered").style.color = "green";
				}

				if (ans.block === "error") {
					document.getElementById("eligibility").style.color = "red";
				} else if (ans.block == "success") {
					document.getElementById("eligibility").style.color = "green";
				}

				if (ans.census === "success" && ans.block === "success") {
					var sec = new XMLHttpRequest();
					sec.open('POST', 'http://localhost:31416/waitConsensus', true);
					sec.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
					sec.send(content);
					sec.onload = () => {
						if (sec.readyState === sec.DONE) {
							if (sec.status === 200) {
								if (sec.response == "Success") {
									document.getElementById("vote-now").style.color = "green";
								} else {
									document.getElementById("vote-now").style.color = "red";
								}
							}
						}
					};
				}
			}
		}
	};
}

function resetStatus() {
	document.getElementById("registered").style.color = "#aaa";
	document.getElementById("eligibility").style.color = "#aaa";
	document.getElementById("vote-now").style.color = "#aaa";
}
