mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
make web client images more efficient by using max height instead of height
This commit is contained in:
parent
25cb195ec6
commit
144ee15789
5 changed files with 47 additions and 34 deletions
|
@ -502,7 +502,7 @@
|
||||||
var query = {
|
var query = {
|
||||||
ParentId: item.Id,
|
ParentId: item.Id,
|
||||||
SortBy: sortBy,
|
SortBy: sortBy,
|
||||||
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,AudioInfo"
|
Fields: "ItemCounts,DateCreated,AudioInfo"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (item.Type == "Series" || item.Type == "Season") {
|
if (item.Type == "Series" || item.Type == "Season") {
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
return { attr: { id: item.Id, rel: rel, itemtype: item.Type }, data: htmlName, state: state };
|
return { attr: { id: item.Id, rel: rel, itemtype: item.Type }, data: htmlName, state: state };
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNode(page, node, openItems, selectedId, callback) {
|
function loadNode(page, node, openItems, selectedId, currentUser, callback) {
|
||||||
|
|
||||||
if (node == '-1') {
|
if (node == '-1') {
|
||||||
|
|
||||||
|
@ -76,13 +76,20 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), {
|
var query = {
|
||||||
|
|
||||||
ParentId: node.attr("id"),
|
ParentId: node.attr("id"),
|
||||||
SortBy: 'SortName',
|
SortBy: 'SortName',
|
||||||
Fields: 'MetadataSettings'
|
Fields: 'MetadataSettings'
|
||||||
|
};
|
||||||
|
|
||||||
}).done(function (result) {
|
if (!currentUser.Configuration.DisplayMissingEpisodes) {
|
||||||
|
query.IsMissing = false;
|
||||||
|
}
|
||||||
|
if (!currentUser.Configuration.DisplayUnairedEpisodes) {
|
||||||
|
query.IsVirtualUnaired = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||||
|
|
||||||
var nodes = result.Items.map(function (i) {
|
var nodes = result.Items.map(function (i) {
|
||||||
|
|
||||||
|
@ -120,20 +127,20 @@
|
||||||
$(document).scrollTop(0);
|
$(document).scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeTree(page, openItems, selectedId) {
|
function initializeTree(page, currentUser, openItems, selectedId) {
|
||||||
|
|
||||||
$('.libraryTree', page).jstree({
|
$('.libraryTree', page).jstree({
|
||||||
|
|
||||||
"plugins": ["themes", "ui", "json_data"],
|
"plugins": ["themes", "ui", "json_data"],
|
||||||
|
|
||||||
data: function (node, callback) {
|
data: function (node, callback) {
|
||||||
loadNode(page, node, openItems, selectedId, callback);
|
loadNode(page, node, openItems, selectedId, currentUser, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
json_data: {
|
json_data: {
|
||||||
|
|
||||||
data: function (node, callback) {
|
data: function (node, callback) {
|
||||||
loadNode(page, node, openItems, selectedId, callback);
|
loadNode(page, node, openItems, selectedId, currentUser, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -164,23 +171,27 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
Dashboard.getCurrentUser().done(function(user) {
|
||||||
|
|
||||||
var id = MetadataEditor.currentItemId;
|
var id = MetadataEditor.currentItemId;
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|
||||||
ApiClient.getAncestorItems(id, Dashboard.getCurrentUserId()).done(function (ancestors) {
|
ApiClient.getAncestorItems(id, user.Id).done(function (ancestors) {
|
||||||
|
|
||||||
var ids = ancestors.map(function (i) {
|
var ids = ancestors.map(function (i) {
|
||||||
return i.Id;
|
return i.Id;
|
||||||
});
|
});
|
||||||
|
|
||||||
initializeTree(page, ids, id);
|
initializeTree(page, user, ids, id);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
initializeTree(page, []);
|
initializeTree(page, user, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}).on('pagebeforehide', ".metadataEditorPage", function () {
|
}).on('pagebeforehide', ".metadataEditorPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
IncludeItemTypes: "Episode",
|
IncludeItemTypes: "Episode",
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "DateCreated,SeriesInfo",
|
Fields: "DateCreated,SeriesInfo",
|
||||||
StartIndex: 0
|
StartIndex: 0,
|
||||||
|
IsMissing: false,
|
||||||
|
IsVirtualUnaired: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function reloadItems(page) {
|
function reloadItems(page) {
|
||||||
|
@ -224,7 +226,7 @@
|
||||||
$('#chkMissingEpisode', this).on('change', function () {
|
$('#chkMissingEpisode', this).on('change', function () {
|
||||||
|
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsMissing = this.checked ? true : null;
|
query.IsMissing = this.checked ? true : false;
|
||||||
|
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
});
|
});
|
||||||
|
@ -232,7 +234,15 @@
|
||||||
$('#chkFutureEpisode', this).on('change', function () {
|
$('#chkFutureEpisode', this).on('change', function () {
|
||||||
|
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsUnaired = this.checked ? true : null;
|
|
||||||
|
if (this.checked) {
|
||||||
|
query.IsUnaired = true;
|
||||||
|
query.IsVirtualUnaired = null;
|
||||||
|
} else {
|
||||||
|
query.IsUnaired = null;
|
||||||
|
query.IsVirtualUnaired = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,8 +66,6 @@
|
||||||
options.shape = options.preferBackdrop ? "backdrop" : "poster";
|
options.shape = options.preferBackdrop ? "backdrop" : "poster";
|
||||||
}
|
}
|
||||||
|
|
||||||
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
for (var i = 0, length = items.length; i < length; i++) {
|
for (var i = 0, length = items.length; i < length; i++) {
|
||||||
|
@ -87,7 +85,6 @@
|
||||||
var imgUrl = null;
|
var imgUrl = null;
|
||||||
var isDefault = false;
|
var isDefault = false;
|
||||||
var height = null;
|
var height = null;
|
||||||
var width = null;
|
|
||||||
|
|
||||||
var cssClass = "tileItem";
|
var cssClass = "tileItem";
|
||||||
|
|
||||||
|
@ -117,23 +114,19 @@
|
||||||
else if (item.ImageTags && item.ImageTags.Primary) {
|
else if (item.ImageTags && item.ImageTags.Primary) {
|
||||||
|
|
||||||
height = 300;
|
height = 300;
|
||||||
width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
|
||||||
|
|
||||||
imgUrl = LibraryBrowser.getImageUrl(item, 'Primary', 0, {
|
imgUrl = LibraryBrowser.getImageUrl(item, 'Primary', 0, {
|
||||||
height: height,
|
maxheight: height
|
||||||
width: width
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
|
|
||||||
height = 300;
|
height = 300;
|
||||||
width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
|
||||||
|
|
||||||
imgUrl = ApiClient.getImageUrl(item.AlbumId, {
|
imgUrl = ApiClient.getImageUrl(item.AlbumId, {
|
||||||
type: "Primary",
|
type: "Primary",
|
||||||
height: 100,
|
height: 100,
|
||||||
width: width,
|
|
||||||
tag: item.AlbumPrimaryImageTag
|
tag: item.AlbumPrimaryImageTag
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
IncludeItemTypes: "Episode",
|
IncludeItemTypes: "Episode",
|
||||||
Limit: 30,
|
Limit: 30,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
|
Fields: "SeriesInfo,UserData",
|
||||||
IsUnaired: true
|
IsUnaired: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
}
|
}
|
||||||
$('#upcomingItems', page).html(LibraryBrowser.getPosterViewHtml({
|
$('#upcomingItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
useAverageAspectRatio: true,
|
|
||||||
showLocationTypeIndicator: false,
|
showLocationTypeIndicator: false,
|
||||||
showNewIndicator: false,
|
showNewIndicator: false,
|
||||||
shape: "backdrop",
|
shape: "backdrop",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue