Compare commits

...

2 Commits

Author SHA1 Message Date
6ff1c40d3c Add action icons & rarity
All checks were successful
continuous-integration/drone/push Build is passing
2022-04-06 11:38:10 +02:00
266573ca52 Remove debugger statement 2022-04-06 11:28:06 +02:00
7 changed files with 33 additions and 4 deletions

BIN
public/imgs/free.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/imgs/one.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

BIN
public/imgs/reaction.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
public/imgs/three.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
public/imgs/two.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -16,7 +16,6 @@
}; };
if (window.location.hash !== "") { if (window.location.hash !== "") {
debugger;
cards = JSON.parse(LZString.decompressFromEncodedURIComponent(window.location.hash.substring(1))); cards = JSON.parse(LZString.decompressFromEncodedURIComponent(window.location.hash.substring(1)));
} else { } else {
cards = [{id: 0, ...mhp}]; cards = [{id: 0, ...mhp}];

View File

@ -1,6 +1,16 @@
<script lang="ts"> <script lang="ts">
import DOMPurify from 'dompurify'; import DOMPurify from 'dompurify';
export let name:string, type, tags = [], attributes:string, description:string; export let name:string, type, tags = [], attributes:string, description:string;
function pf_filter(text) {
// Actions
text = text.replace(/\(A\)/gi, '<img class="activity" src="/imgs/one.webp" alt="One action">')
.replace(/\(AA\)/gi, '<img class="activity" src="/imgs/two.webp" alt="Two actions">')
.replace(/\(AAA\)/gi, '<img class="activity" src="/imgs/three.webp" alt="Three action">')
.replace(/\(R\)/gi, '<img class="activity" src="/imgs/reaction.webp" alt="Reaction">')
.replace(/\(F\)/gi, '<img class="activity" src="/imgs/free.webp" alt="Free action">');
return text;
}
</script> </script>
<style> <style>
@ -39,6 +49,15 @@
padding: 0.5pt 1pt; padding: 0.5pt 1pt;
border: 1pt solid #d9c484; border: 1pt solid #d9c484;
} }
.uncommon {
background-color: #98513d;
}
.rare {
background-color: #002664;
}
.unique {
background-color: #54166e;
}
.content { .content {
margin: 1pt; margin: 1pt;
} }
@ -50,6 +69,9 @@
border-top: 1pt solid black; border-top: 1pt solid black;
text-align: justify; text-align: justify;
} }
:global(img.activity) {
max-height: 8pt;
}
</style> </style>
@ -60,15 +82,23 @@
</section> </section>
<section class="tags"> <section class="tags">
{#each tags as tag} {#each tags as tag}
{#if tag.toLowerCase() == "uncommon" }
<div class="tag uncommon">{tag}</div>
{:else if tag.toLowerCase() == "rare" }
<div class="tag rare">{tag}</div>
{:else if tag.toLowerCase() == "unique" }
<div class="tag unique">{tag}</div>
{:else}
<div class="tag">{tag}</div> <div class="tag">{tag}</div>
{/if}
{/each} {/each}
</section> </section>
<section class="content"> <section class="content">
<p class="attributes"> <p class="attributes">
{@html DOMPurify.sanitize(attributes)} {@html pf_filter(DOMPurify.sanitize(attributes))}
</p> </p>
<p class="description"> <p class="description">
{@html DOMPurify.sanitize(description)} {@html pf_filter(DOMPurify.sanitize(description))}
</p> </p>
</section> </section>
</div> </div>