Skip to content

Commit 6d17e1c

Browse files
mcMMO Dashboard v1.22.02
#Bug fixed: - Some translations have been added: > table_player_label, table_total_label which were not included by default in the translation - The names of the families were not translated #Also: - You can change header title directly from parameters.js (search for 'title_header') - We added a force_darkMode variable in parameters.js to force dark mode by default. You still have the option to toggle the behavior with the dark mode button. #Previous version: - Tint for chart now available! - Comparison page update: > Link to player page > Highlighting the best comparison label - New download folder to add pre-made template > You can add an upload.css file to add a theme on your dashboard. Visit mcmmo.nicolasvaillant.net/themes (coming soon) for exclusive custom themes! - Cleaned up code in the project
1 parent ea7e1c6 commit 6d17e1c

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

config/parameters.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const abilities_cap = {
2929
const translation = {
3030
'active': 'FR',
3131
'EN': {
32+
'title_header': 'mcMMO Stats',
3233
'pages_name':{
3334
'index': 'mcMMO Stats | Home',
3435
'user': 'mcMMO Stats | _USER_',
@@ -129,6 +130,8 @@ const translation = {
129130
'general': {
130131
'best_ab': 'Best ability',
131132
'label_ab': 'Best player for ability _AB_',
133+
'table_player_label':'Player',
134+
'table_total_label':'Total'
132135
},
133136
'toast': {
134137
'IP_success' : 'IP sucessfully copied',
@@ -299,6 +302,7 @@ const translation = {
299302
}
300303
},
301304
'FR': {
305+
'title_header': 'mcMMO Stats',
302306
'pages_name':{
303307
'index': 'mcMMO Stats | Accueil',
304308
'user': 'mcMMO Stats | _USER_',
@@ -398,7 +402,9 @@ const translation = {
398402
},
399403
'general': {
400404
'best_ab': 'Meilleure capacité',
401-
'label_ab': 'Meilleur joueur pour la capacité _AB_'
405+
'label_ab': 'Meilleur joueur pour la capacité _AB_',
406+
'table_player_label':'Joueur',
407+
'table_total_label':'Total'
402408
},
403409
'toast': {
404410
'IP_success' : 'Adresse IP copiée',
@@ -569,6 +575,7 @@ const translation = {
569575
}
570576
},
571577
'DE': {
578+
'title_header': 'mcMMO Stats',
572579
'pages_name':{
573580
'index': 'mcMMO Stats | Willkommen',
574581
'user': 'mcMMO Stats | _USER_',
@@ -670,6 +677,8 @@ const translation = {
670677
'general': {
671678
'best_ab': 'Beste Fähigkeit',
672679
'label_ab': 'Bester Spieler für Fähigkeiten _AB_',
680+
'table_player_label':'Spieler',
681+
'table_total_label':'Gesamt'
673682
},
674683
'toast': {
675684
'IP_success' : 'IP erfolgreich kopiert',
@@ -842,6 +851,8 @@ const translation = {
842851
}
843852
//Change colors
844853
const settings = {
854+
//Set force_darkMode to true to enable dark mode by default
855+
'force_darkMode': false,
845856
'colors': {
846857
'page': {
847858
'gradient': {
@@ -859,10 +870,6 @@ const settings = {
859870
'gradient_1': '38 105 46',
860871
'gradient_2': '32 96 115'
861872
}
862-
},
863-
'chart': {
864-
'background': 'rgba(54, 162, 235, 0.5)',
865-
'background_opacity': 'rgba(54, 162, 235, 0.25)'
866873
}
867874
}
868875
}

resources/js/shared.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const requestTopLeaderboard = "resources/php/scripts/get_top_leaderboard.php"
44
const requestServerStats = "resources/php/scripts/get_server_stats.php"
55
const requestUserStats = "resources/php/scripts/get_user_stats.php"
66
const server_ip = document.querySelectorAll('.server-ip')
7+
const website_title = document.querySelector('#website-title')
78
const copyToClipboardAction = document.querySelectorAll('.copyToClipboardAction')
89
const button_back = document.querySelector('.back-to-top-container')
910
const copyToClipboard = document.querySelector('.copyToClipboard')
@@ -25,6 +26,7 @@ let exact_type = window.location.pathname.split("/").at(-1).split('.')[0]
2526
exact_type.length === 0 ? exact_type = 'index' : exact_type
2627
const loading_bar = document.querySelector('.loading-bar')
2728
let error_internal_server = false
29+
2830
window.onload = function (){
2931
const elems = document.querySelectorAll('.collapsible');
3032
M.Collapsible.init(elems, options_collapsible);
@@ -155,6 +157,8 @@ function setServerStats(infos) {
155157
languageSelect = translation.active
156158
changeLanguage(translation.active)
157159

160+
website_title.innerHTML = translation[languageSelect].title_header
161+
158162
darkM.addEventListener('change', (e) => {
159163
if(e.target.checked){
160164
document.documentElement.classList.add('toggle_dark_mode');
@@ -169,7 +173,7 @@ darkM.addEventListener('change', (e) => {
169173
})
170174

171175
const ss_dm = sessionStorage.getItem(label__darkMode)
172-
if(ss_dm === 'true'){
176+
if(ss_dm === 'true' || settings.force_darkMode){
173177
document.documentElement.classList.add('toggle_dark_mode')
174178
darkM.checked = true
175179
}
@@ -214,8 +218,8 @@ function changeLanguage(value){
214218
row_table_def.forEach(e => {
215219
const player = document.createElement('th')
216220
const total = document.createElement('th')
217-
player.innerHTML = 'player'
218-
total.innerHTML = 'Total'
221+
player.innerHTML = translation[value].content_page.general.table_player_label
222+
total.innerHTML = translation[value].content_page.general.table_total_label
219223
e.appendChild(player)
220224
e.appendChild(total)
221225
Object.values(ab).forEach(a => {

resources/js/user.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function setBestAbilities(player){
309309
clone.setAttribute('data-clone', 'total')
310310
clone.classList.add('shiny')
311311
const ab_title = clone.querySelector('.ab-title')
312-
ab_title.innerHTML = "Total"
312+
ab_title.innerHTML = translation[translation.active].content_page.general.table_total_label
313313
const ab_ar_label = clone.querySelector('.ab-bar-label')
314314

315315
const totalValue = totalAbilities()
@@ -518,9 +518,9 @@ function setAllAbilities(player){
518518
const family_label = clone.querySelector('.family-label')
519519
for (const [index, family] of Object.keys(families).entries()) {
520520
if (families[family].includes(e.charAt(0).toUpperCase() + e.slice(1))) {
521-
clone.setAttribute('data-family', family)
521+
clone.setAttribute('data-family', translation[translation.active].family[family])
522522
family_label.setAttribute('data-family', `var(--f${index})`)
523-
family_label.innerHTML = family
523+
family_label.innerHTML = translation[translation.active].family[family]
524524
break;
525525
}
526526
}
@@ -811,7 +811,7 @@ function setFilterFamilyCard(){
811811
element.classList.add('filter')
812812
span.setAttribute('data-family', `var(--f${index})`)
813813
element.setAttribute('data-family', `var(--f${index})`)
814-
span.innerHTML = family
814+
span.innerHTML = translation[translation.active].family[family]
815815

816816
label.appendChild(span)
817817
element.appendChild(input)

resources/php/includes/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<i class="fa-solid fa-bars icon-hamburger"></i>
55
<div class="icon hidden"><i class="fa-solid fa-eye"></i></div>
66
</button>
7-
<a id="website-title" href="index.php">mcMMO Stats</a>
7+
<a id="website-title" href="index.php"></a>
88
<a href="index.php">
99
<img src="resources/others/textures/defaultLogo/def.webp" alt="Logo of server running the website"
1010
id="server-logo">

0 commit comments

Comments
 (0)