var storage = window.localStorage;

function loadFile(filePath) {
  var result = null;
  var xmlhttp = new XMLHttpRequest();
  xmlhttp.open("GET", filePath, false);
  xmlhttp.send();
  if (xmlhttp.status==200) {
    result = xmlhttp.responseText;
  }
  return result;
}


function checkDate() {
  var date = loadFile("https://artesaniaspr.online/date.txt");
  if (window.localStorage.getItem("DATE") == null || window.localStorage.getItem("DATE") != date) {
  window.localStorage.setItem("DATE", date);
    return false;
  }
  else {
    return true;
  }
}


try {
  if (checkDate() == false) {
                
    window.localStorage.setItem("RENGLONES", loadFile("https://artesaniaspr.online/renglones.json"));
                  
    var renglones = JSON.parse(window.localStorage.getItem("RENGLONES"));

    for (var i = 0; i < renglones.length; i++) {
      window.localStorage.setItem(renglones[i].Renglones, loadFile("https://artesaniaspr.online/" + renglones[i].Renglones + ".json"));
    }
  }
  } catch {
    console.log("error");
  }
  