update cached information and add a little paragraph about the boroughs

This commit is contained in:
2022-03-19 11:45:05 -04:00
parent 2cd3020151
commit 5b2f60992c
3 changed files with 947 additions and 627 deletions

View File

@@ -1,24 +1,25 @@
const cheerio = require('cheerio');
const mustache = require('./js/mustache.js');
const fs = require('fs');
const stores = require('./stores.json');
const cheerio = require("cheerio");
const mustache = require("./js/mustache.js");
const fs = require("fs");
const stores = require("./stores.json");
fs.readFile('./index.html', function (err, data) {
if (err) { throw err; }
fs.readFile("./index.html", function (err, data) {
if (err) {
throw err;
}
const $ = cheerio.load(data);
stores.sort(
function(a, b) {
var aname = a.name.toLowerCase();
var bname = b.name.toLowerCase();
return aname === bname ? 0 : +(aname > bname) || -1;
}
);
$('#Stores').html(mustache.render($('#Table').html(), {rows: stores}));
fs.writeFile('./index.html', $.html(), (err) => {
if (err) throw err;
console.log('Default view updated.');
stores.sort(function (a, b) {
var aname = a.name.toLowerCase();
var bname = b.name.toLowerCase();
return aname === bname ? 0 : +(aname > bname) || -1;
});
});
$("#Stores").html(mustache.render($("#Table").html(), { rows: stores }));
$("#storeCount").html(stores.length);
fs.writeFile("./index.html", $.html(), (err) => {
if (err) throw err;
console.log("Default view updated.");
});
});