generated from github/welcome-to-github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ark_kibble.html
230 lines (180 loc) · 9.06 KB
/
ark_kibble.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style/style__main.css">
<link rel="stylesheet" type="text/css" href="style/style_ark_kibble.css">
<title>RFD's Scratchpad</title>
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg">
<link id="theme_css" rel="stylesheet" type="text/css" href="style/theme_dark.css">
<script src="scripts/ark_data_kibble.js"></script>
<!--no defer!-->
<script src="scripts/shared.js"></script>
</head>
<body>
<div id="header_id"></div>
<div id="content_id">
<h1>kibble cheat sheet</h1>
<div class="textbg">
<p>Reference for kibble use and recipes.</p>
<p>Kibble should never be stored or transported in a tame's inventory; they are likely to eat it. The spoil time is long enough that it's safe to carry it in your own inventory.</p>
<p>Typically, imprint kibble is reusable. To ensure the tame doesn't eat it, put a small amount of regular food in their inventory <i>before</i> using the kibble.</p>
<input type="text" id="ark_kibbleType_search" onkeyup="searchByKibble()" placeholder="Search by kibble type..." title="type in the kibble you're looking for">
<input type="text" id="ark_kibbleSpecies_search" onkeyup="searchBySpecies()" placeholder="Search by tamed creature..." title="type in the species you want to tame">
<div id="ark_kibble_table">
</div>
</div>
</div>
<div id="footer_id"></div>
<script>
function showKibble() {
for (let i = 0; i < kibble_list.length; i++) {
// general
let ark_kibble_row = document.createElement("div");
ark_kibble_row.classList.add("ark_kibble_row");
//header
let tn_kibble_name = document.createTextNode(kibble_list[i].name);
let ark_kibble_name = document.createElement("h3");
let ark_kibble_header = document.createElement("div");
let ark_kibble_ingredients = document.createElement("ul");
ark_kibble_ingredients.classList.add("ark_kibble_ingredients");
ark_kibble_name.classList.add("ark_kibble_name");
ark_kibble_name.appendChild(tn_kibble_name);
ark_kibble_header.appendChild(ark_kibble_name);
ark_kibble_header.classList.add("ark_kibble_header");
if (kibble_list[i].imprint == true) {
let tn_kibble_imprint = document.createTextNode("imprint");
let ark_kibble_imprint = document.createElement("span");
ark_kibble_imprint.classList.add("ark_kibble_imprint_text");
ark_kibble_imprint.appendChild(tn_kibble_imprint);
ark_kibble_row.classList.add("ark_kibble_imprint");
ark_kibble_header.appendChild(ark_kibble_imprint);
};
//ingredients
if (kibble_list[i].meat != []) {
for (let j = 0; j < kibble_list[i].meat.length; j++) {
/*let tn_meat = document.createTextNode(kibble_list[i].meat[j][0]);
let ark_kibble_meat = document.createElement("li");
ark_kibble_meat.classList.add("ark_kibble_meat");
let tn_count = document.createTextNode(kibble_list[i].meat[j][1]);
let ark_kibble_meat_count = document.createElement("span");
ark_kibble_meat_count.appendChild(tn_count);
ark_kibble_meat_count.classList.add("kibble_ingr_count");
ark_kibble_meat.append(ark_kibble_meat_count, tn_meat);
ark_kibble_ingredients.appendChild(ark_kibble_meat);*/
addIngredient("ark_kibble_meat", kibble_list[i].meat[j][1], kibble_list[i].meat[j][0], ark_kibble_ingredients);
}
};
if (kibble_list[i].other != []) {
for (let k = 0; k < kibble_list[i].other.length; k++) {
/*let tn_other = document.createTextNode(kibble_list[i].other[k][0]);
let ark_kibble_other = document.createElement("li");
ark_kibble_other.classList.add("ark_kibble_other");
let tn_count = document.createTextNode(kibble_list[i].other[k][1]);
let ark_kibble_other_count = document.createElement("span");
ark_kibble_other_count.appendChild(tn_count);
ark_kibble_other_count.classList.add("kibble_ingr_count");
ark_kibble_other.append(ark_kibble_other_count, tn_other);
ark_kibble_ingredients.appendChild(ark_kibble_other);*/
addIngredient("ark_kibble_other", kibble_list[i].other[k][1], kibble_list[i].other[k][0], ark_kibble_ingredients);
}
};
//plants
for (let l = 0; l < kibble_list[i].plants.length; l++) {
/*let tn_plant = document.createTextNode(kibble_list[i].plants[l][0]);
let ark_kibble_plant = document.createElement("li");
ark_kibble_plant.classList.add("ark_kibble_plant");
let tn_count = document.createTextNode(kibble_list[i].plants[l][1]);
let ark_kibble_plant_count = document.createElement("span");
ark_kibble_plant_count.appendChild(tn_count);
ark_kibble_plant_count.classList.add("kibble_ingr_count");
ark_kibble_plant.append(ark_kibble_plant_count, tn_plant);
ark_kibble_ingredients.appendChild(ark_kibble_plant);*/
addIngredient("ark_kibble_plant", kibble_list[i].plants[l][1], kibble_list[i].plants[l][0], ark_kibble_ingredients);
}
//fiber
/*let tn_kibble_fiber = document.createTextNode("fiber");
let ark_kibble_fiber = document.createElement("li");
ark_kibble_fiber.classList.add("ark_kibble_fiber");
let tn_fiber_count = document.createTextNode(kibble_list[i].fiber);
let ark_kibble_fiber_count = document.createElement("span");
ark_kibble_fiber_count.appendChild(tn_fiber_count);
ark_kibble_fiber_count.classList.add("kibble_ingr_count");
ark_kibble_fiber.append(ark_kibble_fiber_count, tn_kibble_fiber);
ark_kibble_ingredients.append(ark_kibble_fiber);*/
addIngredient("ark_kibble_fiber", kibble_list[i].fiber, "fiber", ark_kibble_ingredients);
ark_kibble_row.append(ark_kibble_header, ark_kibble_ingredients);
//taming
if (kibble_list[i].taming != []) {
let ark_kibble_taming = document.createElement("ul");
ark_kibble_taming.classList.add("ark_kibble_taming");
let tn_tame_title = document.createTextNode("Used to tame:");
ark_kibble_taming.appendChild(tn_tame_title);
for (let k = 0; k < kibble_list[i].taming.length; k++) {
let tn_tame = document.createTextNode(kibble_list[i].taming[k]);
let ark_kibble_tame = document.createElement("li");
ark_kibble_tame.appendChild(tn_tame);
ark_kibble_taming.appendChild(ark_kibble_tame);
}
ark_kibble_row.appendChild(ark_kibble_taming);
}
document.getElementById("ark_kibble_table").append(ark_kibble_row);
}
}
function addIngredient(kibble_class, text_count, text_name, ark_kibble_ingredients) {
let ark_kibble_cont = document.createElement("li");
ark_kibble_cont.classList.add(kibble_class);
let tn_count = document.createTextNode(text_count);
let ark_kibble_count = document.createElement("div");
ark_kibble_count.appendChild(tn_count);
ark_kibble_count.classList.add("kibble_ingr_count");
let tn_name = document.createTextNode(text_name);
let ark_kibble_name = document.createElement("div");
ark_kibble_name.appendChild(tn_name);
ark_kibble_name.classList.add("kibble_ingr_name");
ark_kibble_cont.append(ark_kibble_count, ark_kibble_name);
ark_kibble_ingredients.appendChild(ark_kibble_cont);
}
function searchByKibble() {
document.getElementById('ark_kibbleSpecies_search').value = '';
let input = document.getElementById("ark_kibbleType_search");
let input_text = input.value.toUpperCase();
//ASK - should this be constant? Element.children is read-only but updates live
let kibble_boxes = document.getElementById("ark_kibble_table").children;
for (i = 0; i < kibble_boxes.length; i++) {
let kibble_box_title = kibble_boxes[i].getElementsByClassName("ark_kibble_name")[0];
//txtValue = a.textContent || a.innerText;
if (kibble_box_title.textContent.toUpperCase().indexOf(input_text) > -1) {
kibble_boxes[i].style.display = "";
} else {
kibble_boxes[i].style.display = "none";
}
}
}
function searchBySpecies() {
document.getElementById('ark_kibbleType_search').value = '';
let input = document.getElementById("ark_kibbleSpecies_search");
let input_text = input.value.toUpperCase();
//ASK - should this be constant? Element.children is read-only but updates live
let kibble_boxes = document.getElementById("ark_kibble_table").children;
let found_substring = false;
for (i = 0; i < kibble_boxes.length; i++) {
found_substring = false;
let kibble_box_tames = kibble_boxes[i].getElementsByClassName("ark_kibble_taming")[0];
let li = kibble_box_tames.getElementsByTagName("li");
for (let j = 0; j < li.length; j++) {
if (li[j].textContent.toUpperCase().indexOf(input_text) > -1) {
found_substring = true;
}
}
if (found_substring == true) {
kibble_boxes[i].style.display = "";
} else {
kibble_boxes[i].style.display = "none";
}
}
}
showKibble();
</script>
</body>
</html>