add hats to chat (Part II)

master
Aevann1 2022-09-05 05:14:03 +02:00
parent 093ed82fb8
commit 2636ae62c2
2 changed files with 10 additions and 4 deletions

View File

@ -79,7 +79,8 @@ socket.on('speak', function(json) {
document.getElementsByClassName('chat-line')[0].classList.add('diff') document.getElementsByClassName('chat-line')[0].classList.add('diff')
document.getElementsByClassName('userlink')[0].classList.remove('d-none') document.getElementsByClassName('userlink')[0].classList.remove('d-none')
document.getElementsByClassName('avatar')[0].classList.remove('d-none') document.getElementsByClassName('avatar')[0].classList.remove('d-none')
document.getElementsByClassName('avatar')[0].src = json['avatar'] document.getElementsByClassName('avatar-pic')[0].src = json['avatar']
if (json['hat']) document.getElementsByClassName('avatar-hat')[0].src = json['hat']
document.getElementsByClassName('userlink')[0].href = '/@' + json['username'] document.getElementsByClassName('userlink')[0].href = '/@' + json['username']
document.getElementsByClassName('userlink')[0].style.color = '#' + json['namecolor'] document.getElementsByClassName('userlink')[0].style.color = '#' + json['namecolor']
document.getElementsByClassName('time')[0].classList.remove('d-none') document.getElementsByClassName('time')[0].classList.remove('d-none')

View File

@ -139,7 +139,12 @@
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<div class="pl-md-3 text-muted"> <div class="pl-md-3 text-muted">
<div> <div>
<img class="avatar pp20 mr-1" data-toggle="tooltip" data-placement="right"> <div class="avatar profile-pic-20-wrapper">
<img class="avatar-pic pp20 mr-1">
{% if m.get('hat') -%}
<img class="profile-pic-20-hat hat" loading="lazy" src="/i/hats/{{m['hat']}}?v=3">
{%- endif %}
</div>
<a href="" class="font-weight-bold text-black userlink" target="_blank"></a> <a href="" class="font-weight-bold text-black userlink" target="_blank"></a>
<span class="text-black time ml-2 d-none">just now</span> <span class="text-black time ml-2 d-none">just now</span>
<div class="cdiv"> <div class="cdiv">
@ -164,7 +169,7 @@
<div> <div>
{% if not same %} {% if not same %}
<div class="profile-pic-20-wrapper"> <div class="profile-pic-20-wrapper">
<img src="{{m['avatar']}}" class="avatar pp20 mr-1"> <img src="{{m['avatar']}}" class="pp20 mr-1">
{% if m.get('hat') -%} {% 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="/i/hats/{{m['hat']}}?v=3">
{%- endif %} {%- endif %}
@ -219,6 +224,6 @@
<script src="{{asset('js/lozad.js')}}"></script> <script src="{{asset('js/lozad.js')}}"></script>
<script src="/assets/js/lite-youtube.js?v=4000"></script> <script src="/assets/js/lite-youtube.js?v=4000"></script>
<script src="/chat.js?v=4000"></script> <script src="/chat.js?v=4001"></script>
</body> </body>