1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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://136.145.181.12/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://136.145.181.12/renglones.json"));
- window.localStorage.setItem("TODOS", loadFile("https://136.145.181.12/artesanias.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://136.145.181.12/" + renglones[i].Renglones + ".json"));
- }
- }
- } catch {
- console.log("error");
- }
|