mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-16 02:18:16 -07:00
fix missing semi-colon
This commit is contained in:
parent
d3951c232a
commit
9ffd7d819a
@ -1,201 +1,196 @@
|
||||
var LibraryBrowser = {
|
||||
|
||||
getPosterViewHtml: function (options) {
|
||||
|
||||
getPosterViewHtml: function (options) {
|
||||
var items = options.items;
|
||||
|
||||
var items = options.items;
|
||||
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||
|
||||
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||
var html = "";
|
||||
|
||||
var html = "";
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||
|
||||
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||
|
||||
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||
|
||||
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||
var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
|
||||
|
||||
var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
|
||||
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||
|
||||
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else if (hasPrimaryImage) {
|
||||
|
||||
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else if (hasPrimaryImage) {
|
||||
var height = 300;
|
||||
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
|
||||
var height = 300;
|
||||
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
height: height,
|
||||
width: width,
|
||||
tag: item.ImageTags.Primary
|
||||
}) + "' />";
|
||||
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
height: height,
|
||||
width: width,
|
||||
tag: item.ImageTags.Primary
|
||||
}) + "' />";
|
||||
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
}
|
||||
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
}
|
||||
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||
} else {
|
||||
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||
}
|
||||
else {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
if (showText) {
|
||||
html += "<div class='posterViewItemText'>";
|
||||
html += item.Name;
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
if (showText) {
|
||||
html += "<div class='posterViewItemText'>";
|
||||
html += item.Name;
|
||||
html += "</div>";
|
||||
}
|
||||
html += "</a></div>";
|
||||
}
|
||||
|
||||
html += "</a></div>";
|
||||
}
|
||||
return html;
|
||||
},
|
||||
|
||||
return html;
|
||||
},
|
||||
getEpisodePosterViewHtml: function (options) {
|
||||
|
||||
getEpisodePosterViewHtml: function (options) {
|
||||
var items = options.items;
|
||||
|
||||
var items = options.items;
|
||||
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||
|
||||
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||
var html = "";
|
||||
|
||||
var html = "";
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||
|
||||
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||
|
||||
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||
|
||||
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText";
|
||||
|
||||
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText";
|
||||
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||
|
||||
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else if (hasPrimaryImage) {
|
||||
|
||||
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else if (hasPrimaryImage) {
|
||||
var height = 300;
|
||||
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
|
||||
var height = 300;
|
||||
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
height: height,
|
||||
width: width,
|
||||
tag: item.ImageTags.Primary
|
||||
}) + "' />";
|
||||
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
height: height,
|
||||
width: width,
|
||||
tag: item.ImageTags.Primary
|
||||
}) + "' />";
|
||||
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
|
||||
}
|
||||
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
}
|
||||
else {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
if (showText) {
|
||||
html += "<div class='posterViewItemText posterViewItemPrimaryText'>";
|
||||
if (item.SeriesName != null) {
|
||||
html += item.SeriesName;
|
||||
html += "</div>";
|
||||
html += "<div class='posterViewItemText'>";
|
||||
}
|
||||
if (item.ParentIndexNumber != null) {
|
||||
html += item.ParentIndexNumber + ".";
|
||||
}
|
||||
if (item.IndexNumber != null) {
|
||||
html += item.IndexNumber + " -";
|
||||
}
|
||||
|
||||
if (showText) {
|
||||
html += "<div class='posterViewItemText posterViewItemPrimaryText'>";
|
||||
if (item.SeriesName != null) {
|
||||
html += item.SeriesName;
|
||||
html += "</div>";
|
||||
html += "<div class='posterViewItemText'>";
|
||||
}
|
||||
if (item.ParentIndexNumber != null) {
|
||||
html += item.ParentIndexNumber + ".";
|
||||
}
|
||||
if (item.IndexNumber != null) {
|
||||
html += item.IndexNumber + " -";
|
||||
}
|
||||
html += " " + item.Name;
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += " "+item.Name;
|
||||
html += "</div>";
|
||||
}
|
||||
html += "</a></div>";
|
||||
}
|
||||
|
||||
html += "</a></div>";
|
||||
}
|
||||
return html;
|
||||
},
|
||||
|
||||
return html;
|
||||
},
|
||||
getAveragePrimaryImageAspectRatio: function (items) {
|
||||
|
||||
getAveragePrimaryImageAspectRatio: function (items) {
|
||||
var values = [];
|
||||
|
||||
var values = [];
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var ratio = items[i].PrimaryImageAspectRatio || 0;
|
||||
|
||||
var ratio = items[i].PrimaryImageAspectRatio || 0;
|
||||
if (!ratio) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ratio) {
|
||||
continue;
|
||||
}
|
||||
values[values.length] = ratio;
|
||||
}
|
||||
|
||||
values[values.length] = ratio;
|
||||
}
|
||||
if (!values.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!values.length) {
|
||||
return null;
|
||||
}
|
||||
// Use the median
|
||||
values.sort(function (a, b) { return a - b; });
|
||||
|
||||
// Use the median
|
||||
values.sort(function (a, b) { return a - b; });
|
||||
var half = Math.floor(values.length / 2);
|
||||
|
||||
var half = Math.floor(values.length / 2);
|
||||
if (values.length % 2)
|
||||
return values[half];
|
||||
else
|
||||
return (values[half - 1] + values[half]) / 2.0;
|
||||
},
|
||||
|
||||
if (values.length % 2)
|
||||
return values[half];
|
||||
else
|
||||
return (values[half - 1] + values[half]) / 2.0;
|
||||
},
|
||||
metroColors: ["#6FBD45", "#4BB3DD", "#4164A5", "#E12026", "#800080", "#E1B222", "#008040", "#0094FF", "#FF00C7", "#FF870F", "#7F0037"],
|
||||
|
||||
metroColors: ["#6FBD45", "#4BB3DD", "#4164A5", "#E12026", "#800080", "#E1B222", "#008040", "#0094FF", "#FF00C7", "#FF870F", "#7F0037"],
|
||||
getRandomMetroColor: function () {
|
||||
|
||||
getRandomMetroColor: function () {
|
||||
var index = Math.floor(Math.random() * (LibraryBrowser.metroColors.length - 1));
|
||||
|
||||
var index = Math.floor(Math.random() * (LibraryBrowser.metroColors.length - 1));
|
||||
return LibraryBrowser.metroColors[index];
|
||||
},
|
||||
|
||||
return LibraryBrowser.metroColors[index];
|
||||
},
|
||||
getMetroColor: function (str) {
|
||||
|
||||
getMetroColor: function (str) {
|
||||
if (str) {
|
||||
var char = str.substr(0, 1).charCodeAt();
|
||||
var index = String(char).substr(char.length, 1);
|
||||
|
||||
if (str) {
|
||||
var char = str.substr(0,1).charCodeAt();
|
||||
var index = String(char).substr(char.length,1);
|
||||
return LibraryBrowser.metroColors[index];
|
||||
} else {
|
||||
return LibraryBrowser.getRandomMetroColor();
|
||||
}
|
||||
|
||||
return LibraryBrowser.metroColors[index];
|
||||
}else {
|
||||
return LibraryBrowser.getRandomMetroColor();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user