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

factor device pixel ratio into downloaded image size

This commit is contained in:
Luke Pulverenti 2014-05-23 19:58:28 -04:00
parent 8cadabcbe5
commit 5677ce1011
27 changed files with 295 additions and 195 deletions

View file

@ -28,7 +28,7 @@
</div> </div>
<div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width: 250px;" data-history="false"> <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width: 250px;" data-history="false">
<div style="padding: .5em 1.5em;"> <div style="padding: .5em 1.5em;">
<p style="color: #eee;">Loading channel content...</p> <p style="color: #eee;">${MessageLoadingChannels}</p>
</div> </div>
</div> </div>
<div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-position-fixed="true"> <div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-position-fixed="true">

View file

@ -128,14 +128,6 @@
} }
.backdropPosterItem {
width: 148px;
}
.backdropPosterItem .posterItemImage {
height: 83.25px;
}
.myLibraryPosterItem { .myLibraryPosterItem {
width: 148px; width: 148px;
} }
@ -180,12 +172,20 @@
background-color: rgba(255, 233, 127, 0.5); background-color: rgba(255, 233, 127, 0.5);
} }
.backdropPosterItem {
width: 128px;
}
.backdropPosterItem .posterItemImage {
height: 72px;
}
.smallBackdropPosterItem { .smallBackdropPosterItem {
width: 157px; width: 120px;
} }
.smallBackdropPosterItem .posterItemImage { .smallBackdropPosterItem .posterItemImage {
height: 88.3125px; height: 67.5px;
} }
.portraitPosterItem { .portraitPosterItem {
@ -254,6 +254,25 @@
} }
} }
@media all and (min-width: 360px) {
.backdropPosterItem {
width: 148px;
}
.backdropPosterItem .posterItemImage {
height: 83.25px;
}
.smallBackdropPosterItem {
width: 157px;
}
.smallBackdropPosterItem .posterItemImage {
height: 88.3125px;
}
}
@media all and (min-width: 540px) { @media all and (min-width: 540px) {
.backdropPosterItem { .backdropPosterItem {

View file

@ -15,11 +15,39 @@
</div> </div>
<div data-role="content"> <div data-role="content">
<div class="viewSettings"> <div class="viewSettings">
<div class="viewControls" data-role="controlgroup" data-type="horizontal">
<button data-mini="true" data-icon="filter" data-inline="true" data-iconpos="notext" title="${ButtonFilter}" onclick="$('#filterPanel', $(this).parents('.page')).panel( 'toggle' );">${ButtonFilter}</button>
</div>
<div class="listTopPaging"> <div class="listTopPaging">
</div> </div>
</div> </div>
<div id="items" class="itemsContainer"></div> <div id="items" class="itemsContainer"></div>
<div data-role="popup" class="popupLoading" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width: 250px;" data-history="false">
<div style="padding: .5em 1.5em;">
<p style="color: #eee;">${MessageLoadingChannels}</p>
</div> </div>
</div> </div>
</div>
<div data-role="panel" id="filterPanel" data-position="right" data-display="overlay" data-position-fixed="true">
<form>
<fieldset data-role="controlgroup">
<legend>
<strong>${HeaderFilters}</strong>
</legend>
<input class="chkStandardFilter" type="checkbox" id="chkFavorite" data-filter="IsFavorite" data-mini="true">
<label for="chkFavorite">${OptionFavorite}</label>
<input class="chkStandardFilter" type="checkbox" id="chkLikes" data-filter="Likes" data-mini="true">
<label for="chkLikes">${OptionLikes}</label>
<input class="chkStandardFilter" type="checkbox" id="chkDislikes" data-filter="Dislikes" data-mini="true">
<label for="chkDislikes">${OptionDislikes}</label>
</fieldset>
</form>
</div>
</div>
</body> </body>
</html> </html>

View file

@ -41,6 +41,11 @@
</div> </div>
</div> </div>
</div> </div>
<div data-role="popup" class="popupLoading" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width: 250px;" data-history="false">
<div style="padding: .5em 1.5em;">
<p style="color: #eee;">${MessageLoadingChannels}</p>
</div>
</div>
</div> </div>
</div> </div>
</body> </body>

View file

@ -2,8 +2,8 @@
function loadPage(page, config) { function loadPage(page, config) {
$('#chkMobileClients', page).checked(config.RequireManualLoginForMobileApps).checkboxradio("refresh"); $('#chkMobileClients', page).checked(config.RequireMobileManualLogin).checkboxradio("refresh");
$('#chkOtherApps', page).checked(config.RequireManualLoginForOtherApps).checkboxradio("refresh"); $('#chkOtherApps', page).checked(config.RequireNonMobileManualLogin).checkboxradio("refresh");
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
@ -32,8 +32,8 @@
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().done(function (config) {
config.RequireManualLoginForMobileApps = $('#chkMobileClients', form).checked(); config.RequireMobileManualLogin = $('#chkMobileClients', form).checked();
config.RequireManualLoginForOtherApps = $('#chkOtherApps', form).checked(); config.RequireNonMobileManualLogin = $('#chkOtherApps', form).checked();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
}); });

View file

@ -68,9 +68,12 @@
var index = getRandom(0, images.length - 1); var index = getRandom(0, images.length - 1);
var item = images[index]; var item = images[index];
var imgUrl = ApiClient.getImageUrl(item.id, { var screenWidth = $(window).width();
var imgUrl = ApiClient.getScaledImageUrl(item.id, {
type: "Backdrop", type: "Backdrop",
tag: item.tag tag: item.tag,
maxWidth: screenWidth
}); });
getElement().css('backgroundImage', 'url(\'' + imgUrl + '\')'); getElement().css('backgroundImage', 'url(\'' + imgUrl + '\')');
@ -99,7 +102,7 @@
var val = LocalSettings.val('enableBackdrops', userId); var val = LocalSettings.val('enableBackdrops', userId);
return val != '0'; return val == '1';
} }
$(document).on('pagebeforeshow', ".backdropPage", function () { $(document).on('pagebeforeshow', ".backdropPage", function () {

View file

@ -389,10 +389,11 @@
if (nowPlayingItem.LogoItemId) { if (nowPlayingItem.LogoItemId) {
imgUrl = ApiClient.getImageUrl(nowPlayingItem.LogoItemId, { imgUrl = ApiClient.getScaledImageUrl(nowPlayingItem.LogoItemId, {
tag: session.LogoImageTag, tag: session.LogoImageTag,
height: 48, maxHeight: 24,
maxWidth: 130,
type: 'Logo' type: 'Logo'
}); });
@ -579,27 +580,27 @@
if (item && item.BackdropImageTag) { if (item && item.BackdropImageTag) {
return ApiClient.getImageUrl(item.BackdropItemId, { return ApiClient.getScaledImageUrl(item.BackdropItemId, {
type: "Backdrop", type: "Backdrop",
width: 810, width: 275,
tag: item.BackdropImageTag tag: item.BackdropImageTag
}); });
} }
if (item && item.ThumbImageTag) { if (item && item.ThumbImageTag) {
return ApiClient.getImageUrl(item.ThumbItemId, { return ApiClient.getScaledImageUrl(item.ThumbItemId, {
type: "Thumb", type: "Thumb",
width: 810, width: 275,
tag: item.ThumbImageTag tag: item.ThumbImageTag
}); });
} }
if (item && item.PrimaryImageTag) { if (item && item.PrimaryImageTag) {
return ApiClient.getImageUrl(item.PrimaryImageItemId, { return ApiClient.getScaledImageUrl(item.PrimaryImageItemId, {
type: "Primary", type: "Primary",
width: 810, width: 275,
tag: item.PrimaryImageTag tag: item.PrimaryImageTag
}); });
} }

View file

@ -35,9 +35,10 @@
html += '<div style="width:120px;height:180px;">'; html += '<div style="width:120px;height:180px;">';
if (item.ImageTags.Primary) { if (item.ImageTags.Primary) {
var imgUrl = ApiClient.getImageUrl(item.Id, { var imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Primary", type: "Primary",
width: 300, maxWidth: 120,
maxHeight: 180,
tag: item.ImageTags.Primary tag: item.ImageTags.Primary
}); });
@ -65,9 +66,10 @@
if (item.PrimaryImageTag) { if (item.PrimaryImageTag) {
var imgUrl = ApiClient.getImageUrl(item.ItemId, { var imgUrl = ApiClient.getScaledImageUrl(item.ItemId, {
type: "Primary", type: "Primary",
width: 200, maxWidth: 100,
maxHeight: 150,
tag: item.PrimaryImageTag tag: item.PrimaryImageTag
}); });

View file

@ -310,7 +310,7 @@
html += '<div class="editorTile imageEditorTile">'; html += '<div class="editorTile imageEditorTile">';
html += '<div style="height:144px;vertical-align:top;background-repeat:no-repeat;background-size:contain;background-image:url(\'' + LibraryBrowser.getImageUrl(currentItem, image.ImageType, image.ImageIndex, { maxheight: 216 }) + '\');"></div>'; html += '<div style="height:144px;vertical-align:top;background-repeat:no-repeat;background-size:contain;background-image:url(\'' + LibraryBrowser.getImageUrl(currentItem, image.ImageType, image.ImageIndex, { height: 144 }) + '\');"></div>';
html += '<div>'; html += '<div>';

View file

@ -184,7 +184,7 @@
$('#movieTabs', page).show(); $('#movieTabs', page).show();
} }
if (item.Type == "video.channelItem" || item.Type == "audio.channelItem" || item.Type == "folder.ChannelItem") { if (item.Type == "ChannelVideoItem" || item.Type == "ChannelAudioItem" || item.Type == "ChannelFolderItem") {
$('#channelTabs', page).show(); $('#channelTabs', page).show();
$('.channelHeader', page).show().html('<a href="channelitems.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create'); $('.channelHeader', page).show().html('<a href="channelitems.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create');
} else { } else {
@ -1018,8 +1018,8 @@
if (chapter.ImageTag) { if (chapter.ImageTag) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxwidth: 400, maxWidth: 210,
tag: chapter.ImageTag, tag: chapter.ImageTag,
type: "Chapter", type: "Chapter",
index: i index: i
@ -1212,8 +1212,8 @@
if (imageTags.Primary) { if (imageTags.Primary) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxwidth: 500, maxWidth: 210,
tag: imageTags.Primary, tag: imageTags.Primary,
type: "primary" type: "primary"
}); });

View file

@ -457,7 +457,7 @@
} }
// For search hints // For search hints
return ApiClient.getImageUrl(item.Id || item.ItemId, options); return ApiClient.getScaledImageUrl(item.Id || item.ItemId, options);
}, },
@ -541,38 +541,40 @@
var forceName = false; var forceName = false;
var downloadHeight = 576;
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Backdrop", type: "Backdrop",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.BackdropImageTags[0] tag: item.BackdropImageTags[0]
}); });
} }
else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) { else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Thumb", type: "Thumb",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
} }
else if (options.preferBanner && item.ImageTags && item.ImageTags.Banner) { else if (options.preferBanner && item.ImageTags && item.ImageTags.Banner) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Banner", type: "Banner",
maxwidth: 1200, maxWidth: 500,
tag: item.ImageTags.Banner tag: item.ImageTags.Banner
}); });
} }
else if (options.preferThumb && item.SeriesThumbImageTag) { else if (options.preferThumb && item.SeriesThumbImageTag) {
imgUrl = ApiClient.getImageUrl(item.SeriesId, { imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, {
type: "Thumb", type: "Thumb",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.SeriesThumbImageTag tag: item.SeriesThumbImageTag
}); });
@ -581,15 +583,15 @@
imgUrl = ApiClient.getThumbImageUrl(item.ParentThumbItemId, { imgUrl = ApiClient.getThumbImageUrl(item.ParentThumbItemId, {
type: "Thumb", type: "Thumb",
maxwidth: 576 maxWidth: downloadHeight
}); });
} }
else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) { else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Backdrop", type: "Backdrop",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.BackdropImageTags[0] tag: item.BackdropImageTags[0]
}); });
@ -610,10 +612,10 @@
} }
else if (item.AlbumId && item.AlbumPrimaryImageTag) { else if (item.AlbumId && item.AlbumPrimaryImageTag) {
height = 400; height = 220;
width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null; width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null;
imgUrl = ApiClient.getImageUrl(item.AlbumId, { imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary", type: "Primary",
height: height, height: height,
width: width, width: width,
@ -623,27 +625,27 @@
} }
else if (item.BackdropImageTags && item.BackdropImageTags.length) { else if (item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Backdrop", type: "Backdrop",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.BackdropImageTags[0] tag: item.BackdropImageTags[0]
}); });
} }
else if (item.ImageTags && item.ImageTags.Thumb) { else if (item.ImageTags && item.ImageTags.Thumb) {
imgUrl = ApiClient.getImageUrl(item.Id, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
type: "Thumb", type: "Thumb",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
} }
else if (item.SeriesThumbImageTag) { else if (item.SeriesThumbImageTag) {
imgUrl = ApiClient.getImageUrl(item.SeriesId, { imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, {
type: "Thumb", type: "Thumb",
maxwidth: 576, maxWidth: downloadHeight,
tag: item.SeriesThumbImageTag tag: item.SeriesThumbImageTag
}); });
@ -652,7 +654,7 @@
imgUrl = ApiClient.getThumbImageUrl(item, { imgUrl = ApiClient.getThumbImageUrl(item, {
type: "Thumb", type: "Thumb",
maxwidth: 576 maxWidth: downloadHeight
}); });
} }
@ -958,8 +960,12 @@
var name = item.EpisodeTitle || item.Name; var name = item.EpisodeTitle || item.Name;
if (item.Type == "TvChannel") { if (item.Type == "TvChannel") {
if (item.Number) {
return item.Number + ' ' + name; return item.Number + ' ' + name;
} }
return name;
}
if (displayAsSpecial && item.Type == "Episode" && item.ParentIndexNumber == 0) { if (displayAsSpecial && item.Type == "Episode" && item.ParentIndexNumber == 0) {
name = "Special - " + name; name = "Special - " + name;
@ -1474,45 +1480,45 @@
var url; var url;
var imageHeight = 600; var imageHeight = 280;
if (imageTags.Primary) { if (imageTags.Primary) {
url = ApiClient.getImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Primary", type: "Primary",
maxheight: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Primary tag: item.ImageTags.Primary
}); });
} }
else if (item.BackdropImageTags && item.BackdropImageTags.length) { else if (item.BackdropImageTags && item.BackdropImageTags.length) {
url = ApiClient.getImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Backdrop", type: "Backdrop",
maxheight: imageHeight, maxHeight: imageHeight,
tag: item.BackdropImageTags[0] tag: item.BackdropImageTags[0]
}); });
} }
else if (imageTags.Thumb) { else if (imageTags.Thumb) {
url = ApiClient.getImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Thumb", type: "Thumb",
maxheight: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
} }
else if (imageTags.Disc) { else if (imageTags.Disc) {
url = ApiClient.getImageUrl(item.Id, { url = ApiClient.getScaledImageUrl(item.Id, {
type: "Disc", type: "Disc",
maxheight: imageHeight, maxHeight: imageHeight,
tag: item.ImageTags.Disc tag: item.ImageTags.Disc
}); });
} }
else if (item.AlbumId && item.AlbumPrimaryImageTag) { else if (item.AlbumId && item.AlbumPrimaryImageTag) {
url = ApiClient.getImageUrl(item.AlbumId, { url = ApiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary", type: "Primary",
maxheight: imageHeight, maxHeight: imageHeight,
tag: item.AlbumPrimaryImageTag tag: item.AlbumPrimaryImageTag
}); });
@ -1800,8 +1806,11 @@
if (item.BackdropImageTags && item.BackdropImageTags.length) { if (item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxwidth: screenWidth type: "Backdrop",
index: 0,
maxWidth: screenWidth,
tag: item.BackdropImageTags[0]
}); });
$('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")');
@ -1809,11 +1818,11 @@
} }
else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) { else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
imgUrl = ApiClient.getImageUrl(item.ParentBackdropItemId, { imgUrl = ApiClient.getScaledImageUrl(item.ParentBackdropItemId, {
type: 'Backdrop', type: 'Backdrop',
index: 0, index: 0,
tag: item.ParentBackdropImageTags[0], tag: item.ParentBackdropImageTags[0],
maxwidth: screenWidth maxWidth: screenWidth
}); });
$('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")');
@ -1951,7 +1960,6 @@
createGalleryImage: function (item, type, tag, index) { createGalleryImage: function (item, type, tag, index) {
var screenWidth = Math.max(screen.height, screen.width); var screenWidth = Math.max(screen.height, screen.width);
screenWidth = Math.min(screenWidth, 1280);
var html = ''; var html = '';
@ -1959,8 +1967,9 @@
html += '<div class="galleryImageContainer">'; html += '<div class="galleryImageContainer">';
html += '<a href="#pop_' + index + '_' + tag + '" data-transition="fade" data-rel="popup" data-position-to="window">'; html += '<a href="#pop_' + index + '_' + tag + '" data-transition="fade" data-rel="popup" data-position-to="window">';
html += '<img class="galleryImage" src="' + LibraryBrowser.getImageUrl(item, type, index, { html += '<img class="galleryImage" src="' + LibraryBrowser.getImageUrl(item, type, index, {
maxwidth: screenWidth, maxWidth: screenWidth,
tag: tag tag: tag
}) + '" />'; }) + '" />';
html += '</div>'; html += '</div>';
@ -1969,7 +1978,7 @@
html += '<a href="#" data-rel="back" data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>'; html += '<a href="#" data-rel="back" data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>';
html += '<img class="" src="' + LibraryBrowser.getImageUrl(item, type, index, { html += '<img class="" src="' + LibraryBrowser.getImageUrl(item, type, index, {
maxwidth: screenWidth, maxWidth: screenWidth,
tag: tag tag: tag
}) + '" />'; }) + '" />';

View file

@ -48,8 +48,8 @@
if (parentName && item.ParentLogoItemId) { if (parentName && item.ParentLogoItemId) {
imgUrl = ApiClient.getImageUrl(item.ParentLogoItemId, { imgUrl = ApiClient.getScaledImageUrl(item.ParentLogoItemId, {
height: logoHeight * 2, height: logoHeight,
type: 'logo', type: 'logo',
tag: item.ParentLogoImageTag tag: item.ParentLogoImageTag
}); });
@ -59,8 +59,10 @@
} }
else if (item.ImageTags.Logo) { else if (item.ImageTags.Logo) {
imgUrl = LibraryBrowser.getImageUrl(item, 'Logo', 0, { imgUrl = ApiClient.getScaledImageUrl(item.Id, {
height: logoHeight * 2, height: logoHeight,
type: 'logo',
tag: item.ImageTags.Logo
}); });
html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:' + maxLogoWidth + 'px;" />'; html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:' + maxLogoWidth + 'px;" />';

View file

@ -14,15 +14,26 @@
}); });
} }
function showLoadingMessage(page) {
$('.popupLoading', page).popup('open');
}
function hideLoadingMessage(page) {
$('.popupLoading', page).popup('close');
}
function renderChannels(page, result) { function renderChannels(page, result) {
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
updateFilterControls(this);
var html = getChannelsHtml(result.Items); var html = getChannelsHtml(result.Items);
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create'); $('#items', page).html(html).trigger('create').createPosterItemMenus();
$('.btnNextPage', page).on('click', function () { $('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit; query.StartIndex += query.Limit;
@ -44,13 +55,54 @@
} }
function reloadItems(page) { function reloadItems(page) {
showLoadingMessage(page);
apiClient.getLiveTvChannels(query).done(function (result) { apiClient.getLiveTvChannels(query).done(function (result) {
renderChannels(page, result); renderChannels(page, result);
hideLoadingMessage(page);
}); });
} }
$(document).on('pagebeforeshow', "#liveTvChannelsPage", function () { function updateFilterControls(page) {
$('#chkFavorite', page).checked(query.IsFavorite == true).checkboxradio('refresh');
$('#chkLikes', page).checked(query.IsLiked == true).checkboxradio('refresh');
$('#chkDislikes', page).checked(query.IsDisliked == true).checkboxradio('refresh');
}
$(document).on('pageinit', "#liveTvChannelsPage", function () {
var page = this;
$('#chkFavorite', this).on('change', function () {
query.StartIndex = 0;
query.IsFavorite = this.checked ? true : null;
reloadItems(page);
});
$('#chkLikes', this).on('change', function () {
query.StartIndex = 0;
query.IsLiked = this.checked ? true : null;
reloadItems(page);
});
$('#chkDislikes', this).on('change', function () {
query.StartIndex = 0;
query.IsDisliked = this.checked ? true : null;
reloadItems(page);
});
}).on('pagebeforeshow', "#liveTvChannelsPage", function () {
var page = this; var page = this;
@ -67,6 +119,10 @@
LibraryBrowser.loadSavedQueryValues('movies', query); LibraryBrowser.loadSavedQueryValues('movies', query);
reloadItems(page); reloadItems(page);
}).on('pageshow', "#liveTvChannelsPage", function () {
updateFilterControls(this);
}); });
})(jQuery, document, ApiClient); })(jQuery, document, ApiClient);

