Skip to content

Commit ea7e1c6

Browse files
mcMMO Dashboard v1.22.01
- 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 52bb304 commit ea7e1c6

File tree

6 files changed

+44
-12
lines changed

6 files changed

+44
-12
lines changed

config/parameters.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
--border-of-elements-light-color: 27 31 35;
1212
--border-of-elements-dark-color: 255 255 255;
1313

14+
/*Tint for chartJS*/
15+
--tint1_: #57A0E5;
16+
--tint2_: #ED6D85;
17+
--tint3_: #6DBEBF;
18+
--tint4_: #F2A354;
19+
--tint5_: #9268F6;
20+
--tint6_: #F7CF6B;
21+
--tint7_: #C9CBCF;
22+
1423
/*Adapt the size of the website for wide screen*/
1524
/*!important is required at the end of the property to override the initial one*/
1625
--size-aside-wide-screen:400px!important;

resources/css/root.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
--border-color: rgba(var(--rgb_border) / 15%);
2424
--btn-main-bg: rgba(var(--rgb) / 100%);
2525
--btn-main-bg-hover: rgba(var(--rgb) / 100%);
26+
--tint1: var(--tint1_);
27+
--tint2: var(--tint2_);
28+
--tint3: var(--tint3_);
29+
--tint4: var(--tint4_);
30+
--tint5: var(--tint5_);
31+
--tint6: var(--tint6_);
32+
--tint7: var(--tint7_);
2633
--x:0;
2734
--y:0;
2835
--grad1: rgb(36, 41, 46);

resources/js/comparison.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ function chartComparison(data){
340340
label : tp[i].name,
341341
data : function (){
342342
return tp[i].skills
343-
}()
343+
}(),
344+
backgroundColor: generateColors(7, i)
344345
}
345346
)
346347
}

resources/js/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ function loadDatasetChartAbilities(player){
9393
return user[i].skills
9494
}(),
9595
hidden: false,
96+
borderColor: generateColors(7),
97+
backgroundColor: generateColors(7, i)
9698
}
9799
)
98100
}
@@ -163,17 +165,14 @@ chart_select.addEventListener('change', function (){
163165
function updateGraph(value){
164166
let duplicate = []
165167
let current
166-
167168
if(datasetChartAbilities[0].length < value){
168169
current = datasetChartAbilities[0].length
169170
}else{
170171
current = value
171172
}
172-
173173
for (let i = 0; i < current; i++) {
174174
duplicate[i] = datasetChartAbilities[0][i]
175175
}
176-
177176
chartAbilitiesGraph.data.datasets = duplicate
178177
chartAbilitiesGraph.update()
179178
}
@@ -185,7 +184,6 @@ let chartAbilitiesGraph,
185184
chartBestAbilitiesGraph
186185

187186
function chartAbilities(){
188-
189187
let data_chart_default = {
190188
labels: Object.values(translation[languageSelect].ab),
191189
datasets: datasetChartAbilities[0],
@@ -287,6 +285,7 @@ function chartBestAbilities(player){
287285
{
288286
label: 'EXP',
289287
data: sumA,
288+
backgroundColor: generateColors(7)
290289
}
291290
]
292291
}

resources/js/shared.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,4 +454,19 @@ function displayElement(element, data){
454454
});
455455
}
456456

457-
function backToTop(){window.scroll(0, 0)}
457+
function backToTop(){window.scroll(0, 0)}
458+
459+
function generateColors(numColors, value = 0) {
460+
let colors = [];
461+
if(value !== 0){
462+
colors.push(getComputedStyle(document.documentElement).getPropertyValue('--tint' + value % 7));
463+
return colors;
464+
}else{
465+
for (let i = 0; i < numColors; i++) {
466+
const index = i % 7;
467+
colors.push(getComputedStyle(document.documentElement).getPropertyValue('--tint' + (index + 1)));
468+
}
469+
return colors;
470+
}
471+
472+
}

resources/js/user.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ fLoadUser().then(r => {
142142
const ctx_compare = document.getElementById('chart_user_compare');
143143
let chartCompareGraph
144144
function chartCompare(best_player, current_player){
145-
145+
const tint1 = getComputedStyle(document.documentElement).getPropertyValue('--tint1')
146+
const tint5 = getComputedStyle(document.documentElement).getPropertyValue('--tint5')
146147
let tp = []
147148
tp.push(current_player, best_player)
148149
let datasets = []
@@ -152,7 +153,9 @@ function chartCompare(best_player, current_player){
152153
label : tp[i].name,
153154
data : function (){
154155
return tp[i].skills
155-
}()
156+
}(),
157+
borderColor: [tint1, tint5],
158+
backgroundColor: generateColors(7, i)
156159
}
157160
)
158161
}
@@ -199,6 +202,7 @@ function setLabel(player){
199202
}
200203
}
201204
}
205+
202206
function getKeyByValue(object, value) {
203207
return Object.keys(object).filter(key => object[key] === value);
204208
}
@@ -234,10 +238,6 @@ function createLabel(array){
234238
}
235239
}
236240

237-
function styleUserPageOffline(){
238-
console.log('Browser is offline')
239-
}
240-
241241
function userData(player){
242242
const last_connection_user = document.querySelector('.last-connection-user')
243243
const last_connection = player.last_connection
@@ -765,6 +765,7 @@ function setChart(player){
765765
label : 'All Abilities (exp)',
766766
data : skill_array,
767767
hidden: false,
768+
backgroundColor: generateColors(7)
768769
}
769770
)
770771
let data_chart_default = {

0 commit comments

Comments
 (0)