-
Notifications
You must be signed in to change notification settings - Fork 398
/
index.html
232 lines (190 loc) · 7.23 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
---
layout: page
title: Store
---
<link rel="stylesheet" href="{{- 'assets/css/core.css' | relative_url -}} "/>
<script src="{{- 'assets/js/tabs.js' | relative_url -}}"></script>
<script src="{{- 'assets/js/filter.js' | relative_url -}}"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
{%- assign itemsForDisplay = '' | split: ',' -%}
{%- assign eventsForDisplay = site.data.StoreIncidents.incitems | where_exp: "incident", "incident.price > 0" | sort: "abr" -%}
{%- assign animalsForDisplay = site.data.StoreItems.items | where: "category", "Animal" | where_exp: "animal", "animal.price > 0" | sort: "abr" -%}
{%- assign traitsForDisplay = '' | split: ',' -%}
{%- assign kindsForDisplay = site.data.ShopExt.races | where: "enabled", "true" | sort: "name" -%}
{%- assign weaponsForDisplay = '' | split: ',' -%}
{%- for item in site.data.StoreItems.items -%}
{%- if item.price <= 0 -%}
{%- continue -%}
{%- endif -%}
{%- if site.data.itemdata[item.defname].IsWeapon -%}
{%- assign weaponsForDisplay = weaponsForDisplay | push: item | sort: "abr" -%}
{%- continue -%}
{%- endif -%}
{%- if item.category == "Animals" -%}
{%- assign animalsForDisplay = animalsForDisplay | push: item | sort: "abr" -%}
{%- continue -%}
{%- endif -%}
{%- if item.category != "Animal" -%}
{%- assign itemsForDisplay = itemsForDisplay | push: item | sort: "abr" -%}
{%- continue -%}
{%- endif -%}
{%- endfor -%}
{%- for trait in site.data.ShopExt.traits -%}
{%- if trait.canAdd == true or trait.canRemove == true -%}
{%- assign traitsForDisplay = traitsForDisplay | push: trait | sort: "name" -%}
{%- endif -%}
{%- endfor -%}
{%- assign buy = "" -%}
{%- for command in site.data.commands -%}
{%- if command.data.isBuy == true -%}
{%- capture buy -%}
{{- command.usage | split: " " | first -}}
{%- endcapture -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
<div class="tab">
{%- if itemsForDisplay.size > 0 -%}
{%- include tab.html id='items' -%}
{%- endif -%}
{%- if eventsForDisplay.size > 0 -%}
{%- include tab.html id='events' -%}
{%- endif -%}
{%- if weaponsForDisplay.size > 0 -%}
{%- include tab.html id='weapons' -%}
{%- endif -%}
{%- if animalsForDisplay.size > 0 -%}
{%- include tab.html id='animals' -%}
{%- endif -%}
{%- if traitsForDisplay.size > 0 -%}
{%- include tab.html id='traits' -%}
{%- endif -%}
{%- if kindsForDisplay.size > 0 -%}
{%- include tab.html id='kinds' -%}
{%- endif -%}
</div>
{%- if itemsForDisplay.size > 0 -%}
{%- assign headers = '' | split: ',' -%}
{%- assign headers = headers | push: site.data.language.name_header -%}
{%- assign headers = headers | push: site.data.language.cost_header -%}
{%- if site.store.items.category -%}
{%- assign headers = headers | push: site.data.language.category_header -%}
{%- endif -%}
{%- assign headers = headers | join: ',' -%}
{%- include store_tab.html
id='items'
type='Item'
buyName=buy
headers=headers
priceDataHeaders='Cost'
displayData=itemsForDisplay
placeholder=site.data.language.search_items -%}
{%- endif -%}
{%- if eventsForDisplay.size > 0 -%}
{% capture headers %}
{{ site.data.language.name_header }},{{ site.data.language.cost_header }},{{ site.data.language.karma_type_header }}
{% endcapture %}
{%- include store_tab.html
id='events'
type='Event'
buyName=buy
headers=headers
karmaHeaders=site.data.language.karma_type_header
displayData=eventsForDisplay
placeholder=site.data.language.search_events -%}
{%- endif -%}
{%- if weaponsForDisplay.size > 0 -%}
{% capture headers %}
{{ site.data.language.name_header }},{{ site.data.language.cost_header }}
{% endcapture %}
{%- include store_tab.html
id='weapons'
type='Weapon'
buyName=buy
headers=headers
priceDataHeaders=site.data.language.cost_header
displayData=weaponsForDisplay
placeholder=site.data.language.search_weapons -%}
{%- endif -%}
{%- if animalsForDisplay.size > 0 -%}
{% capture headers %}
{{ site.data.language.name_header }},{{ site.data.language.cost_header }}
{% endcapture %}
{%- include store_tab.html
id='animals'
type='Animal'
buyName=buy
headers=headers
priceDataHeaders=site.data.language.cost_header
displayData=animalsForDisplay
placeholder=site.data.language.search_animals -%}
{%- endif -%}
{%- if traitsForDisplay.size > 0 -%}
{%- assign headers = site.data.language.name_header | split: ',' -%}
{%- if site.store.traits.description or site.store.traits.conflicts or site.store.traits.stats or site.store.traits.limit -%}
{%- assign headers = headers | push: site.data.language.description_header -%}
{%- endif -%}
{%- assign headers = headers | push: site.data.language.add_cost_header -%}
{%- assign headers = headers | push: site.data.language.remove_cost_header -%}
{%- assign headers = headers | join: ',' -%}
{% capture priceDataHeaders %}
{{ site.data.language.add_cost_header }},{{ site.data.language.remove_cost_header }}
{% endcapture %}
{%- include store_tab.html
id='traits'
type='Trait'
buyName=buyName
priceDataHeaders=priceDataHeaders
headers=headers
displayData=traitsForDisplay
placeholder=site.data.language.search_traits -%}
{%- endif -%}
{%- if kindsForDisplay.size > 0 -%}
{% capture headers %}
{{ site.data.language.name_header }},{{ site.data.language.cost_header }}
{% endcapture %}
{%- include store_tab.html
id='kinds'
type='Pawn'
buyName=buyName
priceDataHeaders=site.data.language.price_header
headers=headers
displayData=kindsForDisplay
placeholder=site.data.language.search_pawn_kinds -%}
{%- endif -%}
<script>
window.addEventListener("load", function (event) {
var query = "";
var queryStarted = false;
var tab = "items";
var url = document.URL;
for (var i = 0; i < url.length; i++) {
var e = url[i];
if (e == "?") {
queryStarted = true;
continue;
}
if (e == "#" || e == "/") {
queryStarted = false;
continue;
}
if (queryStarted) {
query = query + e;
}
}
if (query.length <= 0) {
return document.getElementsByClassName("tabLinks")[0].click();
}
var segments = query.split("&");
for (var i = 0; i < segments.length; i++) {
var e = segments[i].split('=');
if (e[1] == null || e[1] == "") {
continue;
}
if (e[0].toUpperCase() == "TAB") {
return changeTab({ currentTarget: document.getElementById(e[1]) }, e[1])
}
}
return document.getElementsByClassName("tabLinks")[0].click();
});
</script>