-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
136 lines (112 loc) · 9.1 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="og:site_name" content="Something To Cook"/>
<meta property="og:description" content="A minimalistic application for helping cooks decide what to make for dinner."/>
<meta property="og:image" content="/src/preview.png">
<meta property="og:url" content="http://somethingtocook.com/">
<meta property="og:type" content="website"/>
<title>Something to Cook</title>
<style>
*{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif}h2,h3,h4{color:#09c}header{padding:10px;background-color:#09c;text-align:center;color:white}header p{font-style:italic}main{padding:5px 5px 29px 5px;text-align:center}.filter{padding:0;margin:25px auto;padding-bottom:4px;max-width:580px;border-bottom:1px solid #ccc}.filter div{padding:8px}.filter ul li{display:inline-block;width:105px;font-size:12px;font-weight:700;text-align:center;color:#999;background-color:#d9d9d9;border-radius:1px;margin:.5px;padding:10px 5px;cursor:pointer;transition:color .25s,background-color .25s}.filter ul li.active{background-color:#f88000;color:#000}.filter ul li:focus,.filter ul li:hover{color:#fff;outline:none}.filter ul li.placeholder{padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top:none;border-bottom:none;opacity:0;cursor:default;pointer-events:none}#filter-tags div{margin:5px 0}#filter-tags div input[type="radio"]{display:none}#filter-tags div input + label{display:inline-block;color:#999;background-color:#d9d9d9;border-radius:1px;margin:0;padding:10px;cursor:pointer;transition:color .25s,background-color .25s}#filter-tags div input:checked + label{color:#000;background-color:#f88000}#filter-tags div input + label:focus,#filter-tags div input + label:hover{color:#fff;outline:none}#filter-tags div form{padding:10px}#filter-tags-search{display:inline-block;vertical-align:top;border:2px solid #f88000;border-radius:1px;padding:13px;width:200px;background-color:#f2f2f2;text-align:center}#filter-tags-search:hover,#filter-tags-search:focus{outline:none}#filter-tags-search-reset-btn{display:inline-block;vertical-align:top;padding:15px;background-color:#f88000;border:none;border-radius:1px;font-size:32px;line-height:15px;cursor:pointer;transition:color .25s}#filter-tags-search-reset-btn:hover,#filter-tags-search-reset-btn:focus{outline:none;color:#fff}#cook-something-container{min-height:62px}#cook-something-container.sticky button{position:fixed;top:0;left:0;right:0;opacity:.8;padding:10px}#cook-something-btn{display:inline-block;background:#f88000;color:#000;font-weight:700;border:none;border-radius:1px;padding:15px;width:100%;max-width:580px;margin:auto;font-size:28px;cursor:pointer;transition:background-color .25s,color .25s}#cook-something-btn:hover,#cook-something-btn:focus{color:#fff;outline:none}#result-container{min-height:800px}#result{display:none;padding:10px;margin:25px auto;max-width:556px;background-color:#fff;border:2px solid #09c;border-radius:1px;box-shadow:0 0 3px 1px rgba(0,0,0,.25)}#result-name{font-size:34px;color:#fff;background-color:#09c;margin:-10px -10px 10px -10px;padding:10px}#result-description-container{position:relative}#result-description{margin-top:10px;overflow-y:hidden;text-align:justify}#result-description p{color:#000}#result-description-cover{display:none;position:absolute;bottom:0;left:-10px;right:-10px;height:75px;background:rgba(225,225,225,.95);background:linear-gradient(rgba(225,225,225,0),rgba(225,225,225,.75),#fff)}#toggle-description-btn{display:block;position:absolute;bottom:0;width:100%;background:none;border:none;font-size:18px;font-weight:700;color:#f88000;padding:10px;cursor:pointer;transition:color .25s}#toggle-description-btn:hover,#toggle-description-btn:focus{color:#000;outline:none}#result-source{text-align:center;color:#09c}#result-source a{color:#f88000;transition:color .25s}#result-source a:hover,#result-source a:focus{outline:none;color:#000}#result-source:before{content:'Source: ';font-size:14px}#result-search-container{margin-top:50px}#result-search-container a{display:block;border:1px solid #d9d9d9;border-radius:25px;padding:15px;background-color:#fff;color:#000;transition:box-shadow .25s}#result-search-container a:hover,#result-search-container a:focus{box-shadow:0 0 6px 0 rgba(0,0,0,.25)}#result-search-variations-container{margin-top:25px}#result-search-variations-container h4{padding:5px}#result-search-variations-container a{display:inline-block;margin:2px}#c_alert{display:none;position:fixed;top:5px;left:5px;right:5px;padding:15px;box-shadow:0 0 3px 1px rgba(0,0,0,.5);border:2px solid #09c;background-color:#fff;text-align:center}#c_alert h1{font-size:24px;background-color:#09c;color:#fff;margin:-15px -15px 15px -15px;padding:10px}#c_alert p{padding:10px}#c_alert_close{background:#f88000;color:#000;border:none;border-radius:1px;padding:10px;margin:5px;font-size:18px;font-weight:700;cursor:pointer;transition:color .25s}#c_alert_close:hover,#c_alert_close:focus{color:#fff;outline:none}footer{position:fixed;right:0;bottom:0;left:0;padding:5px;background-color:#09c}footer p{font-size:12px;text-align:center;color:#fff}footer a{color:#f88000}
</style>
</head>
<body>
<header>
<h1>Something To Cook</h1>
<p>Pick some options below and let's help you decide on something to cook.</p>
</header>
<main>
<div id="filter-container">
<div class="filter" id="filter-categories">
<h2>Categories</h2>
<div>
<span>What the dish is really focused on or primarily centered around.</span>
</div>
<ul>
Loading...
</ul>
</div>
<div class="filter" id="filter-origins">
<h2>Origins</h2>
<div>
<span>From what part of the world the dish originated or became popular.</span>
</div>
<ul>
Loading...
</ul>
</div>
<div class="filter" id="filter-tags">
<h2>Tags</h2>
<div>
<span>Find meals with</span>
<input id="tags-method-1-btn" type="radio" name="tags-method" value="any" checked>
<label id="tags-method-1-label" for="tags-method-1-btn" tabIndex="0">any</label>
<input id="tags-method-2-btn" type="radio" name="tags-method" value="all">
<label id="tags-method-2-label" for="tags-method-2-btn" tabIndex="0">all</label>
<span> of these tags.</span>
<form>
<input id="filter-tags-search" type="text" placeholder="Search for tags" oninput="filterTagsByString(this.value);"></input>
<input id="filter-tags-search-reset-btn" type="reset" value="×" onclick="filterTagsByString('');"></input>
</form>
</div>
<ul id="tags-ul">
Loading...
</ul>
</div>
</div>
<div id="cook-something-container">
<button id="cook-something-btn" title="Find a meal!" onclick="getMeal()">Cook Something</button>
</div>
<div id="result-container">
<div id="result">
<h2 id="result-name"></h2>
<div id="result-description-container">
<div id="result-description">
</div>
<div id="result-description-cover">
<button id="toggle-description-btn" title="Toggle full description." onclick="toggleFullDescription()">Read More</button>
</div>
</div>
<h3 id="result-source"><</h3>
<div id="result-search-container">
<div id="result-search"></div>
<div id="result-search-variations-container">
<h4>Search Variations</h4>
<div id="result-search-variations">
</div>
</div>
</div>
</div>
</div>
</main>
<footer>
<p>SomethingToCook.com © | Hosted on <a href="https://github.com/shnibble/SomethingToCook">Github</a></p>
</footer>
<script src="/src/functions.min.js"></script>
<script>
"USE STRICT";
// declare page variables
let categoriesFilter = [],
originsFilter = [],
tagsFilter = [],
data = {},
meals = {},
descriptionContainerHeight = 0;
// retrieve data from data.json file
get("/src/data.json").then(function(resolve){
data = JSON.parse(resolve);
meals = data.meals;
categoriesFilter = data.categories;
originsFilter = data.origins;
buildDOM(data);
applyListeners();
}, function(error) {
c_alert("Error", error);
})
</script>
</body>
</html>