diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 472dc0d36b..6ae86cefd5 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -14,12 +14,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.132", - "_release": "1.4.132", + "version": "1.4.135", + "_release": "1.4.135", "_resolution": { "type": "version", - "tag": "1.4.132", - "commit": "4af41910495a11c5f3fdfcdc9821c1944d4da439" + "tag": "1.4.135", + "commit": "769b3fed535db71b82c65e113ac39505078a2a82" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/chaptercardbuilder.js b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/chaptercardbuilder.js index 0d7d4eebff..6d53561450 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/chaptercardbuilder.js +++ b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/chaptercardbuilder.js @@ -1,4 +1,4 @@ -define(['datetime', 'imageLoader', 'itemShortcuts', 'connectionManager'], function (datetime, imageLoader, itemShortcuts, connectionManager) { +define(['datetime', 'imageLoader', 'connectionManager'], function (datetime, imageLoader, connectionManager) { function buildChapterCardsHtml(item, chapters, options) { @@ -9,12 +9,12 @@ define(['datetime', 'imageLoader', 'itemShortcuts', 'connectionManager'], functi return i.Type == 'Video'; })[0] || {}; - var shape = 'backdropCard'; + var shape = (options.backdropShape || 'backdrop') + 'Card'; if (videoStream.Width && videoStream.Height) { if ((videoStream.Width / videoStream.Height) <= 1.34) { - shape = 'squareCard'; + shape = (options.squareShape || 'square') + 'Card'; } } @@ -121,9 +121,6 @@ define(['datetime', 'imageLoader', 'itemShortcuts', 'connectionManager'], functi options.itemsContainer.innerHTML = html; imageLoader.lazyChildren(options.itemsContainer); - - itemShortcuts.off(options.itemsContainer); - itemShortcuts.on(options.itemsContainer); } return { diff --git a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/peoplecardbuilder.js b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/peoplecardbuilder.js index dd6accc7eb..ead14f49c4 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/peoplecardbuilder.js +++ b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/peoplecardbuilder.js @@ -1,8 +1,8 @@ -define(['imageLoader', 'itemShortcuts'], function (imageLoader, itemShortcuts) { +define(['imageLoader', 'itemShortcuts', 'connectionManager'], function (imageLoader, itemShortcuts, connectionManager) { function buildPeopleCardsHtml(people, options) { - var className = 'card portraitCard personCard'; + var className = 'card ' + (options.shape || 'portrait') + 'Card personCard'; if (options.block || options.rows) { className += ' block'; @@ -12,6 +12,7 @@ define(['imageLoader', 'itemShortcuts'], function (imageLoader, itemShortcuts) { var itemsInRow = 0; var serverId = options.serverId; + var apiClient = connectionManager.getApiClient(serverId); for (var i = 0, length = people.length; i < length; i++) { @@ -21,7 +22,7 @@ define(['imageLoader', 'itemShortcuts'], function (imageLoader, itemShortcuts) { var person = people[i]; - html += buildPersonCard(person, serverId, options, className); + html += buildPersonCard(person, apiClient, serverId, options, className); itemsInRow++; if (options.rows && itemsInRow >= options.rows) { @@ -33,11 +34,26 @@ define(['imageLoader', 'itemShortcuts'], function (imageLoader, itemShortcuts) { return html; } - function buildPersonCard(person, serverId, options, className) { + function getImgUrl(person, maxWidth, apiClient) { + + if (person.PrimaryImageTag) { + + return apiClient.getScaledImageUrl(person.Id, { + + maxWidth: maxWidth, + tag: person.PrimaryImageTag, + type: "Primary" + }); + } + + return null; + } + + function buildPersonCard(person, apiClient, serverId, options, className) { className += " itemAction scalableCard"; - var imgUrl = person.images ? person.images.primary : ''; + var imgUrl = getImgUrl(person, options.width, apiClient); var cardImageContainerClass = 'cardImageContainer'; if (options.coverImage) { @@ -79,12 +95,12 @@ define(['imageLoader', 'itemShortcuts'], function (imageLoader, itemShortcuts) { function buildPeopleCards(items, options) { - // Abort if the container has been disposed - if (!document.body.contains(options.parentContainer)) { - return; - } - if (options.parentContainer) { + // Abort if the container has been disposed + if (!document.body.contains(options.parentContainer)) { + return; + } + if (items.length) { options.parentContainer.classList.remove('hide'); } else { diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js index 3cbc378ed5..11eb5bae32 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js @@ -87,7 +87,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', }); } - if (isMobileApp && options.identify !== false) { + if (options.identify !== false) { if (itemHelper.canIdentify(user, item.Type)) { commands.push({ name: globalize.translate('sharedcomponents#Identify'), @@ -298,7 +298,6 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', { require(['subtitleEditor'], function (subtitleEditor) { - var serverId = apiClient.serverInfo().Id; subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }); break; @@ -318,9 +317,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter', } case 'identify': { - require(['components/itemidentifier/itemidentifier'], function (itemidentifier) { + require(['itemIdentifier'], function (itemIdentifier) { - itemidentifier.show(itemId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); + itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); }); break; } diff --git a/dashboard-ui/components/itemidentifier/itemidentifier.js b/dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.js similarity index 88% rename from dashboard-ui/components/itemidentifier/itemidentifier.js rename to dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.js index 630fb82b3e..988def9855 100644 --- a/dashboard-ui/components/itemidentifier/itemidentifier.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.js @@ -1,12 +1,17 @@ -define(['dialogHelper', 'loading', 'cardBuilder', 'emby-input', 'emby-checkbox', 'paper-icon-button-light'], function (dialogHelper, loading, cardBuilder) { +define(['dialogHelper', 'loading', 'cardBuilder', 'connectionManager', 'require', 'globalize', 'emby-input', 'emby-checkbox', 'paper-icon-button-light'], function (dialogHelper, loading, cardBuilder, connectionManager, require, globalize) { var currentItem; var currentItemType; + var currentServerId; var currentResolve; var currentReject; var hasChanges = false; var currentSearchResult; + function getApiClient() { + return connectionManager.getApiClient(currentServerId); + } + function searchForIdentificationResults(page) { var lookupInfo = { @@ -44,7 +49,7 @@ if (!hasId && !lookupInfo.Name) { require(['toast'], function (toast) { - toast(Globalize.translate('MessagePleaseEnterNameOrId')); + toast(globalize.translate('MessagePleaseEnterNameOrId')); }); return; } @@ -60,9 +65,11 @@ loading.show(); - ApiClient.ajax({ + var apiClient = getApiClient(); + + apiClient.ajax({ type: "POST", - url: ApiClient.getUrl("Items/RemoteSearch/" + currentItemType), + url: apiClient.getUrl("Items/RemoteSearch/" + currentItemType), data: JSON.stringify(lookupInfo), contentType: "application/json", dataType: 'json' @@ -203,7 +210,9 @@ } function getSearchImageDisplayUrl(url, provider) { - return ApiClient.getUrl("Items/RemoteSearch/Image", { imageUrl: url, ProviderName: provider }); + var apiClient = getApiClient(); + + return apiClient.getUrl("Items/RemoteSearch/Image", { imageUrl: url, ProviderName: provider }); } function submitIdentficationResult(page) { @@ -214,9 +223,11 @@ ReplaceAllImages: page.querySelector('#chkIdentifyReplaceImages').checked }; - ApiClient.ajax({ + var apiClient = getApiClient(); + + apiClient.ajax({ type: "POST", - url: ApiClient.getUrl("Items/RemoteSearch/Apply/" + currentItem.Id, options), + url: apiClient.getUrl("Items/RemoteSearch/Apply/" + currentItem.Id, options), data: JSON.stringify(currentSearchResult), contentType: "application/json" @@ -251,7 +262,7 @@ html += '
'; - var idLabel = Globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name); + var idLabel = globalize.translate('LabelDynamicExternalId').replace('{0}', idInfo.Name); var value = providerIds[idInfo.Key] || ''; @@ -274,7 +285,7 @@ page.querySelector('.identifyProviderIds').innerHTML = html; - page.querySelector('.dialogHeaderTitle').innerHTML = Globalize.translate('HeaderIdentify'); + page.querySelector('.dialogHeaderTitle').innerHTML = globalize.translate('HeaderIdentify'); }); } @@ -282,13 +293,11 @@ loading.show(); - var xhr = new XMLHttpRequest(); - xhr.open('GET', 'components/itemidentifier/itemidentifier.template.html', true); + require(['text!./itemidentifier.template.html'], function (template) { - xhr.onload = function (e) { + var apiClient = getApiClient(); - var template = this.response; - ApiClient.getItem(ApiClient.getCurrentUserId(), itemId).then(function (item) { + apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) { currentItem = item; currentItemType = currentItem.Type; @@ -302,7 +311,7 @@ dlg.classList.add('background-theme-b'); var html = ''; - html += Globalize.translateDocument(template); + html += globalize.translateDocument(template); dlg.innerHTML = html; document.body.appendChild(dlg); @@ -336,9 +345,7 @@ showIdentificationForm(dlg, item); loading.hide(); }); - } - - xhr.send(); + }); } function onDialogClosed() { @@ -356,13 +363,8 @@ currentItem = null; currentItemType = itemType; - var xhr = new XMLHttpRequest(); - xhr.open('GET', 'components/itemidentifier/itemidentifier.template.html', true); - - xhr.onload = function (e) { - - var template = this.response; - + require(['text!./itemidentifier.template.html'], function (template) { + var dlg = dialogHelper.createDialog({ size: 'medium' }); @@ -371,7 +373,7 @@ dlg.classList.add('background-theme-a'); var html = ''; - html += Globalize.translateDocument(template); + html += globalize.translateDocument(template); dlg.innerHTML = html; document.body.appendChild(dlg); @@ -401,9 +403,7 @@ dlg.classList.add('identifyDialog'); showIdentificationFormFindNew(dlg, itemName, itemYear, itemType); - } - - xhr.send(); + }); } function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) { @@ -421,25 +421,29 @@ dlg.querySelector('#txtLookupYear').value = itemYear; } - dlg.querySelector('.dialogHeaderTitle').innerHTML = Globalize.translate('HeaderSearch'); + dlg.querySelector('.dialogHeaderTitle').innerHTML = globalize.translate('HeaderSearch'); } return { - show: function (itemId) { + show: function (itemId, serverId) { return new Promise(function (resolve, reject) { currentResolve = resolve; currentReject = reject; + currentServerId = serverId; hasChanges = false; showEditor(itemId); }); }, - showFindNew: function (itemName, itemYear, itemType) { + showFindNew: function (itemName, itemYear, itemType, serverId) { + return new Promise(function (resolve, reject) { + currentServerId = serverId; + hasChanges = false; showEditorFindNew(itemName, itemYear, itemType, resolve); }); diff --git a/dashboard-ui/components/itemidentifier/itemidentifier.template.html b/dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.template.html similarity index 100% rename from dashboard-ui/components/itemidentifier/itemidentifier.template.html rename to dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.template.html diff --git a/dashboard-ui/components/fileorganizer/fileorganizer.js b/dashboard-ui/components/fileorganizer/fileorganizer.js index b6d3f407bb..33dce8dd1c 100644 --- a/dashboard-ui/components/fileorganizer/fileorganizer.js +++ b/dashboard-ui/components/fileorganizer/fileorganizer.js @@ -156,9 +156,9 @@ return; } - require(['components/itemidentifier/itemidentifier'], function (itemidentifier) { + require(['itemIdentifier'], function (itemIdentifier) { - itemidentifier.showFindNew(extractedName, extractedYear, 'Series').then(function (newItem) { + itemIdentifier.showFindNew(extractedName, extractedYear, 'Series', ApiClient.serverId()).then(function (newItem) { if (newItem != null) { currentNewItem = newItem; diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 7f48c2e6b4..1f8d5a5b33 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -1054,4 +1054,8 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { .itemDetailPage .scalableCard.backdropCard, .itemDetailPage .scalableCard.smallBackdropCard { width: 33.3333333333333333% !important; } + + .itemDetailPage .personCard.portraitCard { + width: 16.666666666666666666666666666667% !important; + } } diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index b63cbdb00b..68d71979ab 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -94,7 +94,8 @@

