Files
lair.moe/blueprints/risdeveau/templates/steam.htm
T

126 lines
4.0 KiB
HTML
Raw Normal View History

2026-02-10 10:27:45 +03:00
{% if request.headers.get('hx-request') != "true" %}
<div x-data='{ "current": null, "total_mode": "T" }' class="mt-1">
{% endif %}
2026-02-05 14:20:03 +03:00
<div
class="block steam"
hx-get="/m/steam"
hx-trigger="every 1m"
hx-swap="outerHTML"
2026-02-06 18:52:55 +03:00
hx-headers='{
2026-02-06 23:24:41 +03:00
"If-Modified-Since": {{ steam.last_updated | int }},
"If-None-Match": "{{ steam.etag }}"
2026-02-06 18:52:55 +03:00
}'
2026-02-05 14:20:03 +03:00
>
2026-02-04 00:34:16 +03:00
<h2><a href="https://steamcommunity.com/id/risdeveau">Steam</a></h2>
2026-02-10 10:27:45 +03:00
{{ steam.caches.recent.status }}
{{ steam.caches.owned.status }}
2026-02-06 23:24:41 +03:00
{% if steam.caches.recent.data.games %}
2026-02-04 00:34:16 +03:00
<h3>Recently played:</h3>
2026-02-10 10:27:45 +03:00
{% for g in steam.caches.recent.data.games.values() %}
<div href="https://store.steampowered.com/app/{{ g.appid }}" class="block">
2026-02-04 00:34:16 +03:00
<picture>
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
<img src="{{ g.h_cover }}">
</picture>
<div>
<strong>{{ g.name }}</strong>
<p>Played last 2 weeks: {{ tmsmp(g.playtime_2weeks*60) }}
2026-02-10 10:27:45 +03:00
<div>
<p
x-data='{ playtime: { L: "{{ tmsmp(g.playtime_linux_forever*60) }}", W: "{{ tmsmp(g.playtime_windows_forever*60) }}", T: "{{ tmsmp(g.playtime_forever*60) }}" }}'
x-text="`Total played: ${playtime[total_mode]}`"
>
</p>
<div>
<button @click="total_mode = 'L'" :class="total_mode == 'L' && 't-green'">L</button>
<button @click="total_mode = 'W'" :class="total_mode == 'W' && 't-green'">W</button>
<button @click="total_mode = 'T'" :class="total_mode == 'T' && 't-green'">T</button>
</div>
</div>
{% if steam.caches.owned.data.games %}
{% if steam.caches.owned.data.games[g.appid] %}
<p
x-data="steam_rtime({{ steam.caches.owned.data.games[g.appid].rtime_last_played }})"
x-text="`Last played: ${timeString}`"
:class="textColorClass"
></p>
{% else %}
<p class="t-red">Last played: Unknown</p>
{% endif %}
{% endif %}
2026-02-04 00:34:16 +03:00
</div>
2026-02-10 10:27:45 +03:00
</div>
2026-02-04 00:34:16 +03:00
{% endfor %}
2026-02-07 16:53:40 +03:00
<p
x-data="rtime({{steam.caches.recent.last_updated}})"
x-text="`Last updated: ${timeString}`"
></p>
2026-02-04 00:34:16 +03:00
{% endif %}
2026-02-06 23:24:41 +03:00
{% if steam.caches.owned.data.games %}
2026-02-04 00:34:16 +03:00
<h3>Top played games:</h3>
2026-02-10 10:27:45 +03:00
{% set owned_games = steam.caches.owned.data.games.values() | sort(attribute="playtime_forever", reverse=true) %}
2026-02-04 00:34:16 +03:00
{% for g in owned_games[:5] %}
2026-02-10 10:27:45 +03:00
<div
@click='current == {{ g.appid }} ? current = null : current = {{ g.appid }}'
href="https://store.steampowered.com/app/{{ g.appid }}"
class="block"
>
2026-02-04 00:34:16 +03:00
<picture>
<source media="(max-width: 45rem)" srcset="{{ g.v_cover }}">
<img src="{{ g.h_cover }}">
</picture>
<div>
<strong>{{ g.name }}</strong>
<p>
Total played:
{{ tmsmp(g.playtime_linux_forever*60) }} (<abbr title="On Linux">L</abbr>) +
{{ tmsmp(g.playtime_windows_forever*60) }} (<abbr title="On Windows">W</abbr>) =
{{ tmsmp(g.playtime_forever*60) }} (<abbr title="Total">T</abbr>)
</p>
{% if g.rtime_last_played != 0 %}
2026-02-07 20:05:29 +03:00
<p
x-data="steam_rtime({{ g.rtime_last_played }})"
x-text="`Last played: ${timeString}`"
:class="textColorClass"
></p>
2026-02-04 00:34:16 +03:00
{% endif %}
</div>
2026-02-10 10:27:45 +03:00
</div>
<div
class="block popup"
x-show="current == {{ g.appid }}"
x-transition:enter-start="off"
x-transition:leave-end="off"
>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
<p>Some info</p>
</div>
2026-02-04 00:34:16 +03:00
{% endfor %}
2026-02-07 16:53:40 +03:00
<p
x-data="rtime({{steam.caches.owned.last_updated}})"
x-text="`Last updated: ${timeString}`"
></p>
2026-02-04 00:34:16 +03:00
{% endif %}
2026-02-10 10:27:45 +03:00
2026-02-04 00:34:16 +03:00
</div>
2026-02-10 10:27:45 +03:00
{% if request.headers.get('hx-request') != "true" %}
</div>
{% endif %}