rework slideup menus to use shared components

This commit is contained in:
Luke Pulverenti 2016-07-17 22:55:07 -04:00
parent 7323e865f2
commit 63efbfc838
28 changed files with 521 additions and 392 deletions

View File

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.94",
"_release": "1.4.94",
"version": "1.4.96",
"_release": "1.4.96",
"_resolution": {
"type": "version",
"tag": "1.4.94",
"commit": "1914cf851948d6f4f5e730c5e831e5e604fe3c9e"
"tag": "1.4.96",
"commit": "4c9f9b8c4937da15ac8c81d554e768f0ef6e944e"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View File

@ -7,7 +7,7 @@
while (!elem.getAttribute(name)) {
elem = elem.parentNode;
if (!elem) {
if (!elem || !elem.getAttribute) {
return null;
}
}
@ -62,6 +62,26 @@
};
}
ItemsContainerProtoType.enableHoverMenu = function (enabled) {
var current = this.hoverMenu;
if (!enabled && current) {
current.destroy();
this.hoverMenu = null;
return;
}
if (current) {
return;
}
var self = this;
require(['itemHoverMenu'], function (ItemHoverMenu) {
self.hoverMenu = new ItemHoverMenu(self);
});
};
ItemsContainerProtoType.attachedCallback = function () {
this.addEventListener('click', onClick);
@ -73,6 +93,10 @@
this.addEventListener('contextmenu', onContextMenu);
}
if (layoutManager.desktop) {
this.enableHoverMenu(true);
}
itemShortcuts.on(this, getShortcutOptions());
};

View File

