Skip to content

Commit a2e0961

Browse files
- Better overflow management for long username
- Skin update date for bedrock players
1 parent 4912f21 commit a2e0961

File tree

7 files changed

+49
-7
lines changed

7 files changed

+49
-7
lines changed

config/parameters.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ const translation = {
185185
},
186186
'refresh' : {
187187
'index': 'Refreshed at _HOUR_',
188-
'user': 'Last connection at _HOUR_h_MIN_, _DATE_'
188+
'user': 'Last connection at _HOUR_h_MIN_, _DATE_',
189+
'skin': 'Last skin update at _HOUR_h_MIN_, _DATE_'
189190
},
190191
'card': {
191192
'best_card_label_avt': 'Current level : _CURRENT_LVL_/_MAX_LEVEL_',
@@ -458,7 +459,8 @@ const translation = {
458459
},
459460
'refresh' : {
460461
'index': 'Mise à jour à _HOUR_',
461-
'user': 'Dernière connexion à _HOUR_h_MIN_ le _DATE_'
462+
'user': 'Dernière connexion à _HOUR_h_MIN_ le _DATE_',
463+
'skin': 'Dernière mise à jour du skin à _HOUR_h_MIN_, _DATE_'
462464
},
463465
'card': {
464466
'best_card_label_avt': 'Niveau actuel : _CURRENT_LVL_/_MAX_LEVEL_',
@@ -732,7 +734,8 @@ const translation = {
732734
},
733735
'refresh' : {
734736
'index': 'Aktualisiert um _HOUR_',
735-
'user': 'Zuletzt online am _DATE_ _HOUR_:_MIN_'
737+
'user': 'Zuletzt online am _DATE_ _HOUR_:_MIN_',
738+
'skin': 'Letztes Skin-Update um _HOUR_h_MIN_, _DATE_'
736739
},
737740
'card': {
738741
'best_card_label_avt': 'Aktuelles Level: _CURRENT_LVL_/_MAX_LEVEL_',

resources/css/style.css

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/css/style.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/css/style.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,11 +834,14 @@ body{
834834
justify-content: space-between;
835835
width: 100%;
836836
background: var(--background-op);
837-
gap: 1em;
837+
gap: .5em;
838+
overflow-x: auto;
839+
flex-wrap: wrap;
838840
@media all and (max-width: 600px) {
839841
flex-direction: column!important;
840842
align-items: flex-start!important;
841843
.container-title{padding: 1em 1em 0!important}
844+
flex-wrap: nowrap;
842845
}
843846
}
844847
.wrapper-content{
@@ -1578,6 +1581,7 @@ body{
15781581
z-index: 0;
15791582
opacity: 0;
15801583
transition: .5s all;
1584+
flex-wrap: wrap;
15811585
img{
15821586
width: 2em;
15831587
aspect-ratio: 1;

resources/js/shared.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ function getSkin(player, type) {
576576
if (player.bedrock === 0) {
577577
// Not a bedrock player, so we can directly use the name with mc-heads API
578578
output.url = `https://mc-heads.net/${types[type]}/${player.name}${type === 'BODY_3D_REVERSE' ? '/left' : ''}`;
579+
output.type = 'java'
579580
} else {
580581
// Bedrock player, so we should get the texture ID thanks to geyser API
581582
const xuidHex = player.uuid.split('-').join('').toUpperCase();
@@ -596,6 +597,7 @@ function getSkin(player, type) {
596597
setToast('info', 'Bedrock player\'s skin can\'t be displayed for now.\nTry again later.', 5000);
597598
output.url = `resources/others/textures/defaultSkin/bedrock-${types[type]}${type === 'BODY_3D_REVERSE' ? '-reverse' : ''}.png`;
598599
}
600+
output.type = 'bedrock'
599601
}
600602
return output;
601603
}

resources/js/user.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,40 @@ function createLabel(array){
314314

315315
function userData(player){
316316
const last_connection_user = document.querySelector('.last-connection-user')
317+
const skin_update = document.querySelector('.skin-update')
317318
const last_connection = player.last_connection
318-
const date = getHM(last_connection)
319+
let date = getHM(last_connection)
319320
last_connection_user.innerHTML = translation[languageSelect].refresh.user
320321
.replace('_HOUR_', date.h)
321322
.replace('_MIN_', date.m)
322323
.replace('_DATE_', date.date);
324+
function formatTimestamp(timestamp) {
325+
const d = new Date(timestamp);
326+
let day = d.getDate();
327+
let month = d.getMonth() + 1;
328+
let year = d.getFullYear();
329+
let hour = d.getHours();
330+
let minute = d.getMinutes();
331+
332+
day = (day < 10 ? '0' : '') + day;
333+
month = (month < 10 ? '0' : '') + month;
334+
year = (year < 10 ? '0' : '') + year;
335+
hour = (hour < 10 ? '0' : '') + hour;
336+
minute = (minute < 10 ? '0' : '') + minute;
337+
let date = day + '/' + month + '/' + year
338+
339+
return {hour, minute, date}
340+
}
341+
342+
const {type, last_update} = getSkin(player, 'SKIN')
343+
if(type === 'bedrock'){
344+
const {hour, minute, date} = formatTimestamp(last_update)
345+
skin_update.innerHTML = translation[languageSelect].refresh.skin
346+
.replace('_HOUR_', hour)
347+
.replace('_MIN_', minute)
348+
.replace('_DATE_', date);
349+
}
350+
323351
}
324352

325353
function setSkin(player) {

user.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<div class="title-container">
8484
<h1 class="title-section"></h1>
8585
<p class="last-connection-user"></p>
86+
<p class="skin-update"></p>
8687
</div>
8788
<div class="wrapper-content">
8889
<div class="user-skin">

0 commit comments

Comments
 (0)