1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

progress on movies home page

This commit is contained in:
Luke Pulverenti 2013-04-01 11:59:56 -04:00
parent 89472754ad
commit ae312524dd
7 changed files with 103 additions and 45 deletions

View file

@ -493,8 +493,7 @@ var Dashboard = {
getAveragePrimaryImageAspectRatio: function (items) {
var total = 0;
var count = 0;
var values = [];
for (var i = 0, length = items.length; i < length; i++) {
@ -504,11 +503,22 @@ var Dashboard = {
continue;
}
total += ratio;
count++;
values[values.length] = ratio;
}
if (!values.length) {
return null;
}
return count == 0 ? 1 : total / count;
// Use the median
values.sort(function (a, b) { return a - b; });
var half = Math.floor(values.length / 2);
if (values.length % 2)
return values[half];
else
return (values[half - 1] + values[half]) / 2.0;
},
showUserFlyout: function () {