changed getRandomMetroColor to getMetroColor

This commit is contained in:
Techywarrior 2013-03-31 20:45:32 -07:00
parent d27b583884
commit f5550ea802
5 changed files with 22 additions and 7 deletions

View File

@ -151,7 +151,7 @@
if (url) {
var style = useBackgroundColor ? "background-color:" + Dashboard.getRandomMetroColor() + ";" : "";
var style = useBackgroundColor ? "background-color:" + Dashboard.getMetroColor(item.Id) + ";" : "";
html += "<img class='itemDetailImage' src='" + url + "' style='" + style + "' />";
}
@ -700,7 +700,9 @@
html += '<img src="' + imgUrl + '" />';
} else {
html += '<img src="css/images/items/list/person.png" style="width:185px;"/>';
var style = "background-color:" + Dashboard.getMetroColor(cast.Name) + ";";
html += '<img src="css/images/items/list/person.png" style="max-width:185px; '+style+'"/>';
}
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + cast.Name + '</div>';

View File

@ -95,7 +95,7 @@
}
if (url) {
var style = useBackgroundColor ? "background-color:" + Dashboard.getRandomMetroColor() + ";" : "";
var style = useBackgroundColor ? "background-color:" + Dashboard.getMetroColor(item.Id) + ";" : "";
html += "<img class='itemDetailImage' src='" + url + "' style='" + style + "' />";
}

View File

@ -60,7 +60,7 @@
var linkId = "lnkUser" + i;
var background = Dashboard.getRandomMetroColor();
var background = Dashboard.getMetroColor(user.Id);
html += '<div class="posterViewItem posterViewItemWithDualText">';

View File

@ -54,7 +54,7 @@
}
}
var color = plugin.tileColor || Dashboard.getRandomMetroColor();
var color = plugin.tileColor || Dashboard.getMetroColor(plugin.name);
html += "<div class='posterViewItemText' style='background:" + color + "'>";

View File

@ -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();
}
}
};