{"size": 641, "ext": "js", "max_stars_repo_path": "script.js", "max_stars_repo_name": "egaralmeida/rpgnamer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "script.js", "max_issues_repo_name": "egaralmeida/rpgnamer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "script.js", "max_forks_repo_name": "egaralmeida/rpgnamer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.64, "max_line_length": 73, "alphanum_fraction": 0.6801872075}
let dataJson;

fetch("./data.json")
  .then((response) => response.json())
  .then((data) => generateName(data));

function generateName(data) {
  dataJson = data;

  document.getElementById("prefix").textContent =
    data.prefixes[Math.floor(Math.random() * data.prefixes.length)].text;

  document.getElementById("item").textContent =
    data.items[Math.floor(Math.random() * data.items.length)].text;

  document.getElementById("suffix").textContent =
    data.suffixes[Math.floor(Math.random() * data.suffixes.length)].text;
}

$(document).ready(function () {
  $(".item--em").click(function () {
    generateName(dataJson);
  });
});