View file

@ -16,6 +16,15 @@
}; };
var channelsPromise; var channelsPromise;
function showLoadingMessage(page) {
$('.popupLoading', page).popup('open');
}
function hideLoadingMessage(page) {
$('.popupLoading', page).popup('close');
}
function normalizeDateToTimeslot(date) { function normalizeDateToTimeslot(date) {
var minutesOffset = date.getMinutes() - cellCurationMinutes; var minutesOffset = date.getMinutes() - cellCurationMinutes;
@ -39,7 +48,7 @@
function reloadGuide(page) { function reloadGuide(page) {
Dashboard.showLoadingMsg(); showLoadingMessage(page);
channelQuery.userId = Dashboard.getCurrentUserId(); channelQuery.userId = Dashboard.getCurrentUserId();
@ -64,7 +73,8 @@
}).done(function (programsResult) { }).done(function (programsResult) {
renderGuide(page, date, channelsResult.Items, programsResult.Items); renderGuide(page, date, channelsResult.Items, programsResult.Items);
Dashboard.hideLoadingMsg(); hideLoadingMessage(page);
}); });
var channelPagingHtml = LibraryBrowser.getPagingHtml(channelQuery, channelsResult.TotalRecordCount, false, [10, 20, 30, 50, 100]); var channelPagingHtml = LibraryBrowser.getPagingHtml(channelQuery, channelsResult.TotalRecordCount, false, [10, 20, 30, 50, 100]);
@ -327,9 +337,9 @@
if (channel.ImageTags.Primary) { if (channel.ImageTags.Primary) {
var url = ApiClient.getImageUrl(channel.Id, { var url = ApiClient.getScaledImageUrl(channel.Id, {
maxheight: 200, maxHeight: 35,
maxwidth: 200, maxWidth: 60,
tag: channel.ImageTags.Primary, tag: channel.ImageTags.Primary,
type: "Primary" type: "Primary"
}); });

View file

@ -161,8 +161,8 @@
var programImages = program.ImageTags || {}; var programImages = program.ImageTags || {};
if (programImages.Primary) { if (programImages.Primary) {
imgUrl = ApiClient.getImageUrl(program.Id, { imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 160, height: 80,
tag: programImages.Primary, tag: programImages.Primary,
type: "Primary" type: "Primary"
}); });

View file

@ -39,15 +39,15 @@
if (programInfo.ImageTags && programInfo.ImageTags.Primary) { if (programInfo.ImageTags && programInfo.ImageTags.Primary) {
var imgUrl = ApiClient.getImageUrl(programInfo.Id, { var imgUrl = ApiClient.getScaledImageUrl(programInfo.Id, {
maxwidth: 200, maxWidth: 200,
maxheight: 200, maxHeight: 200,
tag: programInfo.ImageTags.Primary, tag: programInfo.ImageTags.Primary,
type: "Primary" type: "Primary"
}); });
$('.timerPageImageContainer', page).css("display", "inline-block") $('.timerPageImageContainer', page).css("display", "inline-block")
.html('<img src="' + imgUrl + '" />'); .html('<img src="' + imgUrl + '" style="max-width:200px;max-height:200px;" />');
} else { } else {
$('.timerPageImageContainer', page).hide(); $('.timerPageImageContainer', page).hide();

View file

@ -45,8 +45,8 @@
if (program.ImageTags && program.ImageTags.Primary) { if (program.ImageTags && program.ImageTags.Primary) {
imgUrl = ApiClient.getImageUrl(program.Id, { imgUrl = ApiClient.getScaledImageUrl(program.Id, {
height: 160, height: 80,
tag: program.ImageTags.Primary, tag: program.ImageTags.Primary,
type: "Primary" type: "Primary"
}); });

View file

@ -34,7 +34,7 @@
var users = response1[0]; var users = response1[0];
var config = response2[0]; var config = response2[0];
var showManualForm = config.RequireManualLoginForMobileApps || !users.length; var showManualForm = config.RequireMobileManualLogin || !users.length;
if (showManualForm) { if (showManualForm) {

View file

@ -430,8 +430,8 @@
if (chapter.ImageTag) { if (chapter.ImageTag) {
imgUrl = ApiClient.getImageUrl(currentItem.Id, { imgUrl = ApiClient.getScaledImageUrl(currentItem.Id, {
maxwidth: 200, maxWidth: 100,
tag: chapter.ImageTag, tag: chapter.ImageTag,
type: "Chapter", type: "Chapter",
index: i index: i

View file

@ -486,26 +486,26 @@
if (state.NowPlayingItem.PrimaryImageTag) { if (state.NowPlayingItem.PrimaryImageTag) {
url = ApiClient.getImageUrl(state.NowPlayingItem.PrimaryImageItemId, { url = ApiClient.getScaledImageUrl(state.NowPlayingItem.PrimaryImageItemId, {
type: "Primary", type: "Primary",
height: 80, height: 40,
tag: state.NowPlayingItem.PrimaryImageTag tag: state.NowPlayingItem.PrimaryImageTag
}); });
} }
else if (state.NowPlayingItem.BackdropImageTag) { else if (state.NowPlayingItem.BackdropImageTag) {
url = ApiClient.getImageUrl(state.NowPlayingItem.BackdropItemId, { url = ApiClient.getScaledImageUrl(state.NowPlayingItem.BackdropItemId, {
type: "Backdrop", type: "Backdrop",
height: 80, height: 40,
tag: state.NowPlayingItem.BackdropImageTag, tag: state.NowPlayingItem.BackdropImageTag,
index: 0 index: 0
}); });
} else if (state.NowPlayingItem.ThumbImageTag) { } else if (state.NowPlayingItem.ThumbImageTag) {
url = ApiClient.getImageUrl(state.NowPlayingItem.ThumbImageItemId, { url = ApiClient.getScaledImageUrl(state.NowPlayingItem.ThumbImageItemId, {
type: "Thumb", type: "Thumb",
height: 80, height: 40,
tag: state.NowPlayingItem.ThumbImageTag tag: state.NowPlayingItem.ThumbImageTag
}); });
} }

View file

@ -69,6 +69,15 @@
function updateFilterControls(page) { function updateFilterControls(page) {
$('.chkStandardFilter', page).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
} }

View file

@ -68,6 +68,15 @@
function updateFilterControls(page) { function updateFilterControls(page) {
$('.chkStandardFilter', page).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
} }

View file

@ -284,26 +284,26 @@
if (nowPlayingItem.PrimaryImageTag) { if (nowPlayingItem.PrimaryImageTag) {
url = ApiClient.getImageUrl(nowPlayingItem.PrimaryImageItemId, { url = ApiClient.getScaledImageUrl(nowPlayingItem.PrimaryImageItemId, {
type: "Primary", type: "Primary",
height: 80, height: 40,
tag: nowPlayingItem.PrimaryImageTag tag: nowPlayingItem.PrimaryImageTag
}); });
} }
else if (nowPlayingItem.BackdropImageTag) { else if (nowPlayingItem.BackdropImageTag) {
url = ApiClient.getImageUrl(nowPlayingItem.BackdropItemId, { url = ApiClient.getScaledImageUrl(nowPlayingItem.BackdropItemId, {
type: "Backdrop", type: "Backdrop",
height: 80, height: 40,
tag: nowPlayingItem.BackdropImageTag, tag: nowPlayingItem.BackdropImageTag,
index: 0 index: 0
}); });
} else if (nowPlayingItem.ThumbImageTag) { } else if (nowPlayingItem.ThumbImageTag) {
url = ApiClient.getImageUrl(nowPlayingItem.ThumbImageItemId, { url = ApiClient.getScaledImageUrl(nowPlayingItem.ThumbImageItemId, {
type: "Thumb", type: "Thumb",
height: 80, height: 40,
tag: nowPlayingItem.ThumbImageTag tag: nowPlayingItem.ThumbImageTag
}); });
} }

View file

@ -18,8 +18,8 @@
if (chapter.ImageTag) { if (chapter.ImageTag) {
imgUrl = ApiClient.getImageUrl(itemId, { imgUrl = ApiClient.getScaledImageUrl(itemId, {
width: 800, width: 240,
tag: chapter.ImageTag, tag: chapter.ImageTag,
type: "Chapter", type: "Chapter",
index: i index: i
@ -509,26 +509,26 @@
} }
else if (item.PrimaryImageTag) { else if (item.PrimaryImageTag) {
url = ApiClient.getImageUrl(item.PrimaryImageItemId, { url = ApiClient.getScaledImageUrl(item.PrimaryImageItemId, {
type: "Primary", type: "Primary",
height: 600, height: 300,
tag: item.PrimaryImageTag tag: item.PrimaryImageTag
}); });
} }
else if (item.BackdropImageTag) { else if (item.BackdropImageTag) {
url = ApiClient.getImageUrl(item.BackdropItemId, { url = ApiClient.getScaledImageUrl(item.BackdropItemId, {
type: "Backdrop", type: "Backdrop",
height: 600, height: 300,
tag: item.BackdropImageTag, tag: item.BackdropImageTag,
index: 0 index: 0
}); });
} else if (item.ThumbImageTag) { } else if (item.ThumbImageTag) {
url = ApiClient.getImageUrl(item.ThumbImageItemId, { url = ApiClient.getScaledImageUrl(item.ThumbImageItemId, {
type: "Thumb", type: "Thumb",
height: 600, height: 300,
tag: item.ThumbImageTag tag: item.ThumbImageTag
}); });
} }

View file

@ -77,7 +77,13 @@
if (hint.PrimaryImageTag) { if (hint.PrimaryImageTag) {
hint.ImageTags = { Primary: hint.PrimaryImageTag }; hint.ImageTags = { Primary: hint.PrimaryImageTag };
imgUrl = LibraryBrowser.getImageUrl(hint, "Primary", 0, { maxwidth: 150, maxheight: 150 });
imgUrl = ApiClient.getImageUrl(hint.ItemId, {
type: "Primary",
maxWidth: 150,
maxHeight: 150,
tag: hint.PrimaryImageTag
});
} }
else if (hint.MediaType == "Game") { else if (hint.MediaType == "Game") {

View file

@ -1129,8 +1129,8 @@ var Dashboard = {
if (imageTags.Primary) { if (imageTags.Primary) {
notification.icon = ApiClient.getImageUrl(item.Id, { notification.icon = ApiClient.getScaledImageUrl(item.Id, {
width: 100, width: 60,
tag: imageTags.Primary, tag: imageTags.Primary,
type: "Primary" type: "Primary"
}); });

View file

@ -2198,34 +2198,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
return self.getUrl(url, options); return self.getUrl(url, options);
}; };
/** self.getScaledImageUrl = function (itemId, options) {
* Constructs a url for an item logo image
* If the item doesn't have a logo, it will inherit a logo from a parent
* @param {Object} item A BaseItem
* @param {Object} options
* Options supports the following properties:
* width - download the image at a fixed width
* height - download the image at a fixed height
* maxWidth - download the image at a maxWidth
* maxHeight - download the image at a maxHeight
* quality - A scale of 0-100. This should almost always be omitted as the default will suffice.
* For best results do not specify both width and height together, as aspect ratio might be altered.
*/
self.getLogoImageUrl = function (item, options) {
if (!item) { if (!itemId) {
throw new Error("null item"); throw new Error("itemId cannot be empty");
} }
options = options || { options = options || {};
}; var url = "Items/" + itemId + "/Images/" + options.type;
options.imageType = "logo"; if (options.index != null) {
url += "/" + options.index;
}
var logoItemId = item.ImageTags && item.ImageTags.Logo ? item.Id : item.ParentLogoItemId; // Don't put these on the query string
delete options.type;
delete options.index;
return logoItemId ? self.getImageUrl(logoItemId, options) : null; normalizeImageOptions(options);
return self.getUrl(url, options);
}; };
self.getThumbImageUrl = function (item, options) { self.getThumbImageUrl = function (item, options) {
@ -2245,58 +2238,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
return itemId ? self.getImageUrl(itemId, options) : null; return itemId ? self.getImageUrl(itemId, options) : null;
}; };
/**
* Constructs an array of backdrop image url's for an item
* If the item doesn't have any backdrops, it will inherit them from a parent
* @param {Object} item A BaseItem
* @param {Object} options
* Options supports the following properties:
* width - download the image at a fixed width
* height - download the image at a fixed height
* maxWidth - download the image at a maxWidth
* maxHeight - download the image at a maxHeight
* quality - A scale of 0-100. This should almost always be omitted as the default will suffice.
* For best results do not specify both width and height together, as aspect ratio might be altered.
*/
self.getBackdropImageUrl = function (item, options) {
if (!item) {
throw new Error("null item");
}
options = options || {
};
options.imageType = "backdrop";
var backdropItemId;
var backdropCount;
if (!item.BackdropCount) {
backdropItemId = item.ParentBackdropItemId;
backdropCount = item.ParentBackdropCount || 0;
} else {
backdropItemId = item.Id;
backdropCount = item.BackdropCount;
}
if (!backdropItemId) {
return [];
}
var files = [];
for (var i = 0; i < backdropCount; i++) {
options.imageIndex = i;
files[i] = self.getImageUrl(backdropItemId, options);
}
return files;
};
/** /**
* Authenticates a user * Authenticates a user
* @param {String} name * @param {String} name