I created this script for myself to help with choosing restaurant food. I eat out a few times a month and usually it's just "I want to pay someone else to make me food," rather than "I have a craving for a certain thing." Every time I wish I had a list of ALL the things I like so I could just pick from that, rather than browsing each menu for takeout options.
That's when I got the idea for this. I learned a little bit about Javascript: Adding data, randomizing/displaying options, history, filtering... and a bit about CSS to get things to operate the way I wanted them to.
I'm providing the script and basic instructions so you can update it with your foods, if you think something simple like this might be helpful. Basically, you fill out the database (foods.js) with foods and restaurants near you that you reliably enjoy, providing details about each dish's cost and distance from your home.
See the note at the bottom of the page about making updates yourself.
Use the tool:
Right click and download the associated files.
Follow these instructions to add your food selections to the database for your tool. You can update the index and style files as desired.
{
name: "Delias",
mileage: 5,
dishes: [
{ name: "Beets and Goat Cheese Salad", cost: 11 },
{ name: "10 in Pizza (gluten free crust)", cost: 12 },
{ name: "Burger (gluten free bun) and fries", cost: 19 },
{ name: "Chocolate Mousse", cost: 8 },
{ name: "Creme Brulee", cost: 10 }
]
},
{
name: "Seoul BBQ",
mileage: 5,
dishes: [
{ name: "Bibimbap and Kimchi", cost: 29 },
{ name: "Kimchi Fried Rice", cost: 19 }
]
},
// Shuffle and pick up to 3
const shuffled = [...filtered].sort(() => 0.5 - Math.random());
const selected = shuffled.slice(0, 3);
// Keep last 5 in history
history = history.slice(0, 5);
Unfortunately I cannot provide further support, I only learned what I needed to know to create this for my needs.
You're free to take the base script and improve it for your purposes! If you share your update, I'd appreciate a link back for getting it started, but no need to do that if you make significant updates to the code.
If you want to learn JavaScript, I used a few resources to piece this together, and they may help get you started. (I also had some previous knowledge editing code, so keep that in mind: I wasn't starting from scratch.)
Full disclosure: I did not go through every page in these links. I cherry picked what I needed to know.