more hat shit

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-05 06:33:08 +02:00
parent 520adaade0
commit b3a56ca168
13 changed files with 28 additions and 21 deletions

View File

@ -80,7 +80,7 @@ socket.on('speak', function(json) {
document.getElementsByClassName('userlink')[0].classList.remove('d-none')
document.getElementsByClassName('avatar')[0].classList.remove('d-none')
document.getElementsByClassName('avatar-pic')[0].src = json['avatar']
if (json['hat']) document.getElementsByClassName('avatar-hat')[0].src = `/i/hats/${json['hat']}.webp?v=3`
if (json['hat']) document.getElementsByClassName('avatar-hat')[0].src = json['hat']} + '?v=3'
document.getElementsByClassName('userlink')[0].href = '/@' + json['username']
document.getElementsByClassName('userlink')[0].style.color = '#' + json['namecolor']
document.getElementsByClassName('time')[0].classList.remove('d-none')

View File

@ -49,7 +49,7 @@ function popclick(e) {
popover.getElementsByClassName('pop-banner')[0].src = author["bannerurl"]
popover.getElementsByClassName('pop-picture')[0].src = author["profile_url"]
if (author["hat"]) popover.getElementsByClassName('pop-hat')[0].src = `/i/hats/${author['hat']}.webp?v=3`
if (author["hat"]) popover.getElementsByClassName('pop-hat')[0].src = author['hat'] + '?v=3'
popover.getElementsByClassName('pop-username')[0].innerHTML = author["username"]
if (popover.getElementsByClassName('pop-bio').length > 0) {
popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"]

View File

@ -192,6 +192,13 @@ class User(Base):
def equipped_hat_ids(self):
return [x.hat_id for x in self.equipped_hats]
@property
@lazy
def equipped_hat(self):
if self.equipped_hats:
return random.choice(self.equipped_hats)
return None
@property
@lazy
def hat_active(self):
@ -199,10 +206,10 @@ class User(Base):
return ''
if self.is_cakeday:
return 'Cakeday.webp'
return '/i/hats/Cakeday.webp'
if self.equipped_hats:
return random.choice(self.equipped_hats)
if self.equipped_hat:
return f'/i/hats/{self.equipped_hat.name}.webp'
return ''
@ -214,8 +221,8 @@ class User(Base):
if self.is_cakeday:
return "I've spent another year rotting my brain with dramaposting, please ridicule me 🤓"
if self.equipped_hats:
return self.hat_active.name + ' - ' + self.hat_active.censored_description(v)
if self.equipped_hat:
return self.equipped_hat.name + ' - ' + self.equipped_hat.censored_description(v)
return ''
@ -693,7 +700,7 @@ class User(Base):
'url': self.url,
'id': self.id,
'profile_url': self.profile_url,
'hat': self.hat_active.name,
'hat': self.hat_active,
'bannerurl': self.banner_url,
'bio_html': self.bio_html_eager,
'coins': self.coins,

View File

@ -66,7 +66,7 @@ def speak(data, v):
data={
"avatar": v.profile_url,
"hat": v.hat_active.name,
"hat": v.hat_active,
"username": v.username,
"namecolor": v.namecolor,
"text": text,

View File

@ -169,7 +169,7 @@
<div class="profile-pic-20-wrapper">
<img src="{{m['avatar']}}" class="pp20 mr-1">
{% if m.get('hat') -%}
<img class="profile-pic-20-hat hat" loading="lazy" src="/i/hats/{{m['hat']}}?v=3">
<img class="profile-pic-20-hat hat" loading="lazy" src="{{m['hat']}}?v=3">
{%- endif %}
</div>
{% endif %}
@ -222,6 +222,6 @@
<script src="{{asset('js/lozad.js')}}"></script>
<script src="/assets/js/lite-youtube.js?v=4000"></script>
<script src="/chat.js?v=4003"></script>
<script src="/chat.js?v=4004"></script>
</body>

View File

@ -171,7 +171,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
{% if c.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{c.author.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip(v)}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="{{c.author.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip(v)}}">
{%- endif %}
</div>
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.name_color}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>

View File

@ -22,7 +22,7 @@
const profile_pic_hat = document.getElementById("profile-pic-35-hat");
function extra_actions(xhr) {
if(xhr.status == 200) {
profile_pic_hat.src = `/i/hats/${hat_name}.webp?v=3`
profile_pic_hat.src = `${hat_name}.webp?v=3`
profile_pic_hat.classList.remove('d-none')
}
}
@ -55,7 +55,7 @@
<tbody>
{% for hat, user in hats %}
<tr>
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=3" style="max-width:100%;height:auto"></td>
<td><img loading="lazy" alt="{{hat.name}}" src="{{hat.name}}.webp?v=3" style="max-width:100%;height:auto"></td>
<td>{{hat.name}}</td>
<td style="word-break:break-word">{{hat.censored_description(v)}}</td>
{% if SITE == 'rdrama.net' %}

View File

@ -207,7 +207,7 @@
<div class="profile-pic-35-wrapper">
<img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
{% if v.hat_active -%}
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat" loading="lazy" src="/i/hats/{{v.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip(v)}}">
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat" loading="lazy" src="{{v.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip(v)}}">
{% elif request.path == '/hats' %}
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat d-none" loading="lazy" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip(v)}}">
{%- endif %}

View File

@ -677,7 +677,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
{%- endif %}
</div>
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>

View File

@ -172,7 +172,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
{%- endif %}
</div>
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>

View File

@ -2,7 +2,7 @@
<div class="profile-pic-20-wrapper">
<img loading="lazy" src="{{user.profile_url}}" class="pp20">
{% if user.hat_active -%}
<img class="profile-pic-20-hat hat" loading="lazy" src="/i/hats/{{user.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{user.hat_tooltip(v)}}">
<img class="profile-pic-20-hat hat" loading="lazy" src="{{user.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{user.hat_tooltip(v)}}">
{%- endif %}
</div>
<span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span>

View File

@ -42,7 +42,7 @@
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-100-wrapper">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="/i/hats/{{u.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="{{u.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
{%- endif %}
</a>
</div>
@ -407,7 +407,7 @@
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-65-wrapper">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white border-2 border-white mb-2">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="/i/hats/{{u.hat_active.name}}.webp?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="{{u.hat_active}}?v=3" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
{%- endif %}
</a>
</div>

View File

@ -18,7 +18,7 @@ set CACHE_VER = {
'js/award_modal.js': 4000,
'js/bootstrap.js': 4000,
'js/category_modal.js': 4000,
'js/comments+submission_listing.js': 4001,
'js/comments+submission_listing.js': 4002,
'js/comments_admin.js': 4000,
'js/comments_v.js': 4000,
'js/submission_listing.js': 4000,