-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
472 lines (452 loc) · 18.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Restaurant Picker</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 10px;
background-color: #f0f0f0;
}
.container {
max-width: 100%;
margin: auto;
background: white;
padding: 15px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
font-size: 1.5em;
}
label {
margin-bottom: 5px;
font-weight: bold;
display: block;
}
.dropdown-container {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.dropdown-container input {
width: 100%;
padding: 8px;
font-size: 16px;
border-radius: 5px;
border: 1px solid #ccc;
box-sizing: border-box;
}
.dropdown-container .dropdown-options {
position: absolute;
top: 100%;
left: 0;
right: 0;
max-height: 150px;
overflow-y: auto;
background-color: white;
border: 1px solid #ccc;
border-radius: 5px;
z-index: 1000;
display: none;
}
.dropdown-container .dropdown-options div {
padding: 10px;
cursor: pointer;
}
.dropdown-container .dropdown-options div:hover {
background-color: #f0f0f0;
}
.blocked-items {
margin-top: 10px;
padding: 10px;
background-color: #e0e0e0;
border-radius: 5px;
}
.blocked-items h3 {
font-size: 1em;
margin-bottom: 5px;
}
.blocked-items div {
padding: 5px;
background-color: #d0d0d0;
border-radius: 3px;
margin-bottom: 5px;
cursor: pointer;
}
.clear-button {
width: 100%;
padding: 8px;
font-size: 14px;
background-color: #f44336;
color: white;
border: none;
border-radius: 5px;
margin-bottom: 10px;
box-sizing: border-box;
cursor: pointer;
}
.clear-button:hover {
background-color: #e53935;
}
button {
width: 100%;
padding: 12px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
box-sizing: border-box;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
/* Media queries for mobile responsiveness */
@media (max-width: 600px) {
h1 {
font-size: 1.2em;
}
label {
font-size: 0.9em;
}
.dropdown-container input {
font-size: 14px;
}
.dropdown-container .dropdown-options div {
padding: 8px;
}
.clear-button, button {
font-size: 14px;
}
#result {
font-size: 18px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>Fargo-Moorhead Restaurant Picker</h1>
<label for="restaurantType">Choose a Type:</label>
<select id="restaurantType">
<option value="">Any</option>
<option value="African">African</option>
<option value="American">American</option>
<option value="Asian">Asian</option>
<option value="Coffee">Coffee</option>
<option value="Delis & Sandwiches">Delis & Sandwiches</option>
<option value="Diners">Diners</option>
<option value="European">European</option>
<option value="Fine Dining">Fine Dining</option>
<option value="Italian">Italian</option>
<option value="Mediterranean">Mediterranean</option>
<option value="Mexican">Mexican</option>
<option value="Pizza">Pizza</option>
<option value="Sports Bars">Sports Bars</option>
<option value="Treats">Treats</option>
</select>
<label for="blockTypes">Block Types:</label>
<div class="dropdown-container">
<input type="text" id="blockTypesInput" placeholder="Type or select to block" autocomplete="on">
<div class="dropdown-options" id="blockTypesOptions"></div>
<button class="clear-button" onclick="clearSelections('blockTypesInput', 'blockTypesOptions', 'blockedTypes')">Clear Selections</button>
</div>
<label for="blockRestaurants">Block Specific Restaurants:</label>
<div class="dropdown-container">
<input type="text" id="blockRestaurantsInput" placeholder="Type or select to block" autocomplete="on">
<div class="dropdown-options" id="blockRestaurantsOptions"></div>
<button class="clear-button" onclick="clearSelections('blockRestaurantsInput', 'blockRestaurantsOptions', 'blockedRestaurants')">Clear Selections</button>
</div>
<div class="blocked-items">
<h3>Blocked Types:</h3>
<div id="blockedTypes"></div>
<h3>Blocked Restaurants:</h3>
<div id="blockedRestaurants"></div>
</div>
<button onclick="pickRestaurant()">Pick a Restaurant</button>
<div id="result"></div>
</div>
<script>
const types = ['African', 'American', 'Asian', 'Coffee', 'Delis & Sandwiches', 'Diners', 'European', 'Fine Dining', 'Italian', 'Mediterranean', 'Mexican', 'Pizza', 'Sports Bars', 'Treats'];
const restaurants = {
"Adibon": "African",
"Mama African Cusine": "African",
"Kings and Queens Jollof House": "African",
"Rugsan Cuisine": "African",
"The Spice Grille": "African",
"46 North Pints & Provisions": "American",
"Barcode Bar & Grill": "American",
"Baron's Eatery & Bar": "American",
"Beer & Fish Company": "American",
"Brew Bird": "American",
"Brewtus' Brickhouse Tavern": "American",
"Burger Time": "American",
"Camp Lone Tree": "American",
"Chalili's Chicken & Wing": "American",
"Cowboy Jack's": "American",
"CRAVE American Kitchen & sushi Bar": "American",
"Doolittles Woodfire Grill": "American",
"Crooked Pint Ale House": "American",
"Granite City": "American",
"Hen House Bar & Restaurant": "American",
"Herd & Horns": "American",
"Hi-Ho Burgers & Brews": "American",
"Jay's Smokin' BBQ": "American",
"JL Beers": "American",
"Lucky's 13 Pub": "American",
"NoBull Smokehouse": "American",
"Luna": "American",
"Nova Eatery": "American",
"Midtown Tavern": "American",
"Old Broadway": "American",
"Pounds": "American",
"Sickies Garage": "American",
"Silver Dollar - Flying Pig Bar & Grill": "American",
"Sol Ave. Kitchen": "American",
"Spitfire Bar & Grill": "American",
"Space Aliens Grill and Bar": "American",
"Teddy's Eatery & Parlor": "American",
"The Boiler Room": "American",
"True North Bistro": "American",
"The Tavern Grill": "American",
"Urban 42": "American",
"The Toasted Frog": "American",
"Wicked Willie's Seafood Steam Pots": "American",
"Wild Bill's Sports Saloon": "American",
"China Buffet": "Asian",
"China King": "Asian",
"Drunken Noodle": "Asian",
"Fortune House Chinese Resturant": "Asian",
"Giant Panda": "Asian",
"Ginza Ramen & Poke": "Asian",
"Great Wall Chinese Restaurant": "Asian",
"House of Noods + Buns": "Asian",
"Himalayan Yak": "Asian",
"India Palace": "Asian",
"India Street Food Fargo": "Asian",
"Kobe's Japanese Cuisine": "Asian",
"Izumi Sushi & Hibachi": "Asian",
"LeeLa Thai Cuisine": "Asian",
"Jade Dragon": "Asian",
"Little Brother": "Asian",
"Lucy's North China Cuisine": "Asian",
"Mr Wok Chinese Express": "Asian",
"Lulu's Deli": "Asian",
"Nine Dragons": "Asian",
"Momos n' More": "Asian",
"Osaka Sushi & Hibachi": "Asian",
"Passage to India": "Asian",
"Poke Bowl": "Asian",
"Peking Restaurant": "Asian",
"Royal Buffet": "Asian",
"Pho D'licious": "Asian",
"Samurai Asian Fusion Cuisine & Sushi Bar": "Asian",
"Shang Hai Chinese Restaurant": "Asian",
"Snap Dragon": "Asian",
"Sirirath Thai House": "Asian",
"Soho 23": "Asian",
"Slurp Ramen": "Asian",
"Sushi Burrito Cafe": "Asian",
"Taj India": "Asian",
"Thai Orchid": "Asian",
"Thai Street Food": "Asian",
"ThaiKota": "Asian",
"Wasabi Sushi & Asian Grill": "Asian",
"Atomic Coffee": "Coffee",
"Babb's Coffee House": "Coffee",
"Beans Coffee Bar": "Coffee",
"Bully Brew Coffee House": "Coffee",
"Chai Moto": "Coffee",
"Kreps Family Corner Coffee": "Coffee",
"Ladybug Lattee": "Coffee",
"Moonrise Cafe": "Coffee",
"Moxie Java": "Coffee",
"Red River Coffee Company": "Coffee",
"Steep Me A Cup of Tea": "Coffee",
"Teaberry": "Coffee",
"Third Drop Coffee & Kitchen": "Coffee",
"Thunder Coffee": "Coffee",
"Twenty Below Coffee Co.": "Coffee",
"Young Blood Coffee Co.": "Coffee",
"Boppa's Bagels": "Delis & Sandwiches",
"Cracked Pepper": "Delis & Sandwiches",
"Grand Junction": "Delis & Sandwiches",
"Mehl's Bakery & Deli": "Delis & Sandwiches",
"Michele's Table": "Delis & Sandwiches",
"Benedict's Morning Heroes": "Diners",
"Deaner's Diner": "Diners",
"Fry'n Pan": "Diners",
"Kroll's Diner": "Diners",
"Marge's Diner": "Diners",
"Randy's Diner": "Diners",
"The Shack on Broadway": "Diners",
"BernBaum's": "European",
"Blarney Stone Pub": "European",
"Sons of Norway": "European",
"Three Lyons Pub": "European",
"Wurst Bier Hall": "European",
"84 Italian Steakhouse": "Fine Dining",
"Fargo Cork 'N Cleaver": "Fine Dining",
"Mangata Wine & Raw Bar": "Fine Dining",
"Maxwells": "Fine Dining",
"Mezzaluna": "Fine Dining",
"Porter Creek Hardwood Grill": "Fine Dining",
"Prairie Kitchen": "Fine Dining",
"Rosewild": "Fine Dining",
"Rustica Eatery & Tavern": "Fine Dining",
"Altony's Italian Cafe": "Italian",
"Reese & Riley's Olive Oil & Bistro Bar": "Italian",
"Spaghetti Western Italian": "Italian",
"Cafe Aladdin": "Mediterranean",
"Cairo Restaurant and Bar": "Mediterranean",
"GP's Greek Kitchen": "Mediterranean",
"Ishtar Mediterranean Cuisine": "Mediterranean",
"New Gyro": "Mediterranean",
"Newroz Kebab": "Mediterranean",
"Tati's Mediterranean Savour": "Mediterranean",
"Acapulco Mexican Restaurant": "Mexican",
"Azteca Tacos": "Mexican",
"Casa Mexico Restaurant": "Mexican",
"El Agave Mexican Restaurant": "Mexican",
"El Taco Rojo": "Mexican",
"El Torero Mexican Restaurant": "Mexican",
"La Unica": "Mexican",
"Mango's Mexican & American Grill": "Mexican",
"Mas Tequila": "Mexican",
"Mexican Village": "Mexican",
"Paradiso": "Mexican",
"Plaza Azteca": "Mexican",
"Puerto Vallarta": "Mexican",
"Red Pepper": "Mexican",
"Taco Shop": "Mexican",
"Tacos Trompo": "Mexican",
"Blackbird Woodfire": "Pizza",
"Deek's Pizza": "Pizza",
"Duane's House of Pizza": "Pizza",
"Pizza Patrol": "Pizza",
"Rhombus Guys": "Pizza",
"Sammy's Pizza": "Pizza",
"Slap Shot Pizza": "Pizza",
"Spicy Pie": "Pizza",
"Bar Down Sports Bar & Restaurant": "Sports Bars",
"Bison Turf": "Sports Bars",
"BorderTown Bar & Grill": "Sports Bars",
"Bulldog Tap": "Sports Bars",
"Dempsey's Public House": "Sports Bars",
"Fargo Billiards & Gastropub": "Sports Bars",
"Frank's Lounge": "Sports Bars",
"Hooligan's Bar & Grill": "Sports Bars",
"Labby's Grill & Bar": "Sports Bars",
"Legends Sports Bar & Grill": "Sports Bars",
"Mick's Office": "Sports Bars",
"Murphy's Pub": "Sports Bars",
"O'Clevy's Drinks & Eats": "Sports Bars",
"O'Kelly's Tastes & Toddies": "Sports Bars",
"Pepper's Sports Cafe": "Sports Bars",
"Pub West": "Sports Bars",
"Rookies Sports Bar & Grill": "Sports Bars",
"Round Up Saloon": "Sports Bars",
"Sidestreet Grille & Pub": "Sports Bars",
"SouthTown PourHouse": "Sports Bars",
"Tailgators Sports Cafe": "Sports Bars",
"The Local 701": "Sports Bars",
"Vic's Bar & Grill": "Sports Bars",
"Woody's Bar & Grill": "Sports Bars",
"The Zone Bar": "Sports Bars",
"Aloha Fresh Juice Bar": "Treats",
"Black Coffee and Waffle Bar": "Treats",
"Dairy Queen-The Original Moorhead Dairy Queen": "Treats",
"Juice Box": "Treats",
"Juice It": "Treats",
"Kones Kreamery": "Treats",
"Moorhead Freez": "Treats",
"Nichole's Fine Pastry & Cafe": "Treats",
"Sandy's Donuts": "Treats",
"Scoop N Dough Candy Co.": "Treats",
"Sweet Dreams Confections": "Treats",
"Tea & Crepe Cafe": "Treats",
"The Silver Lining Creamery": "Treats",
"Yeobo Sweet Shop": "Treats",
};
function filterOptions(inputElement, options, dropdownOptionsElement) {
const filter = inputElement.value.toLowerCase();
dropdownOptionsElement.innerHTML = '';
const filteredOptions = options.filter(option => option.toLowerCase().includes(filter));
filteredOptions.forEach(option => {
const optionDiv = document.createElement('div');
optionDiv.textContent = option;
optionDiv.onclick = () => {
updateSelectedItems(inputElement, dropdownOptionsElement, option);
};
dropdownOptionsElement.appendChild(optionDiv);
});
dropdownOptionsElement.style.display = filteredOptions.length > 0 ? 'block' : 'none';
}
function updateSelectedItems(inputElement, dropdownOptionsElement, value) {
const selectedDivId = inputElement.id === 'blockTypesInput' ? 'blockedTypes' : 'blockedRestaurants';
const selectedContainer = document.getElementById(selectedDivId);
if (!selectedContainer.querySelector(`[data-value="${value}"]`)) {
const blockDiv = document.createElement('div');
blockDiv.textContent = value;
blockDiv.setAttribute('data-value', value);
blockDiv.onclick = () => {
selectedContainer.removeChild(blockDiv);
};
selectedContainer.appendChild(blockDiv);
}
inputElement.value = '';
dropdownOptionsElement.style.display = 'none';
}
function clearSelections(inputId, dropdownId, blockedId) {
const inputElement = document.getElementById(inputId);
const dropdownOptionsElement = document.getElementById(dropdownId);
const blockedElement = document.getElementById(blockedId);
inputElement.value = '';
blockedElement.innerHTML = '';
}
function setupDropdown(inputId, options, dropdownId) {
const inputElement = document.getElementById(inputId);
const dropdownOptionsElement = document.getElementById(dropdownId);
inputElement.addEventListener('input', () => {
filterOptions(inputElement, options, dropdownOptionsElement);
});
inputElement.addEventListener('focus', () => {
filterOptions(inputElement, options, dropdownOptionsElement);
});
document.addEventListener('click', (e) => {
if (!dropdownOptionsElement.contains(e.target) && e.target !== inputElement) {
dropdownOptionsElement.style.display = 'none';
}
});
}
setupDropdown('blockTypesInput', types, 'blockTypesOptions');
setupDropdown('blockRestaurantsInput', Object.keys(restaurants), 'blockRestaurantsOptions');
function pickRestaurant() {
const restaurantType = document.getElementById('restaurantType').value;
const blockTypes = Array.from(document.getElementById('blockedTypes').children).map(div => div.getAttribute('data-value'));
const blockRestaurants = Array.from(document.getElementById('blockedRestaurants').children).map(div => div.getAttribute('data-value'));
const filteredRestaurants = Object.entries(restaurants)
.filter(([name, type]) => !blockTypes.includes(type) && !blockRestaurants.includes(name))
.filter(([name, type]) => !restaurantType || type === restaurantType);
if (filteredRestaurants.length === 0) {
document.getElementById('result').innerText = 'No restaurants available or they are blocked.';
return;
}
const [chosenRestaurant, chosenType] = filteredRestaurants[Math.floor(Math.random() * filteredRestaurants.length)];
document.getElementById('result').innerText = `You should go to: ${chosenRestaurant} (${chosenType})`;
}
</script>
</body>
</html>