update list views

This commit is contained in:
Luke Pulverenti 2016-07-16 17:28:15 -04:00
parent cbf80fb548
commit aaf5037d13
14 changed files with 164 additions and 70 deletions

View File

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.84",
"_release": "1.4.84",
"version": "1.4.85",
"_release": "1.4.85",
"_resolution": {
"type": "version",
"tag": "1.4.84",
"commit": "15bfe5a5a9ca97a96f3f30c76dd463266f66e290"
"tag": "1.4.85",
"commit": "02ae5393a31e8266eb52f0e1a6471b9da8f964c7"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View File

@ -1,12 +1,74 @@
define(['itemShortcuts', 'registerElement'], function (itemShortcuts) {
define(['itemShortcuts', 'connectionManager', 'registerElement'], function (itemShortcuts, connectionManager) {
var ItemsContainerProtoType = Object.create(HTMLDivElement.prototype);
function parentWithClass(elem, className) {
while (!elem.classList || !elem.classList.contains(className)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function parentWithAttribute(elem, name) {
while (!elem.getAttribute(name)) {
elem = elem.parentNode;
if (!elem) {
return null;
}
}
return elem;
}
function getItem(button) {
button = parentWithAttribute(button, 'data-id');
var serverId = button.getAttribute('data-serverid');
var id = button.getAttribute('data-id');
var apiClient = connectionManager.getApiClient(serverId);
return apiClient.getItem(apiClient.getCurrentUserId(), id);
}
function showContextMenu(button) {
getItem(button).then(function (item) {
require(['itemContextMenu'], function (itemContextMenu) {
itemContextMenu.show({
positionTo: button,
item: item
});
});
});
}
function onClick(e) {
var menuButton = parentWithClass(e.target, 'menuButton');
if (menuButton) {
showContextMenu(menuButton);
e.stopPropagation();
return false;
}
}
ItemsContainerProtoType.attachedCallback = function () {
this.addEventListener('click', onClick);
itemShortcuts.on(this);
};
ItemsContainerProtoType.detachedCallback = function () {
this.removeEventListener('click', onClick);
itemShortcuts.off(this);
};

View File

@ -14,3 +14,52 @@
.timerIndicator {
color: #CB272A;
}
.indicator + .indicator {
margin-left: .25em;
}
.countIndicator {
background: rgba(82,181,75,1);
border-radius: 500px;
display: -ms-flex;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
color: #fff;
}
.playedIndicator {
background: rgba(82,181,75,1);
border-radius: 500px;
display: -ms-flex;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.countIndicator, .playedIndicator {
width: 28px;
height: 28px;
}
.playedIndicator i {
width: 22px;
height: 22px;
font-size: 22px;
}
.layout-tv .countIndicator, .layout-tv .playedIndicator {
width: 3.8vh;
height: 3.8vh;
}
.layout-tv .playedIndicator i {
width: 2.6vh;
height: 2.6vh;
font-size: 2.6vh;
}

View File

@ -200,7 +200,10 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper'], function (ap
require(['actionsheet'], function (actionSheet) {
actionSheet.show({
items: commands
items: commands,
positionTo: options.positionTo
}).then(function (id) {
executeCommand(options.item, id).then(resolve);
}, reject);

View File

@ -169,6 +169,14 @@ div.listItem {
margin-top: 0;
}
.listItem .indicators {
right: .5vh;
top: .5vh;
position: absolute;
display: flex;
align-items: center;
}
@supports (display: flex) {
.listItem, .listItemBody, .listItemMediaInfo {

View File

@ -201,8 +201,6 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (options.showParentTitle) {
if (item.Type == 'Episode') {
textlines.push(item.SeriesName || ' ');
} else if (item.Type == 'MusicAlbum') {
textlines.push(item.AlbumArtist || ' ');
}
}
@ -213,13 +211,28 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
}
textlines.push(displayName);
if (item.Type == 'Audio') {
if (item.ArtistItems && item.Type != 'MusicAlbum') {
textlines.push(item.ArtistItems.map(function (a) {
return a.Name;
}).join(', ') || ' ');
}
if (item.AlbumArtist && item.Type == 'MusicAlbum') {
textlines.push(item.AlbumArtist || ' ');
}
if (item.Type == 'Game') {
textlines.push(item.GameSystem || ' ');
}
if (item.Type == 'TvChannel') {
if (item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
}
}
var lineCount = textlines.length;
if (!options.enableSideMediaInfo) {
lineCount++;
@ -241,7 +254,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '<h2>';
}
else if (i == 0) {
html += '<h3>';
html += '<div>';
} else {
html += '<div class="secondary">';
}
@ -249,7 +262,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (i == 0 && isLargeStyle) {
html += '</h2>';
} else if (i == 0) {
html += '</h3>';
html += '</div>';
} else {
html += '</div>';
}
@ -268,7 +281,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
html += '</div>';
if (!clickEntireItem) {
html += '<button is="paper-icon-button-light" class="listviewMenuButton autoSize"><i class="md-icon">&#xE5D4;</i></button>';
html += '<button is="paper-icon-button-light" class="menuButton autoSize"><i class="md-icon">&#xE5D4;</i></button>';
html += '<span class="listViewUserDataButtons">';
html += userdataButtons.getIconsHtml(item, false);
html += '</span>';

View File

@ -3,9 +3,9 @@
}
i.mediaInfoItem {
width: 3vh;
height: 3vh;
font-size: 3vh;
width: auto;
height: auto;
font-size: 1.6em;
margin-right: .6em;
}
@ -63,9 +63,3 @@ i.mediaInfoItem {
font-size: 90%;
padding: .1em .5em;
}
.layout-tv i.mediaInfoItem {
width: 4vh;
height: 4vh;
font-size: 4vh;
}

View File

@ -125,7 +125,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
}
else if (action == 'setplaylistindex') {
playbackManager.currentPlaylistIndex(parseInt(card.getAttribute('data-index')));
}
else if (action == 'record') {

View File

@ -26,14 +26,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"main": "iron-meta.html",
"homepage": "https://github.com/PolymerElements/iron-meta",
"homepage": "https://github.com/polymerelements/iron-meta",
"_release": "1.1.1",
"_resolution": {
"type": "version",
"tag": "v1.1.1",
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
},
"_source": "git://github.com/PolymerElements/iron-meta.git",
"_source": "git://github.com/polymerelements/iron-meta.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-meta"
"_originalSource": "polymerelements/iron-meta"
}

View File

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

View File

@ -414,7 +414,7 @@
html += listView.getListViewHtml({
items: MediaController.playlist(),
smallIcon: true,
action: 'none'
action: 'setplaylistindex'
});
playlistNeedsRefresh = false;
@ -556,24 +556,6 @@
return elem;
}
function onContextClick(e) {
var mediaItem = parentWithClass(e.target, 'itemAction');
if (mediaItem != null) {
mediaItem = parentWithClass(e.target, 'listItem');
var indexValue = mediaItem.getAttribute('data-index');
if (indexValue) {
MediaController.currentPlaylistIndex(parseInt(indexValue));
}
e.preventDefault();
e.stopPropagation();
return false;
}
}
function onBtnCommandClick() {
if (currentPlayer) {
@ -693,8 +675,6 @@
return datetime.getDisplayRunningTime(ticks);
};
context.addEventListener('click', onContextClick);
}
function onPlayerChange() {

View File

@ -885,30 +885,10 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
top: 32px;
}
.playedIndicator {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 5px;
right: 5px;
text-align: center;
vertical-align: middle;
width: 26px;
height: 26px;
border-radius: 50%;
color: #fff;
background: rgb(82, 181, 75);
background: rgba(82, 181, 75, .95);
line-height: 21px;
line-height: initial;
font-weight: 500;
.syncIndicator i {
font-size: 180%;
}
.playedIndicator i, .syncIndicator i {
font-size: 180%;
}
.mediaSourceIndicator {
display: block;
position: absolute;

View File

@ -78,7 +78,8 @@
html = listView.getListViewHtml({
items: result.Items,
sortBy: query.SortBy
sortBy: query.SortBy,
showParentTitle: true
});
}
else if (viewStyle == "PosterCard") {

View File

@ -1819,6 +1819,7 @@ var AppInfo = {};
define("recordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/recordingeditor"], returnFirstDependency);
define("subtitleEditor", [embyWebComponentsBowerPath + "/subtitleeditor/subtitleeditor"], returnFirstDependency);
define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency);
define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency);
define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency);
define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency);
define("fetchHelper", [embyWebComponentsBowerPath + "/fetchhelper"], returnFirstDependency);
@ -2025,6 +2026,9 @@ var AppInfo = {};
},
play: function (options) {
MediaController.play(options);
},
currentPlaylistIndex: function (options) {
return MediaController.currentPlaylistIndex(options);
}
};
});