${HeaderCastCrew}

-
+
+
@@ -153,7 +154,7 @@ -
+
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 6b81997769..0a06c1bbc7 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -450,7 +450,7 @@ page.querySelector('#castCollapsible').classList.add('hide'); } else { page.querySelector('#castCollapsible').classList.remove('hide'); - renderCast(page, item, context, enableScrollX() ? null : 6); + renderCast(page, item, context, enableScrollX() ? null : 12); } if (item.PartCount && item.PartCount > 1) { @@ -1606,7 +1606,9 @@ chaptercardbuilder.buildChapterCards(item, chapters, { itemsContainer: scenesContent, coverImage: true, - width: 400 + width: 400, + backdropShape: getThumbShape(), + squareShape: getSquareShape() }); }); @@ -1869,232 +1871,39 @@ function renderCast(page, item, context, limit, isStatic) { - if (enableScrollX()) { - renderHorizontalCast(page, item, context, isStatic); - return; - } - - var html = ''; - - var casts = item.People || []; - - for (var i = 0, length = casts.length; i < length; i++) { - - if (limit && i >= limit) { - break; - } - - var cast = casts[i]; - var href = isStatic ? '#' : 'itemdetails.html?id=' + cast.Id + ''; - html += ''; - - var imgUrl; - var lazy = true; - - if (cast.PrimaryImageTag) { - - imgUrl = ApiClient.getScaledImageUrl(cast.Id, { - maxWidth: 100, - tag: cast.PrimaryImageTag, - type: "primary", - minScale: 2 - }); - - } else { - - imgUrl = "css/images/items/list/person.png"; - lazy = false; - } - - if (lazy) { - html += '
'; - } else { - html += '
'; - } - - html += '
'; - - html += '

' + cast.Name + '

'; - - var role = cast.Role ? Globalize.translate('ValueAsRole', cast.Role) : cast.Type; - - if (role == "GuestStar") { - role = Globalize.translate('ValueGuestStar'); - } - - role = role || ""; - - var maxlength = 40; - - if (role.length > maxlength) { - role = role.substring(0, maxlength - 3) + '...'; - } - - html += '

' + role + '

'; - - html += '
'; - - html += '
'; - } - - if (limit && casts.length > limit) { - html += '

'; - } - + var people = item.People || []; var castContent = page.querySelector('#castContent'); - castContent.innerHTML = html; - ImageLoader.lazyChildren(castContent); - } - - function renderHorizontalCast(page, item, context, isStatic) { - - var html = ''; if (enableScrollX()) { - html += '
'; + castContent.classList.add('smoothScrollX'); + limit = 32; } else { - html += '
'; + castContent.classList.add('vertical-wrap'); } - var casts = item.People || []; + var limitExceeded = limit && people.length > limit; - casts = casts.filter(function (c) { + if (limitExceeded) { + people = people.slice(0); + people.length = Math.min(limit, people.length); + } - return c.PrimaryImageTag; + require(['peoplecardbuilder'], function (peoplecardbuilder) { + + peoplecardbuilder.buildPeopleCards(people, { + itemsContainer: castContent, + coverImage: true, + serverId: item.ServerId, + width: 160, + shape: getPortraitShape() + }); }); - if (!casts.length) { - casts = item.People || []; + if (limitExceeded && !enableScrollX()) { + page.querySelector('.morePeople').classList.remove('hide'); + } else { + page.querySelector('.morePeople').classList.add('hide'); } - - for (var i = 0, length = casts.length; i < length; i++) { - - var cast = casts[i]; - var href = isStatic ? '#' : 'itemdetails.html?id=' + cast.Id + ''; - - html += '
'; - - html += '
'; - html += '
'; - - var imgUrl; - var lazy = true; - - if (cast.PrimaryImageTag) { - - imgUrl = ApiClient.getScaledImageUrl(cast.Id, { - maxWidth: 100, - tag: cast.PrimaryImageTag, - type: "primary", - minScale: 2 - }); - - } else { - - imgUrl = "css/images/items/list/person.png"; - lazy = false; - } - - html += '
'; - - html += ''; - if (lazy) { - html += '
'; - } else { - html += '
'; - } - - //cardFooter - html += "
"; - - // cardContent - html += ''; - - // cardScalable - html += '
'; - - html += '
'; - html += '
' + cast.Name + '
'; - html += '
'; - - var role = cast.Role ? Globalize.translate('ValueAsRole', cast.Role) : cast.Type; - - if (role == "GuestStar") { - role = Globalize.translate('ValueGuestStar'); - } - - role = role || ""; - - var maxlength = 40; - - if (role.length > maxlength) { - role = role.substring(0, maxlength - 3) + '...'; - } - - html += role; - html += '
'; - - // cardBox - html += '
'; - - html += '
'; - - //html += ''; - - //var imgUrl; - //var lazy = true; - - //if (cast.PrimaryImageTag) { - - // imgUrl = ApiClient.getScaledImageUrl(cast.Id, { - // width: 100, - // tag: cast.PrimaryImageTag, - // type: "primary", - // minScale: 2 - // }); - - //} else { - - // imgUrl = "css/images/items/list/person.png"; - // lazy = false; - //} - - //if (lazy) { - // html += '
'; - //} else { - // html += '
'; - //} - - //html += '
'; - - //html += '

' + cast.Name + '

'; - - //var role = cast.Role ? Globalize.translate('ValueAsRole', cast.Role) : cast.Type; - - //if (role == "GuestStar") { - // role = Globalize.translate('ValueGuestStar'); - //} - - //role = role || ""; - - //var maxlength = 40; - - //if (role.length > maxlength) { - // role = role.substring(0, maxlength - 3) + '...'; - //} - - //html += '

' + role + '

'; - - //html += '
'; - - //html += '
'; - } - - html += '
'; - - var castContent = page.querySelector('#castContent'); - castContent.innerHTML = html; - ImageLoader.lazyChildren(castContent); } function play(startPosition) { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index beca211490..c170cef3f3 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1420,6 +1420,7 @@ var AppInfo = {}; define("recordingCreator", [embyWebComponentsBowerPath + "/recordingcreator/recordingcreator"], returnFirstDependency); define("recordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/recordingeditor"], returnFirstDependency); define("subtitleEditor", [embyWebComponentsBowerPath + "/subtitleeditor/subtitleeditor"], returnFirstDependency); + define("itemIdentifier", [embyWebComponentsBowerPath + "/itemidentifier/itemidentifier"], returnFirstDependency); define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency); define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency); define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency);