Skip to content

Commit

Permalink
mcMMO Dashboard v1.22.02
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
NicolasVaillant committed Apr 25, 2023
1 parent ea7e1c6 commit 6d17e1c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
17 changes: 12 additions & 5 deletions config/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const abilities_cap = {
const translation = {
'active': 'FR',
'EN': {
'title_header': 'mcMMO Stats',
'pages_name':{
'index': 'mcMMO Stats | Home',
'user': 'mcMMO Stats | _USER_',
Expand Down Expand Up @@ -129,6 +130,8 @@ const translation = {
'general': {
'best_ab': 'Best ability',
'label_ab': 'Best player for ability _AB_',
'table_player_label':'Player',
'table_total_label':'Total'
},
'toast': {
'IP_success' : 'IP sucessfully copied',
Expand Down Expand Up @@ -299,6 +302,7 @@ const translation = {
}
},
'FR': {
'title_header': 'mcMMO Stats',
'pages_name':{
'index': 'mcMMO Stats | Accueil',
'user': 'mcMMO Stats | _USER_',
Expand Down Expand Up @@ -398,7 +402,9 @@ const translation = {
},
'general': {
'best_ab': 'Meilleure capacité',
'label_ab': 'Meilleur joueur pour la capacité _AB_'
'label_ab': 'Meilleur joueur pour la capacité _AB_',
'table_player_label':'Joueur',
'table_total_label':'Total'
},
'toast': {
'IP_success' : 'Adresse IP copiée',
Expand Down Expand Up @@ -569,6 +575,7 @@ const translation = {
}
},
'DE': {
'title_header': 'mcMMO Stats',
'pages_name':{
'index': 'mcMMO Stats | Willkommen',
'user': 'mcMMO Stats | _USER_',
Expand Down Expand Up @@ -670,6 +677,8 @@ const translation = {
'general': {
'best_ab': 'Beste Fähigkeit',
'label_ab': 'Bester Spieler für Fähigkeiten _AB_',
'table_player_label':'Spieler',
'table_total_label':'Gesamt'
},
'toast': {
'IP_success' : 'IP erfolgreich kopiert',
Expand Down Expand Up @@ -842,6 +851,8 @@ const translation = {
}
//Change colors
const settings = {
//Set force_darkMode to true to enable dark mode by default
'force_darkMode': false,
'colors': {
'page': {
'gradient': {
Expand All @@ -859,10 +870,6 @@ const settings = {
'gradient_1': '38 105 46',
'gradient_2': '32 96 115'
}
},
'chart': {
'background': 'rgba(54, 162, 235, 0.5)',
'background_opacity': 'rgba(54, 162, 235, 0.25)'
}
}
}
10 changes: 7 additions & 3 deletions resources/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const requestTopLeaderboard = "resources/php/scripts/get_top_leaderboard.php"
const requestServerStats = "resources/php/scripts/get_server_stats.php"
const requestUserStats = "resources/php/scripts/get_user_stats.php"
const server_ip = document.querySelectorAll('.server-ip')
const website_title = document.querySelector('#website-title')
const copyToClipboardAction = document.querySelectorAll('.copyToClipboardAction')
const button_back = document.querySelector('.back-to-top-container')
const copyToClipboard = document.querySelector('.copyToClipboard')
Expand All @@ -25,6 +26,7 @@ let exact_type = window.location.pathname.split("/").at(-1).split('.')[0]
exact_type.length === 0 ? exact_type = 'index' : exact_type
const loading_bar = document.querySelector('.loading-bar')
let error_internal_server = false

window.onload = function (){
const elems = document.querySelectorAll('.collapsible');
M.Collapsible.init(elems, options_collapsible);
Expand Down Expand Up @@ -155,6 +157,8 @@ function setServerStats(infos) {
languageSelect = translation.active
changeLanguage(translation.active)

website_title.innerHTML = translation[languageSelect].title_header

darkM.addEventListener('change', (e) => {
if(e.target.checked){
document.documentElement.classList.add('toggle_dark_mode');
Expand All @@ -169,7 +173,7 @@ darkM.addEventListener('change', (e) => {
})

const ss_dm = sessionStorage.getItem(label__darkMode)
if(ss_dm === 'true'){
if(ss_dm === 'true' || settings.force_darkMode){
document.documentElement.classList.add('toggle_dark_mode')
darkM.checked = true
}
Expand Down Expand Up @@ -214,8 +218,8 @@ function changeLanguage(value){
row_table_def.forEach(e => {
const player = document.createElement('th')
const total = document.createElement('th')
player.innerHTML = 'player'
total.innerHTML = 'Total'
player.innerHTML = translation[value].content_page.general.table_player_label
total.innerHTML = translation[value].content_page.general.table_total_label
e.appendChild(player)
e.appendChild(total)
Object.values(ab).forEach(a => {
Expand Down
8 changes: 4 additions & 4 deletions resources/js/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function setBestAbilities(player){
clone.setAttribute('data-clone', 'total')
clone.classList.add('shiny')
const ab_title = clone.querySelector('.ab-title')
ab_title.innerHTML = "Total"
ab_title.innerHTML = translation[translation.active].content_page.general.table_total_label
const ab_ar_label = clone.querySelector('.ab-bar-label')

const totalValue = totalAbilities()
Expand Down Expand Up @@ -518,9 +518,9 @@ function setAllAbilities(player){
const family_label = clone.querySelector('.family-label')
for (const [index, family] of Object.keys(families).entries()) {
if (families[family].includes(e.charAt(0).toUpperCase() + e.slice(1))) {
clone.setAttribute('data-family', family)
clone.setAttribute('data-family', translation[translation.active].family[family])
family_label.setAttribute('data-family', `var(--f${index})`)
family_label.innerHTML = family
family_label.innerHTML = translation[translation.active].family[family]
break;
}
}
Expand Down Expand Up @@ -811,7 +811,7 @@ function setFilterFamilyCard(){
element.classList.add('filter')
span.setAttribute('data-family', `var(--f${index})`)
element.setAttribute('data-family', `var(--f${index})`)
span.innerHTML = family
span.innerHTML = translation[translation.active].family[family]

label.appendChild(span)
element.appendChild(input)
Expand Down
2 changes: 1 addition & 1 deletion resources/php/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<i class="fa-solid fa-bars icon-hamburger"></i>
<div class="icon hidden"><i class="fa-solid fa-eye"></i></div>
</button>
<a id="website-title" href="index.php">mcMMO Stats</a>
<a id="website-title" href="index.php"></a>
<a href="index.php">
<img src="resources/others/textures/defaultLogo/def.webp" alt="Logo of server running the website"
id="server-logo">
Expand Down

0 comments on commit 6d17e1c

Please sign in to comment.