forked from Valloric/statblock5e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-two-column-inlined.html
507 lines (464 loc) · 14.5 KB
/
demo-two-column-inlined.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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
<!DOCTYPE html>
<html><head><link href="https://fonts.googleapis.com/css?family=Libre+Baskerville:700" rel="stylesheet" type="text/css"/><link href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic,700italic" rel="stylesheet" type="text/css"/><meta charset="utf-8"/><title>Two-column statblock example</title><style>
body {
margin: 0;
}
stat-block {
/* A bit of margin for presentation purposes, to show off the drop
shadow. */
margin-left: 20px;
margin-top: 20px;
}
</style></head><body><template id="tapered-rule">
<style>
svg {
fill: #922610;
/* Stroke is necessary for good antialiasing in Chrome. */
stroke: #922610;
margin-top: 0.6em;
margin-bottom: 0.35em;
}
</style>
<svg height="5" width="400">
<polyline points="0,0 400,2.5 0,5"></polyline>
</svg>
</template><script>
(function(window, document) {
var elemName = 'tapered-rule';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="top-stats">
<style>
::content * {
color: #7A200D;
}
</style>
<tapered-rule></tapered-rule>
<content></content>
<tapered-rule></tapered-rule>
</template><script>
(function(window, document) {
var elemName = 'top-stats';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="creature-heading">
<style>
::content > h1 {
font-family: 'Libre Baskerville', 'Lora', 'Calisto MT',
'Bookman Old Style', Bookman, 'Goudy Old Style',
Garamond, 'Hoefler Text', 'Bitstream Charter',
Georgia, serif;
color: #7A200D;
font-weight: 700;
margin: 0px;
font-size: 23px;
letter-spacing: 1px;
font-variant: small-caps;
}
::content > h2 {
font-weight: normal;
font-style: italic;
font-size: 12px;
margin: 0;
}
</style>
<content select="h1"></content>
<content select="h2"></content>
</template><script>
(function(window, document) {
var elemName = 'creature-heading';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="abilities-block">
<style>
table {
width: 100%;
border: 0px;
border-collapse: collapse;
}
th, td {
width: 50px;
text-align: center;
}
</style>
<tapered-rule></tapered-rule>
<table>
<tbody><tr>
<th>STR</th>
<th>DEX</th>
<th>CON</th>
<th>INT</th>
<th>WIS</th>
<th>CHA</th>
</tr>
<tr>
<td id="str"></td>
<td id="dex"></td>
<td id="con"></td>
<td id="int"></td>
<td id="wis"></td>
<td id="cha"></td>
</tr>
</tbody></table>
<tapered-rule></tapered-rule>
</template><script>
(function(window, document) {
function abilityModifier(abilityScore) {
var score = parseInt(abilityScore, 10);
return Math.floor((score - 10) / 2);
}
function formattedModifier(abilityModifier) {
if (abilityModifier >= 0) {
return '+' + abilityModifier;
}
// This is an en dash, NOT a "normal" dash. The minus sign needs to be more
// visible.
return '–' + Math.abs(abilityModifier);
}
function abilityText(abilityScore) {
return [String(abilityScore),
' (',
formattedModifier(abilityModifier(abilityScore)),
')'].join('');
}
var elemName = 'abilities-block';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
var root = this.createShadowRoot().appendChild(clone);
}
},
attachedCallback: {
value: function() {
var root = this.shadowRoot;
for (var i = 0; i < this.attributes.length; i++) {
var attribute = this.attributes[i];
var abilityShortName = attribute.name.split('-')[1];
root.getElementById(abilityShortName).textContent =
abilityText(attribute.value);
}
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="property-line">
<style>
:host {
line-height: 1.4;
display: block;
text-indent: -1em;
padding-left: 1em;
}
::content > h4 {
margin: 0;
display: inline;
font-weight: bold;
}
::content > p:first-of-type {
display: inline;
text-indent: 0;
}
::content > p {
text-indent: 1em;
margin: 0;
}
</style>
<content></content>
</template><script>
(function(window, document) {
var elemName = 'property-line';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="property-block">
<style>
:host {
margin-top: 0.3em;
margin-bottom: 0.9em;
line-height: 1.5;
display: block;
}
::content > h4 {
margin: 0;
display: inline;
font-weight: bold;
font-style: italic;
}
::content > p:first-of-type {
display: inline;
text-indent: 0;
}
::content > p {
text-indent: 1em;
margin: 0;
}
</style>
<content></content>
</template><script>
(function(window, document) {
var elemName = 'property-block';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script><template id="stat-block">
<style>
.bar {
height: 5px;
background: #E69A28;
border: 1px solid #000;
position: relative;
z-index: 1;
}
:host {
display: inline-block;
}
#content-wrap {
font-family: 'Noto Sans', 'Myriad Pro', Calibri, Helvetica, Arial,
sans-serif;
font-size: 13.5px;
background: #FDF1DC;
padding: 0.6em;
padding-bottom: 0.5em;
border: 1px #DDD solid;
box-shadow: 0 0 1.5em #867453;
/* We don't want the box-shadow in front of the bar divs. */
position: relative;
z-index: 0;
/* Leaving room for the two bars to protrude outwards */
margin-left: 2px;
margin-right: 2px;
/* This is possibly overriden by next CSS rule. */
width: 400px;
-webkit-columns: 400px;
-moz-columns: 400px;
columns: 400px;
-webkit-column-gap: 40px;
-moz-column-gap: 40px;
column-gap: 40px;
/* When height is constrained, we want sequential filling of columns. */
-webkit-column-fill: auto;
-moz-column-fill: auto;
column-fill: auto;
}
:host([data-two-column]) #content-wrap {
/* One column is 400px and the gap between them is 40px. */
width: 840px;
}
::content > h3 {
border-bottom: 1px solid #7A200D;
color: #7A200D;
font-size: 21px;
font-variant: small-caps;
font-weight: normal;
letter-spacing: 1px;
margin: 0;
margin-bottom: 0.3em;
break-inside: avoid-column;
break-after: avoid-column;
}
/* For user-level p elems. */
::content > p {
margin-top: 0.3em;
margin-bottom: 0.9em;
line-height: 1.5;
}
/* Last child shouldn't have bottom margin, too much white space. */
::content > *:last-child {
margin-bottom: 0;
}
</style>
<div class="bar"></div>
<div id="content-wrap">
<content></content>
</div>
<div class="bar"></div>
</template><script>
(function(window, document) {
var elemName = 'stat-block';
var thatDoc = document;
var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
var template = thisDoc.getElementById(elemName);
// If the attr() CSS3 function were properly implemented, we wouldn't
// need this hack...
if (this.hasAttribute('data-content-height')) {
var wrap = template.content.getElementById('content-wrap');
wrap.style.height = this.getAttribute('data-content-height') + 'px';
}
var clone = thatDoc.importNode(template.content, true);
this.createShadowRoot().appendChild(clone);
}
}
});
thatDoc.registerElement(elemName, {prototype: proto});
})(window, document);
</script>
<stat-block data-content-height="672" data-two-column="">
<creature-heading>
<h1>Werewolf Alpha</h1>
<h2>Medium humanoid (human, shapechanger), chaotic evil</h2>
</creature-heading>
<top-stats>
<property-line>
<h4>Armor Class</h4>
<p>14 (armor scraps) in humanoid form, 16 (natural armor) in wolf
or hybrid form</p>
</property-line>
<property-line>
<h4>Hit Points</h4>
<p>119 (14d8 + 56)</p>
</property-line>
<property-line>
<h4>Speed</h4>
<p>30 ft. (40 ft. in wolf form)</p>
</property-line>
<abilities-block data-cha="15" data-con="18" data-dex="15" data-int="11" data-str="20" data-wis="14"></abilities-block>
<property-line>
<h4>Saving Throws</h4>
<p>Str +9, Con +8, Wis +6</p>
</property-line>
<property-line>
<h4>Skills</h4>
<p>Athletics +9, Perception +6</p>
</property-line>
<property-line>
<h4>Damage Immunities</h4>
<p>bludgeoning, piercing, and slashing damage from nonmagical weapons
that aren't silvered</p>
</property-line>
<property-line>
<h4>Senses</h4>
<p>passive Perception 16</p>
</property-line>
<property-line>
<h4>Languages</h4>
<p>Common (can't speak in wolf form)</p>
</property-line>
<property-line>
<h4>Challenge</h4>
<p>9 (5,000 XP)</p>
</property-line>
</top-stats>
<property-block>
<h4>Legendary Resistance (3/Day).</h4>
<p>If the werewolf fails a saving throw, it can choose to succeed
instead.</p>
</property-block>
<property-block>
<h4>Keen Hearing and Smell.</h4>
<p>The werewolf has advantage on Wisdom (Perception) checks that rely on
hearing or smell.</p>
</property-block>
<property-block>
<h4>Pack Leader.</h4>
<p>The werewolf's allies have advantage on melee attack rolls against
any hostile creature within 5 feet of the werewolf.</p>
</property-block>
<property-block>
<h4>Shapechanger.</h4>
<p>The werewolf can use its action to polymorph into a wolf-humanoid
hybrid or into a wolf, or back into its true form, which is humanoid.
Its statistics, other than its AC, are the same in each form. Any
equipment it is wearing or carrying isn't transformed. It reverts to
its true form if it dies.</p>
</property-block>
<h3>Actions</h3>
<property-block>
<h4>Multiattack (Hybrid Form Only).</h4>
<p>The werewolf makes three attacks: one with its bite and two with its
claws.</p>
</property-block>
<property-block>
<h4>Bite (Wolf or Hybrid Form Only).</h4>
<p><i>Melee Weapon Attack:</i> +9 to hit, reach 5 ft., one target.
<i>Hit:</i> 14 (2d8 + 5) piercing damage. If the target is a humanoid,
it must succeed on a DC 14 Constitution saving throw or be cursed with
werewolf lycanthropy.</p>
</property-block>
<property-block>
<h4>Claws (Hybrid Form Only).</h4>
<p><i>Melee Weapon Attack:</i> +9 to hit, reach 5 ft., one target.
<i>Hit:</i> 16 (2d10 + 5) slashing damage.</p>
</property-block>
<h3>Legendary Actions</h3>
<p>The werewolf can take 3 legendary actions, choosing from the
options below. Only one legendary action option can be used at a
time and only at the end of another creature's turn. The werewolf
regains spent legendary actions at the start of its turn.</p>
<property-line>
<h4>Leap.</h4>
<p>The werewolf moves up to its speed without provoking
opportunity attacks.</p>
</property-line>
<property-line>
<h4>Bark Orders.</h4>
<p>The werewolf chooses a friendly creature who can
see or hear it. That creature can use its reaction to move up to its
speed without provoking opportunity attacks.</p>
</property-line>
<property-line>
<h4>Frenzy (Costs 2 Actions).</h4>
<p>The werewolf can make one claw attack against each creature within 5
feet of it.</p>
</property-line>
</stat-block></body></html>