@ -43,11 +43,20 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (!isTheater) {
if (options.edit !== false) {
var text = item.Type == 'Timer' ? globalize.translate('sharedcomponents#Edit') : globalize.translate('sharedcomponents#EditInfo');
commands.push({
name: globalize.translate('sharedcomponents#EditInfo'),
name: text,
id: 'edit'
});
}
}
}
if (itemHelper.canEditImages(user, item.Type)) {
if (!isTheater) {
if (options.editImages !== false) {
commands.push({
name: globalize.translate('sharedcomponents#EditImages'),
@ -55,6 +64,10 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
});
}
}
}
if (itemHelper.canEdit(user, item.Type)) {
if (item.MediaType == 'Video' && item.Type != 'TvChannel' && item.Type != 'Program' && item.LocationType != 'Virtual') {
if (options.editSubtitles !== false) {
commands.push({

View File

@ -69,6 +69,20 @@ define(['apphost'], function (appHost) {
return item.RunTimeTicks || item.IsFolder || item.Type == "Genre" || item.Type == "MusicGenre" || item.Type == "MusicArtist";
}
function canEdit(user, itemType) {
if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") {
return false;
}
if (user.Policy.IsAdministrator) {
return true;
}
return false;
}
return {
getDisplayName: getDisplayName,
supportsAddingToCollection: supportsAddingToCollection,
@ -95,18 +109,11 @@ define(['apphost'], function (appHost) {
return false;
},
canEdit: function (user, itemType) {
canEdit: canEdit,
if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") {
return false;
}
canEditImages: function (user, itemType) {
if (user.Policy.IsAdministrator) {
return true;
}
return false;
return itemType != 'Timer' && canEdit(user, itemType);
},
canSync: function (user, item) {

View File

@ -0,0 +1,51 @@
.cardOverlayTarget {
position: absolute;
right: 0;
left: 0;
bottom: 0;
top: 0;
background-color: rgba(0, 0, 0, .85);
z-index: 998;
line-height: initial;
}
.cardOverlayInner {
padding: 11px 12px 10px;
color: #fff;
}
.cardOverlayInner button:last-child {
margin-right: 0 !important;
}
.cardOverlayInner p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cardOverlayMediaInfo {
display: flex;
align-items: center;
flex-wrap: wrap;
margin: 1em 0;
color: #ddd;
}
.cardOverlayButtons {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.cardOverlayButtons .fab {
background-color: #333;
}
@media all and (max-width: 1200px) {
.cardOverlayInner {
padding-left: 7px;
padding-right: 7px;
}
}

View File

@ -0,0 +1,280 @@
define(['connectionManager', 'itemHelper', 'mediaInfo', 'userdataButtons', 'playbackManager', 'globalize', 'css!./itemhovermenu', 'emby-button'], function (connectionManager, itemHelper, mediaInfo, userdataButtons, playbackManager, globalize) {
var preventHover = false;
var showOverlayTimeout;
var hoveringElement;
function parentWithAttribute(elem, name) {
while (!elem.getAttribute(name)) {
elem = elem.parentNode;
if (!elem || !elem.getAttribute) {
return null;
}
}
return elem;
}
function onHoverOut(e) {
var elem = e.target;
if (elem != hoveringElement) {
return;
}
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
elem = elem.querySelector('.cardOverlayTarget');
if (elem) {
slideDownToHide(elem);
}
}
function slideDownToHide(elem) {
if (elem.classList.contains('hide')) {
return;
}
if (!elem.animate) {
elem.classList.add('hide');
return;
}
requestAnimationFrame(function () {
var keyframes = [
{ transform: 'translateY(0)', offset: 0 },
{ transform: 'translateY(100%)', offset: 1 }];
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () {
elem.classList.add('hide');
};
});
}
function slideUpToShow(elem) {
if (!elem.classList.contains('hide')) {
return;
}
elem.classList.remove('hide');
if (!elem.animate) {
return;
}
requestAnimationFrame(function () {
var keyframes = [
{ transform: 'translateY(100%)', offset: 0 },
{ transform: 'translateY(0)', offset: 1 }];
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing);
});
}
function getOverlayHtml(item, currentUser, card) {
var html = '';
html += '<div class="cardOverlayInner">';
var className = card.className.toLowerCase();
var isMiniItem = className.indexOf('mini') != -1;
var isSmallItem = isMiniItem || className.indexOf('small') != -1;
var isPortrait = className.indexOf('portrait') != -1;
var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName;
var name = itemHelper.getDisplayName(item);
html += '<div>';
var logoHeight = isSmallItem || isMiniItem ? 20 : 26;
var imgUrl;
if (parentName && item.ParentLogoItemId) {
imgUrl = ApiClient.getScaledImageUrl(item.ParentLogoItemId, {
maxHeight: logoHeight,
type: 'logo',
tag: item.ParentLogoImageTag
});
html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:100%;" />';
}
else if (item.ImageTags.Logo) {
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxHeight: logoHeight,
type: 'logo',
tag: item.ImageTags.Logo
});
html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:100%;" />';
}
else {
html += parentName || name;
}
html += '</div>';
if (parentName) {
html += '<p>';
html += name;
html += '</p>';
} else if (!isSmallItem && !isMiniItem) {
html += '<div class="cardOverlayMediaInfo">';
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
endsAt: false
});
html += '</div>';
}
html += '<div class="cardOverlayButtons">';
var buttonCount = 0;
if (playbackManager.canPlay(item)) {
html += '<button is="emby-button" class="itemAction autoSize fab mini" data-action="playmenu"><i class="md-icon">&#xE037;</i></button>';
buttonCount++;
}
if (item.LocalTrailerCount) {
html += '<button title="' + globalize.translate('sharedcomponents#Trailer') + '" is="emby-button" class="itemAction autoSize fab mini" data-action="playtrailer"><i class="md-icon">&#xE04B;</i></button>';
buttonCount++;
}
html += '<button is="emby-button" class="itemAction autoSize fab mini" data-action="menu" data-playoptions="false"><i class="md-icon">&#xE5D4;</i></button>';
buttonCount++;
html += userdataButtons.getIconsHtml({
item: item,
style: 'fab-mini'
});
html += '</div>';
html += '</div>';
return html;
}
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function onShowTimerExpired(elem) {
elem = elem.querySelector('a');
var innerElem = elem.querySelector('.cardOverlayTarget');
if (!innerElem) {
innerElem = document.createElement('div');
innerElem.classList.add('hide');
innerElem.classList.add('cardOverlayTarget');
parentWithClass(elem, 'cardContent').appendChild(innerElem);
}
var dataElement = parentWithAttribute(elem, 'data-id');
var id = dataElement.getAttribute('data-id');
var type = dataElement.getAttribute('data-type');
if (type == 'Timer') {
return;
}
var serverId = dataElement.getAttribute('data-serverid');
var apiClient = connectionManager.getApiClient(serverId);
var promise1 = apiClient.getItem(apiClient.getCurrentUserId(), id);
var promise2 = apiClient.getCurrentUser();
Promise.all([promise1, promise2]).then(function (responses) {
var item = responses[0];
var user = responses[1];
var card = elem;
elem = parentWithAttribute(elem, 'data-id');
innerElem.innerHTML = getOverlayHtml(item, user, card);
});
slideUpToShow(innerElem);
}
function onHoverIn(e) {
var elem = e.target;
if (!elem.classList.contains('cardImage')) {
return;
}
if (preventHover === true) {
preventHover = false;
return;
}
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
elem = parentWithAttribute(elem, 'data-id');
hoveringElement = elem;
showOverlayTimeout = setTimeout(function () {
onShowTimerExpired(elem);
}, 1200);
}
function preventTouchHover() {
preventHover = true;
}
function ItemHoverMenu(parentElement) {
this.parent = parentElement;
this.parent.addEventListener('mouseenter', onHoverIn, true);
this.parent.addEventListener('mouseleave', onHoverOut, true);
this.parent.addEventListener("touchstart", preventTouchHover);
}
ItemHoverMenu.prototype = {
constructor: ItemHoverMenu,
destroy: function () {
this.parent.removeEventListener('mouseenter', onHoverIn, true);
this.parent.removeEventListener('mouseleave', onHoverOut, true);
this.parent.removeEventListener("touchstart", preventTouchHover);
}
}
return ItemHoverMenu;
});

View File

@ -293,7 +293,10 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (!clickEntireItem) {
html += '<button is="paper-icon-button-light" class="itemAction autoSize" data-action="menu"><i class="md-icon">&#xE5D4;</i></button>';
html += '<span class="listViewUserDataButtons">';
html += userdataButtons.getIconsHtml(item, false);
html += userdataButtons.getIconsHtml({
item: item,
includePlayed: false
});
html += '</span>';
}

View File

@ -99,6 +99,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
var apiClient = connectionManager.getApiClient(serverId);
if (type == 'Timer') {
return apiClient.getLiveTvTimer(id);
}
return apiClient.getItem(apiClient.getCurrentUserId(), id);
}
@ -165,6 +168,8 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
function executeAction(card, target, action) {
target = target || card;
var id = card.getAttribute('data-id');
if (!id) {
@ -217,14 +222,26 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}
else if (action == 'menu') {
showContextMenu(card, {
identify: false,
positionTo: target || card
});
var options = target.getAttribute('data-playoptions') == 'false' ?
{
shuffle: false,
instantMix: false,
play: false,
playAllFromHere: false,
queue: false,
queueAllFromHere: false
} :
{};
options.identify = false;
options.positionTo = target;
showContextMenu(card, options);
}
else if (action == 'playmenu') {
showPlayMenu(card, target || card);
showPlayMenu(card, target);
}
}
@ -318,7 +335,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}
if (action) {
executeAction(card, e.target, action);
executeAction(card, actionElement, action);
e.preventDefault();
e.stopPropagation();
@ -332,7 +349,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
while ((value ? elem.getAttribute(name) != value : !elem.getAttribute(name))) {
elem = elem.parentNode;
if (!elem) {
if (!elem || !elem.getAttribute) {
return null;
}
}
@ -356,7 +373,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
function onCommand(e) {
var cmd = e.detail.command;
if (cmd == 'play' || cmd == 'record') {
if (cmd == 'play' || cmd == 'record' || cmd == 'menu' || cmd == 'info') {
var card = parentWithClass(e.target, 'itemAction');
if (card) {

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Special - {0}",
"Share": "Del",
"ServerUpdateNeeded": "Denne Emby server b\u00f8r opdateres. For at downloade den nyeste version bes\u00f8g venligst {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Special - {0}",
"Share": "Teilen",
"ServerUpdateNeeded": "Dieser Emby Server sollte aktualisiert werden. Um die neueste Version zu laden, besuche bitte {0}",

View File

@ -113,6 +113,7 @@
"QueueAllFromHere": "Queue All from Here",
"PlayAllFromHere": "Play All from Here",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume at {0}",
"RemoveFromPlaylist": "Remove from Playlist"
"ResumeAt": "Resume from {0}",
"RemoveFromPlaylist": "Remove from Playlist",
"Trailer": "Trailer"
}

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Compartir",
"ServerUpdateNeeded": "Este Servidor Emby necesita ser actualizado. Para descargar la ultima versi\u00f3n, por favor visite {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Modifier les informations",
"RemoveFromPlaylist": "Supprimer de la liste de lecture",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Sp\u00e9cial - {0}",
"Share": "Partager",
"ServerUpdateNeeded": "Le serveur Emby doit \u00eatre mis \u00e0 jour. Pour t\u00e9l\u00e9charger la derni\u00e8re version, veuillez visiter {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "\u0410\u0440\u043d\u0430\u0439\u044b - {0}",
"Share": "\u041e\u0440\u0442\u0430\u049b\u0442\u0430\u0441\u0443",
"ServerUpdateNeeded": "\u041e\u0441\u044b Emby Server \u0436\u0430\u04a3\u0430\u0440\u0442\u044b\u043b\u0443\u044b \u049b\u0430\u0436\u0435\u0442. \u0421\u043e\u04a3\u0493\u044b \u043d\u04b1\u0441\u049b\u0430\u0441\u044b\u043d \u0436\u04af\u043a\u0442\u0435\u043f \u0430\u043b\u0443 \u04af\u0448\u0456\u043d, {0} \u043a\u0456\u0440\u0456\u04a3\u0456\u0437",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Spesial - {0}",
"Share": "Del",
"ServerUpdateNeeded": "Denne Emby serveren trenger en oppdatering. For \u00e5 laste ned nyeste versjon, vennligst bes\u00f8k: {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"EditInfo": "Info Bewerken",
"RemoveFromPlaylist": "Verwijderen uit afspeellijst",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Speciaal - {0}",
"Share": "Delen",
"ServerUpdateNeeded": "Deze Emby Server moet worden bijgewerkt. Om de laatste versie te downloaden, gaat u naar {0}",
@ -94,23 +96,23 @@
"HeaderYouSaid": "U zei...",
"MessageWeDidntRecognizeCommand": "Sorry, dat commando herkennen we niet.",
"MessageIfYouBlockedVoice": "Als u spraak toegang uitgeschakeld heeft moet u dit opnieuw configureren voordat u verder gaat.",
"ValueDiscNumber": "Disc {0}",
"Unrated": "Unrated",
"Favorite": "Favorite",
"Like": "Like",
"Dislike": "Dislike",
"Played": "Played",
"ValueDiscNumber": "Schijf {0}",
"Unrated": "Geen rating",
"Favorite": "Favoriet",
"Like": "Leuk",
"Dislike": "Niet leuk",
"Played": "Afgespeeld",
"RefreshDialogHelp": "Metadata wordt vernieuwd op basis van de instellingen en internet diensten die zijn ingeschakeld in het dashboard van de Emby Server.",
"Open": "Open",
"Play": "Play",
"Queue": "Queue",
"Shuffle": "Shuffle",
"Identify": "Identify",
"EditImages": "Edit Images",
"Sync": "Sync",
"Open": "Openen",
"Play": "Afspelen",
"Queue": "Wachtrij",
"Shuffle": "Willekeurig",
"Identify": "Identificeer",
"EditImages": "Bewerk afbeeldingen",
"Sync": "Synchronisatie",
"InstantMix": "Instant Mix",
"ViewAlbum": "View Album",
"ViewArtist": "View Artist",
"QueueAllFromHere": "Queue All from Here",
"PlayAllFromHere": "Play All from Here"
"ViewAlbum": "Bekijk album",
"ViewArtist": "Bekijk artiest",
"QueueAllFromHere": "Plaats alles in de wachtrij vanaf hier",
"PlayAllFromHere": "Speel alles vanaf hier"
}

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"EditInfo": "Editar Informa\u00e7\u00f5es",
"RemoveFromPlaylist": "Remover da Lista de Reprodu\u00e7\u00e3o",
"PlayFromBeginning": "Reproduzir do in\u00edcio",
"ResumeAt": "Retomar de {0}",
"ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Compartilhar",
"ServerUpdateNeeded": "Este servidor Emby precisa ser atualizado. Para baixar a \u00faltima vers\u00e3o, por favor visite {0}",
@ -88,29 +90,29 @@
"ReplaceAllMetadata": "Substituir todos os metadados",
"SearchForMissingMetadata": "Buscar por metadados que faltam",
"LabelRefreshMode": "Mode de atualiza\u00e7\u00e3o:",
"NoItemsFound": "No items found.",
"HeaderSaySomethingLike": "Say Something Like...",
"ButtonTryAgain": "Try Again",
"HeaderYouSaid": "You Said...",
"MessageWeDidntRecognizeCommand": "We're sorry, we didn't recognize that command.",
"MessageIfYouBlockedVoice": "If you denied voice access to the app you'll need to reconfigure before trying again.",
"ValueDiscNumber": "Disc {0}",
"Unrated": "Unrated",
"Favorite": "Favorite",
"Like": "Like",
"Dislike": "Dislike",
"Played": "Played",
"NoItemsFound": "Nenhum item encontrado.",
"HeaderSaySomethingLike": "Diga algo como...",
"ButtonTryAgain": "Tente Novamente",
"HeaderYouSaid": "Voc\u00ea disse...",
"MessageWeDidntRecognizeCommand": "Desculpe-nos, n\u00e3o foi poss\u00edvel reconhecer este comando.",
"MessageIfYouBlockedVoice": "Se voc\u00ea negou acessos de voz ao app voc\u00ea precisar\u00e1 reconfigurar antes de tentar novamente.",
"ValueDiscNumber": "Disco {0}",
"Unrated": "Sem classifica\u00e7\u00e3o",
"Favorite": "Favorito",
"Like": "Gostei",
"Dislike": "N\u00e3o Gostei",
"Played": "Reproduzido",
"RefreshDialogHelp": "Os metadados s\u00e3o atualizados com bases nas defini\u00e7\u00f5es e nos servi\u00e7os de internet que est\u00e3o ativos no painel do Servidor Emby.",
"Open": "Open",
"Play": "Play",
"Queue": "Queue",
"Shuffle": "Shuffle",
"Identify": "Identify",
"EditImages": "Edit Images",
"Sync": "Sync",
"InstantMix": "Instant Mix",
"ViewAlbum": "View Album",
"ViewArtist": "View Artist",
"QueueAllFromHere": "Queue All from Here",
"PlayAllFromHere": "Play All from Here"
"Open": "Abrir",
"Play": "Reproduzir",
"Queue": "Enfileirar",
"Shuffle": "Embaralhar",
"Identify": "Identificar",
"EditImages": "Editar Imagens",
"Sync": "Sincronizar",
"InstantMix": "Mix Instant\u00e2neo",
"ViewAlbum": "Visualizar \u00c1lbum",
"ViewArtist": "Visualizar Artista",
"QueueAllFromHere": "Enfileirar todos daqui",
"PlayAllFromHere": "Reproduzir todos daqui"
}

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Especial - {0}",
"Share": "Partilhar",
"ServerUpdateNeeded": "Este Servidor Emby precisa ser atualizado. Para fazer download da vers\u00e3o mais recente, por favor visite {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "\u0421\u043f\u0435\u0446\u044d\u043f\u0438\u0437\u043e\u0434 - {0}",
"Share": "\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f",
"ServerUpdateNeeded": "\u0414\u0430\u043d\u043d\u044b\u0439 Emby Server \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Specialavsnitt - {0}",
"Share": "Dela",
"ServerUpdateNeeded": "Den h\u00e4r Emby servern beh\u00f6ver uppdateras. F\u00f6r att ladda ner senaste versionen, g\u00e5 till {0}",

View File

@ -1,6 +1,8 @@
{
"EditInfo": "Edit Info",
"RemoveFromPlaylist": "Remove from Playlist",
"PlayFromBeginning": "Play from beginning",
"ResumeAt": "Resume from {0}",
"ValueSpecialEpisodeName": "Special - {0}",
"Share": "\u5206\u4eab",
"ServerUpdateNeeded": "\u6b64Emby\u4f3a\u670d\u5668\u9700\u8981\u66f4\u65b0\uff0c\u8acb\u81f3{0}\u53d6\u5f97\u6700\u65b0\u7248\u672c",

View File

@ -2,10 +2,17 @@ define(['connectionManager', 'globalize', 'paper-icon-button-light', 'material-i
function getUserDataButtonHtml(method, itemId, iconCssClass, icon, tooltip, style) {
if (style == 'fab-mini') {
style = 'fab';
iconCssClass = iconCssClass ? (iconCssClass + ' mini') : 'mini';
}
var is = style == 'fab' ? 'emby-button' : 'paper-icon-button-light';
var className = style == 'fab' ? 'autoSize fab' : 'autoSize';
className += ' ' + iconCssClass;
if (iconCssClass) {
className += ' ' + iconCssClass;
}
return '<button title="' + tooltip + '" data-itemid="' + itemId + '" is="' + is + '" class="' + className + '" onclick="UserDataButtons.' + method + '(this);return false;">\
<i class="md-icon">' + icon + '</i>\
@ -14,12 +21,17 @@ define(['connectionManager', 'globalize', 'paper-icon-button-light', 'material-i
function fill(options) {
var html = getIconsHtml(options.item, options.includePlayed, options.buttonClass, options.style);
var html = getIconsHtml(options);
options.element.innerHTML = html;
}
function getIconsHtml(item, includePlayed, cssClass, style) {
function getIconsHtml(options) {
var item = options.item;
var includePlayed = options.includePlayed;
var cssClass = options.cssClass;
var style = options.style;
var html = '';
@ -47,8 +59,8 @@ define(['connectionManager', 'globalize', 'paper-icon-button-light', 'material-i
}
}
var tooltipLike = globalize.translate('sharedcomponents#Like');
var tooltipDislike = globalize.translate('sharedcomponents#Dislike');
//var tooltipLike = globalize.translate('sharedcomponents#Like');
//var tooltipDislike = globalize.translate('sharedcomponents#Dislike');
//if (typeof userData.Likes == "undefined") {
// html += getUserDataButtonHtml('markDislike', itemId, btnCssClass + ' btnUserData btnDislike', 'thumb-down', tooltipDislike);

View File

@ -39,6 +39,6 @@
"commit": "8715c83bf04a228de00ec662ed43eb6141e61b91"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0",
"_target": "^1.1.0",
"_originalSource": "Polymer/polymer"
}

View File

@ -25,31 +25,6 @@
font-weight: 400 !important;
}
.cardOverlayTarget {
position: absolute;
right: 0;
left: 0;
bottom: 0;
top: 0;
background-color: rgba(0, 0, 0, .85);
z-index: 998;
line-height: initial;
}
.cardOverlayInner {
padding: 11px 12px 10px;
}
.cardOverlayInner button:last-child {
margin-right: 0 !important;
}
.cardOverlayInner p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.buttonCard:hover .cardBox {
opacity: .6;
}
@ -237,10 +212,6 @@
font-size: 115%;
}
.cardOverlayInner {
color: #fff;
}
.cardTextCentered {
text-align: center;
}
@ -360,14 +331,6 @@
}
}
@media all and (max-width: 1200px) {
.portraitCard .cardOverlayInner {
padding-left: 7px;
padding-right: 7px;
}
}
@media all and (min-width: 500px) {
.smallBackdropCard {

View File

@ -796,11 +796,6 @@
var atts = [];
atts.push({
name: 'itemid',
value: item.Id
});
atts.push({
name: 'serverid',
value: item.ServerId || options.serverId
@ -826,7 +821,7 @@
}
atts.push({
name: 'itemtype',
name: 'type',
value: item.Type
});
@ -1695,11 +1690,11 @@
var elemWithAttributes = elem;
while (!elemWithAttributes.getAttribute('data-itemid')) {
while (!elemWithAttributes.getAttribute('data-id')) {
elemWithAttributes = elemWithAttributes.parentNode;
}
var itemId = elemWithAttributes.getAttribute('data-itemid');
var itemId = elemWithAttributes.getAttribute('data-id');
var index = elemWithAttributes.getAttribute('data-index');
var mediaType = elemWithAttributes.getAttribute('data-mediatype');
@ -2275,10 +2270,10 @@
if (style == 'fab') {
var tagName = 'paper-fab';
return '<' + tagName + ' title="' + tooltip + '" data-itemid="' + itemId + '" icon="' + icon + '" class="' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"></' + tagName + '>';
return '<' + tagName + ' title="' + tooltip + '" data-id="' + itemId + '" icon="' + icon + '" class="' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"></' + tagName + '>';
}
return '<button is="paper-icon-button-light" title="' + tooltip + '" data-itemid="' + itemId + '" class="autoSize ' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"><i class="md-icon">' + icon + '</i></button>';
return '<button is="paper-icon-button-light" title="' + tooltip + '" data-id="' + itemId + '" class="autoSize ' + btnCssClass + '" onclick="LibraryBrowser.' + method + '(this);return false;"><i class="md-icon">' + icon + '</i></button>';
},
getUserDataIconsHtml: function (item, includePlayed, style) {
@ -2316,7 +2311,7 @@
markPlayed: function (link) {
var id = link.getAttribute('data-itemid');
var id = link.getAttribute('data-id');
var markAsPlayed = !link.classList.contains('btnUserItemRatingOn');
@ -2331,7 +2326,7 @@
markFavorite: function (link) {
var id = link.getAttribute('data-itemid');
var id = link.getAttribute('data-id');
var markAsFavorite = !link.classList.contains('btnUserItemRatingOn');

View File

@ -1,172 +1,5 @@
define(['appSettings', 'appStorage', 'libraryBrowser', 'apphost', 'itemHelper', 'mediaInfo'], function (appSettings, appStorage, LibraryBrowser, appHost, itemHelper, mediaInfo) {
var showOverlayTimeout;
function onHoverOut(e) {
var elem = e.target;
if (!elem.classList.contains('card')) {
return;
}
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
elem = elem.querySelector('.cardOverlayTarget');
if (elem) {
slideDownToHide(elem);
}
}
function slideDownToHide(elem) {
if (elem.classList.contains('hide')) {
return;
}
if (!elem.animate) {
elem.classList.add('hide');
return;
}
requestAnimationFrame(function () {
var keyframes = [
{ transform: 'translateY(0)', offset: 0 },
{ transform: 'translateY(100%)', offset: 1 }];
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing).onfinish = function () {
elem.classList.add('hide');
};
});
}
function slideUpToShow(elem) {
if (!elem.classList.contains('hide')) {
return;
}
elem.classList.remove('hide');
if (!elem.animate) {
return;
}
requestAnimationFrame(function () {
var keyframes = [
{ transform: 'translateY(100%)', offset: 0 },
{ transform: 'translateY(0)', offset: 1 }];
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
elem.animate(keyframes, timing);
});
}
function getOverlayHtml(item, currentUser, card) {
var html = '';
html += '<div class="cardOverlayInner">';
var className = card.className.toLowerCase();
var isMiniItem = className.indexOf('mini') != -1;
var isSmallItem = isMiniItem || className.indexOf('small') != -1;
var isPortrait = className.indexOf('portrait') != -1;
var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName;
var name = itemHelper.getDisplayName(item);
html += '<div style="margin-bottom:1em;">';
var logoHeight = isSmallItem || isMiniItem ? 20 : 26;
var imgUrl;
if (parentName && item.ParentLogoItemId) {
imgUrl = ApiClient.getScaledImageUrl(item.ParentLogoItemId, {
maxHeight: logoHeight,
type: 'logo',
tag: item.ParentLogoImageTag
});
html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:100%;" />';
}
else if (item.ImageTags.Logo) {
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
maxHeight: logoHeight,
type: 'logo',
tag: item.ImageTags.Logo
});
html += '<img src="' + imgUrl + '" style="max-height:' + logoHeight + 'px;max-width:100%;" />';
}
else {
html += parentName || name;
}
html += '</div>';
if (parentName) {
html += '<p>';
html += name;
html += '</p>';
} else if (!isSmallItem && !isMiniItem) {
html += '<div class="itemMiscInfo">';
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
endsAt: false
});
html += '</div>';
}
if (!isMiniItem) {
html += '<div style="margin:1em 0 .75em;">';
if (isPortrait) {
html += '<div class="userDataIcons" style="margin:.5em 0 0em;">';
html += LibraryBrowser.getUserDataIconsHtml(item);
html += '</div>';
} else {
html += '<span class="userDataIcons" style="vertical-align:middle;">';
html += LibraryBrowser.getUserDataIconsHtml(item);
html += '</span>';
}
html += '</div>';
}
html += '<div>';
var buttonCount = 0;
if (MediaController.canPlay(item)) {
var resumePosition = (item.UserData || {}).PlaybackPositionTicks || 0;
html += '<button is="paper-icon-button-light" class="itemAction autoSize" data-action="playmenu" data-itemid="' + item.Id + '" data-itemtype="' + item.Type + '" data-isfolder="' + item.IsFolder + '" data-mediatype="' + item.MediaType + '" data-resumeposition="' + resumePosition + '"><i class="md-icon">play_circle_outline</i></button>';
buttonCount++;
}
if (item.LocalTrailerCount) {
html += '<button is="paper-icon-button-light" class="itemAction autoSize" data-action="playtrailer" data-itemid="' + item.Id + '"><i class="md-icon">videocam</i></button>';
buttonCount++;
}
html += '<button is="paper-icon-button-light" class="itemAction autoSize" data-action="menu" data-playoptions="false"><i class="md-icon">more_vert</i></button>';
buttonCount++;
html += '</div>';
html += '</div>';
return html;
}
function isClickable(target) {
while (target != null) {
@ -200,7 +33,7 @@
function onGroupedCardClick(e, card) {
var itemId = card.getAttribute('data-itemid');
var itemId = card.getAttribute('data-id');
var context = card.getAttribute('data-context');
var userId = Dashboard.getCurrentUserId();
@ -255,104 +88,9 @@
LibraryBrowser.createCardMenus = function (curr, options) {
var preventHover = false;
function onShowTimerExpired(elem) {
elem = elem.querySelector('a');
if (elem.querySelector('.itemSelectionPanel')) {
return;
}
var innerElem = elem.querySelector('.cardOverlayTarget');
if (!innerElem) {
innerElem = document.createElement('div');
innerElem.classList.add('hide');
innerElem.classList.add('cardOverlayTarget');
parentWithClass(elem, 'cardContent').appendChild(innerElem);
}
var dataElement = elem;
while (dataElement && !dataElement.getAttribute('data-itemid')) {
dataElement = dataElement.parentNode;
}
var id = dataElement.getAttribute('data-itemid');
var type = dataElement.getAttribute('data-itemtype');
if (type == 'Timer') {
return;
}
var promise1 = ApiClient.getItem(Dashboard.getCurrentUserId(), id);
var promise2 = Dashboard.getCurrentUser();
Promise.all([promise1, promise2]).then(function (responses) {
var item = responses[0];
var user = responses[1];
var card = elem;
while (!card.classList.contains('card')) {
card = card.parentNode;
}
innerElem.innerHTML = getOverlayHtml(item, user, card);
});
slideUpToShow(innerElem);
}
function onHoverIn(e) {
var elem = e.target;
if (!elem.classList.contains('cardImage')) {
return;
}
if (preventHover === true) {
preventHover = false;
return;
}
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
while (!elem.classList.contains('card')) {
elem = elem.parentNode;
}
showOverlayTimeout = setTimeout(function () {
onShowTimerExpired(elem);
}, 1200);
}
function preventTouchHover() {
preventHover = true;
}
curr.removeEventListener('click', onCardClick);
curr.addEventListener('click', onCardClick);
if (!AppInfo.isTouchPreferred) {
curr.removeEventListener('mouseenter', onHoverIn);
curr.addEventListener('mouseenter', onHoverIn, true);
curr.removeEventListener('mouseleave', onHoverOut);
curr.addEventListener('mouseleave', onHoverOut, true);
curr.removeEventListener("touchstart", preventTouchHover);
curr.addEventListener("touchstart", preventTouchHover);
}
//initTapHoldMenus(curr);
};
@ -584,7 +322,7 @@
var selectedItems = [];
function updateItemSelection(chkItemSelect, selected) {
var id = parentWithClass(chkItemSelect, 'card').getAttribute('data-itemid');
var id = parentWithClass(chkItemSelect, 'card').getAttribute('data-id');
if (selected) {

View File

@ -111,7 +111,7 @@
icon = item.icon || icon;
html += '<a' + onclick + ' data-itemid="' + item.Id + '" class="' + cssClass + '" href="' + href + '">';
html += '<a' + onclick + ' data-id="' + item.Id + '" class="' + cssClass + '" href="' + href + '">';
html += '<div class="cardBox" style="background-color:' + backgroundColor + ';margin:4px;border-radius:4px;">';
html += "<div class='cardText' style='padding:8px 10px;color:#fff;'>";

View File

@ -1804,6 +1804,7 @@ var AppInfo = {};
define("emby-collapse", [embyWebComponentsBowerPath + "/emby-collapse/emby-collapse"], returnFirstDependency);
define("emby-button", [embyWebComponentsBowerPath + "/emby-button/emby-button"], returnFirstDependency);
define("emby-itemscontainer", [embyWebComponentsBowerPath + "/emby-itemscontainer/emby-itemscontainer"], returnFirstDependency);
define("itemHoverMenu", [embyWebComponentsBowerPath + "/itemhovermenu/itemhovermenu"], returnFirstDependency);
define("alphaPicker", [embyWebComponentsBowerPath + "/alphapicker/alphapicker"], returnFirstDependency);
define("paper-icon-button-light", [embyWebComponentsBowerPath + "/emby-button/paper-icon-button-light"]);