mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
changed getRandomMetroColor to getMetroColor
This commit is contained in:
parent
d27b583884
commit
f5550ea802
5 changed files with 22 additions and 7 deletions
|
@ -472,11 +472,11 @@ var Dashboard = {
|
|||
}
|
||||
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
html += "<img style='background:" + Dashboard.getRandomMetroColor() + ";' src='css/images/items/list/audio.png' />";
|
||||
html += "<img style='background:" + Dashboard.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||
}
|
||||
else {
|
||||
|
||||
html += "<img style='background:" + Dashboard.getRandomMetroColor() + ";' src='css/images/items/list/collection.png' />";
|
||||
html += "<img style='background:" + Dashboard.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
|
||||
if (showText) {
|
||||
|
@ -1146,6 +1146,19 @@ var Dashboard = {
|
|||
var index = Math.floor(Math.random() * (Dashboard.metroColors.length - 1));
|
||||
|
||||
return Dashboard.metroColors[index];
|
||||
},
|
||||
|
||||
getMetroColor: function (str) {
|
||||
|
||||
if (str) {
|
||||
var char = str.substr(0,1).charCodeAt();
|
||||
var index = String(char).substr(char.length,1);
|
||||
|
||||
return Dashboard.metroColors[index];
|
||||
}else {
|
||||
return Dashboard.getRandomMetroColor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue