add patron badges for WPD

master
Aevann1 2022-08-25 19:29:31 +02:00
parent 5b5f663342
commit c8ed20cd9c
27 changed files with 13 additions and 10 deletions

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -17,6 +17,11 @@ class BadgeDef(Base):
def __repr__(self):
return f"<BadgeDef(id={self.id})>"
@property
@lazy
def path(self):
if 20 < self.id < 28: return f"/i/{SITE_NAME}/patron_badges/{self.id}.webp"
return f"/i/badges/{self.id}.webp"
class Badge(Base):
@ -76,7 +81,7 @@ class Badge(Base):
@property
@lazy
def path(self):
return f"/i/badges/{self.badge_id}.webp"
return self.badge.path
@property
@lazy

View File

@ -60,7 +60,7 @@
<label class="custom-control-label" for="{{badge.id}}"></label>
</div>
</td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="{{asset('images/badges/', badge.id|string+'.webp')}}" width=64.16 height=70></label></td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="{{badge.path}}" width=64.16></label></td>
<td>{{badge.name}}</td>
<td>{{badge.description}}</td>
</tr>

View File

@ -60,7 +60,7 @@
<label class="custom-control-label" for="{{badge.id}}"></label>
</div>
</td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="{{asset('images/badges/', badge.id|string+'.webp')}}" width=64.16 height=70></label></td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="{{badge.path}}" width=64.16></label></td>
<td>{{badge.name}}</td>
<td>{{badge.description}}</td>
</tr>

View File

@ -27,7 +27,7 @@
<tr>
<td>{{loop.index}}</td>
<td>{{badge.name}}</td>
<td><img alt="{{badge.name}}" loading="lazy" src="{{asset('images/badges/', badge.id|string+'.webp')}}" width=45.83 height=50>
<td><img alt="{{badge.name}}" loading="lazy" src="{{badge.path}}" width=45.83>
<td>{{badge.description}}</td>
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
<td class="badges-rarity-qty"><a href="/badge_owners/{{badge.id}}">{{ ct[0] }}</a></td>

View File

@ -14,7 +14,7 @@
<td>{{loop.index}}</td>
<td><a style="color:#{{u.namecolor}}" href="/@{{u.username}}"><img loading="lazy" src="{{u.profile_url}}" class="pp20"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}}"{% endif %}>{{u.username}}</span></a></td>
<td><img alt="2{{u.patron}}" loading="lazy" width=29.33 height=32 src="{{asset('images/badges/', '2'+u.patron|string+'.webp')}}"></td>
<td><img alt="2{{u.patron}}" loading="lazy" width=29.33 src="{{asset_siteimg('patron_badges/', '2'+u.patron|string+'.webp')}}"></td>
</tr>
{% endfor %}
</table>

View File

@ -30,15 +30,13 @@ set CACHE_VER = {
'js/userpage.js': 244,
'js/userpage_v.js': 245,
'js/lozad.js': 260,
'images/badges/': 1023,
}
-%}
{%- macro asset(name, file='') -%}
/assets/{{name}}{{file}}?v={{ CACHE_VER[name] }}
/assets/{{name}}{{file}}?v={{ CACHE_VER[name] }}
{%- endmacro -%}
{%- macro asset_siteimg(name) -%}
/i/{{SITE_NAME}}/{{name}}?v=3009
{%- macro asset_siteimg(name, file='') -%}
/i/{{SITE_NAME}}/{{name}}{{file}}?v=3009
{%- endmacro -%}