forked from NiHoel/Anno1800Calculator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
363 lines (322 loc) · 21.8 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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Sauerbraten95">
<title>Anno 1800 Calculator</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css" />
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script type="text/javascript" src="AnnoCalculator.js"></script>
<script type="text/javascript" src="params_2019-05-09_full.js"></script>
</head>
<body>
<!-- #params-dialog -->
<div id="params-dialog" class="modal fade" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>Enter parameters</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<textarea class="form-control" rows="5" id="input-params"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<!-- /#params-dialog -->
<!-- #settings-dialog -->
<div id="settings-dialog" class="modal fade" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 data-bind="text: texts.settings.name">Settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form>
<div data-bind="foreach: settings.options">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" data-bind="checked: $data.checked, attr: { id: $data.id }">
<label class="custom-control-label" data-bind="text: $data.name, attr: { for: $data.id }"></label>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" data-bind="text: texts.language.name">Language</span>
</div>
<select name="language" class="custom-select" id="language" data-bind="value: settings.language, options:settings.languages"></select>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- #/settings-dialog -->
<!-- #help-dialog -->
<div id="help-dialog" class="modal fade" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 data-bind="text: texts.help.name">Settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<pre data-bind="text: texts.helpContent.name" style="white-space:pre-wrap"></pre>
</div>
</div>
</div>
</div>
<!-- /#help-dialog -->
<!-- #factory-choose-dialog -->
<div id="factory-choose-dialog" class="modal fade" role="dialog" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 data-bind="text: $root.texts.chooseFactories.name">Choose Factory for each Product</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form>
<div data-bind="foreach: view.multiFactoryProducts">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
<img src="" width="25" height="25" data-bind="attr: { src: $data.icon ? icon : null, alt: name }">
</span>
<span class="input-group-text" data-bind="text: name"></span>
</div>
<select class="custom-select" data-bind="value: $data.fixedFactory, options: $data.factories, optionsText: f => f.getRegionExtendedName(), optionsCaption: $root.texts.noFixedFactory.name()"></select>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- #/factory-choose-dialog -->
<div id="content" data-bind="visible: true" style="display:none">
<div class="fixed-top" style="padding-right: 17px;">
<div class="btn-group float-right">
<button data-toggle="modal" data-target="#settings-dialog" class="btn btn-secondary">
<span class="fa fa-cog"> </span>
</button>
<button data-toggle="modal" data-target="#factory-choose-dialog" class="btn btn-secondary">
<span class="fa fa-cogs"> </span>
</button>
<button data-toggle="modal" data-target="#help-dialog" class="btn btn-secondary">
<span class="fa fa-question-circle-o"> </span>
</button>
<a role="button" href="https://github.com/NiHoel/Anno1800Calculator/archive/v1.2.zip" class="btn btn-secondary">
<span class="fa fa-download"> </span>
</a>
</div>
</div>
<fieldset class="ui-fieldset" id="inhabitants-view">
<legend data-bind="text:texts.inhabitants.name">Inhabitants</legend>
<div style="display:flex;align-items:center;justify-content:space-between;">
<div class="ui-race-input fleft">
<!-- <div class="ui-race-icon">
<img src="/img/icons/gui_icon_map_0-17-10.png" alt="Old World" width="46" height="46">
</div> -->
<div data-bind="foreach: populationLevels">
<div class="ui-race-unit">
<div class="ui-race-unit-icon"><img src="" data-bind="attr: { src: $data.icon ? icon : null, alt: name }"></div>
<div class="ui-race-unit-name" data-bind="text: name, visible: !$root.settings.hideNames.checked()"></div>
<div class="input text">
<div class="input-group spinner mb-3">
<input step="100" class="form-control input-lg" type="number" value="0" data-bind="value: amount, attr: {title: 'Press '+name()[0]+' to focus' }" />
</div>
</div>
</div>
</div>
</div>
<btn class="btn btn-light float-right align-middle" onclick="reset()">Reset</btn>
</div>
</fieldset>
<fieldset class="ui-fieldset" id="workforce-view">
<legend class="collapser" data-toggle="collapse" data-target="#workforce">
<span class="fa fa-chevron-right"></span>
<span class="fa fa-chevron-down"></span>
<span data-bind="text:texts.workforce.name"></span>
</legend>
<div id="workforce" class="collapse show">
<div class="ui-race-input fleft">
<!-- <div class="ui-race-icon">
<img src="/img/icons/gui_icon_map_0-17-10.png" alt="Old World" width="46" height="46">
</div> -->
<div data-bind="foreach: workforce">
<div class="ui-race-unit">
<div class="ui-race-unit-icon"><img data-bind="attr: { src: $data.icon ? icon : null, alt: name }"></div>
<!--<div class="ui-race-unit-name" data-bind="text: name"></div>-->
<div class="ui-fchain-item-count">
<span data-bind="text: amount"></span>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</fieldset>
<div data-bind="foreach: categories">
<fieldset class="ui-fieldset" id="categories-view">
<legend class="collapser" data-toggle="collapse" data-bind="attr: {'data-target' : '#' + removeSpaces(name)}">
<span class="fa fa-chevron-right"></span>
<span class="fa fa-chevron-down"></span>
<span data-bind="text:name"></span>
</legend>
<div class="ui-fchain collapse show" data-bind="attr: {id: removeSpaces(name)}">
<div data-bind="foreach: products">
<div data-bind="foreach: factories">
<div>
<div class="ui-fchain-item" data-bind="visible: amount() > 0 || $data.editable && (!$root.settings.hideNewWorldConstructionMaterial.checked() || $data.region.guid === 5000000), css: $root.settings.missingBuildingsHighlight.checked() && !$data.editable && buildings() > existingBuildings() ? 'danger' : ''">
<div class="ui-fchain-item-name" data-bind="text: $data.getRegionExtendedName(), visible: !$root.settings.hideNames.checked()"></div>
<div class="ui-fchain-item-icon"><img src="" data-bind="attr: { src: $data.icon ? icon : null, alt: name }"></div>
<div class="ui-fchain-item-count">
<div href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.productionBoost.name}, visible: !$root.settings.hideProductionBoost.checked()">
<div class="input-group mb-3 spinner">
<input class="form-control" type="text" value="100" data-bind="value: percentBoost" />
<div class="input-group-append">
<div class="input-group-btn-vertical">
<button class="btn btn-default" type="button" data-bind="click: incrementPercentBoost"><i class="fa fa-caret-up"></i></button>
<button class="btn btn-default" type="button" data-bind="click: decrementPercentBoost, enable: parseInt(percentBoost()) > 1"><i class="fa fa-caret-down"></i></button>
</div>
<span class="input-group-text">%</span>
</div>
</div>
</div>
</div>
<div class="ui-fchain-item-count" data-bind="if: !$data.editable">
<div href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.requiredNumberOfBuildings.name}">
<span data-bind="text: $root.settings.decimalsForBuildings.checked() ? buildings().toFixed(2) : Math.ceil(buildings())"></span>
<span>x</span>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary" data-bind="click: () => incrementBuildings(), enable: buildings() > 0" style="padding: 0em 0.25em 0em 0.25em; font-size: unset;">+</button>
<button type="button" class="btn btn-secondary" data-bind="click: () => decrementBuildings(), enable: buildings() >= 1.01" style="padding: 0em 0.25em 0em 0.25em; font-size: unset;">-</button>
</div>
</div>
</div>
<div class="ui-fchain-item-count" data-bind="if: $data.editable">
<div href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.requiredNumberOfBuildings.name}">
<div class="input-group mb-3 spinner">
<input class="form-control" type="text" value="0" step="1" data-bind="value: buildings" />
<div class="input-group-append">
<div class="input-group-btn-vertical">
<button class="btn btn-default" type="button" data-bind="click: buildings(parseInt(buildings()) + 1)"><i class="fa fa-caret-up"></i></button>
<button class="btn btn-default" type="button" data-bind="click: buildings(parseInt(buildings()) - 1), enable: buildings() > 0"><i class="fa fa-caret-down"></i></button>
</div>
<span class="input-group-text">x</span>
</div>
</div>
</div>
</div>
<div class="ui-fchain-item-count" data-bind="if: !$data.editable && $root.settings.missingBuildingsHighlight.checked()">
<div href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.existingNumberOfBuildings.name}">
<span data-bind="text: $root.texts.existingNumberOfBuildingsIs.name"></span>
<span data-bind="text: existingBuildings()"></span>
<span>x</span>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary" data-bind="click: () => existingBuildings(parseInt(existingBuildings() + 1))" style="padding: 0em 0.25em 0em 0.25em; font-size: unset;">+</button>
<button type="button" class="btn btn-secondary" data-bind="click: () => existingBuildings(parseInt(existingBuildings() - 1)), enable: existingBuildings() >= 1" style="padding: 0em 0.25em 0em 0.25em; font-size: unset;">-</button>
</div>
</div>
</div>
<div href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.tonsPerMinute.name}">
<div class="ui-fchain-item-load"><span data-bind="text: parseFloat(amount()).toFixed(2)"></span><span> t/min</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</fieldset>
</div>
<div data-bind="foreach: populationLevels">
<fieldset class="ui-fieldset" id="consumption-view" data-bind="visible: amount">
<legend class="collapser" data-toggle="collapse" data-bind="attr: {'data-target' : '#consumption-' + removeSpaces(name)}">
<span class="fa fa-chevron-right"></span>
<span class="fa fa-chevron-down"></span>
<span data-bind="text:name"></span>
</legend>
<div class="collapse show" data-bind="foreach: needs, attr:{id: 'consumption-' + removeSpaces(name)}">
<div class="ui-fchain" data-bind="visible: optionalAmount, css:{inactive: banned}">
<div class="d-flex flex-wrap align-content-start" data-bind="foreach: allDemands">
<div class="ui-fchain-spacer" data-bind="visible: !($data instanceof Need) && amount">
←
</div>
<div class="ui-fchain-item" data-bind="visible: ($data instanceof Need) || amount || ($data instanceof Need)">
<div class="float-right" data-bind="if: ($data instanceof Need)">
<input type="checkbox" data-bind="checked: $data.checked">
</div>
<div class="ui-fchain-item-name" data-bind="text: product.name, visible: !$root.settings.hideNames.checked()"></div>
<div class="ui-fchain-item-icon"><img src="" data-bind="attr: { src: $data.product.icon ? product.icon : null, alt: product.name }"></div>
<div class="ui-fchain-item-count">
<span href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.requiredNumberOfBuildings.name}">
<span data-bind="text: $root.settings.decimalsForBuildings.checked() ? parseFloat(buildings()).toFixed(2) : Math.ceil(buildings())"></span>
<span>x</span>
</span>
</div>
<div class="ui-fchain-item-load">
<span href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.tonsPerMinute.name}">
<span data-bind="text: parseFloat(amount()).toFixed(2)"></span><span> t/min</span>
</span>
</div>
<!--<div class="ui-fchain-item-loadbar"><div style="background-color:red; width:4px;"><img src="/img/pixel.gif" width="1" height="6"></div></div>-->
</div>
</div>
</div>
<div class="clear"></div>
</div>
</fieldset>
</div>
<fieldset class="ui-fieldset" id="construction-material-view">
<legend class="collapser" data-toggle="collapse" data-target="#building-materials-chains">
<span class="fa fa-chevron-right"></span>
<span class="fa fa-chevron-down"></span>
<span data-bind="text: categories[1].name"></span>
</legend>
<div class="collapse show" data-bind="foreach: buildingMaterialsNeeds" id="building-materials-chains">
<div class="ui-fchain" data-bind="visible: amount">
<div data-bind="foreach: allDemands">
<div class="ui-fchain-spacer" data-bind="visible: !($data instanceof Need)">
←
</div>
<div class="ui-fchain-item" data-bind="visible: amount">
<div class="ui-fchain-item-name" data-bind="text: product.name, visible: !$root.settings.hideNames.checked()"></div>
<div class="ui-fchain-item-icon"><img src="" data-bind="attr: { src: $data.product.icon ? product.icon : null, alt: product.name }"></div>
<div class="ui-fchain-item-count">
<span href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.requiredNumberOfBuildings.name}">
<span data-bind="text: $root.settings.decimalsForBuildings.checked() ? parseFloat(buildings()).toFixed(2) : Math.ceil(buildings())"></span>
<span>x</span>
</span>
</div>
<div class="ui-fchain-item-load">
<span href="#" data-toggle="tooltip" data-bind="attr: {'title' : $root.texts.tonsPerMinute.name}">
<span data-bind="text: parseFloat(amount()).toFixed(2)"></span><span> t/min</span>
</span>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</fieldset>
</div>
</body>
</html>