cpred/_includes/character-profile.html
Florian Weber c518cbf550
All checks were successful
Deploy Jekyll site to Pages / build (push) Successful in 5m31s
Enhance character profile integration with dynamic data fetching and role identification
2025-03-20 13:18:39 +01:00

19 lines
1.1 KiB
HTML

<div class="cyber-tile cyber-tile-big {{ include.bg_color }} {{ include.fg_color }} {{ include.class }}" style="min-height: auto;">
{% if include.image %}<img src="{{ include.image | relative_url }}" alt="Character Picture">{% endif %}
<p><span class="cyberpunk-font">Name:</span>&nbsp;&nbsp;<span id="name"></span></p>
<p><span class="cyberpunk-font">Handle:</span>&nbsp;&nbsp;<span id="streetname"></span></p>
<p><span class="cyberpunk-font">Role:</span>&nbsp;&nbsp;<span id="role"></span></p>
<p><span class="cyberpunk-font">Age:</span>&nbsp;&nbsp;<span id="age"></span></p>
</div>
<script>
fetch("{{ include.datasource | relative_url }}")
.then(response => response.json())
.then(character => {
document.getElementById('name').innerText = character.name;
document.getElementById('streetname').innerText = character.handle;
document.getElementById('age').innerText = character.age;
const mainRole = character.roles.find(role => role.main);
document.getElementById('role').innerText = mainRole.name + " Rang: " + mainRole.rank;
});
</script>