mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
32
src/components/groupedcards.js
Normal file
32
src/components/groupedcards.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
define(["dom", "appRouter", "connectionManager"], function(dom, appRouter, connectionManager) {
|
||||
"use strict";
|
||||
|
||||
function onGroupedCardClick(e, card) {
|
||||
var itemId = card.getAttribute("data-id"),
|
||||
serverId = card.getAttribute("data-serverid"),
|
||||
apiClient = connectionManager.getApiClient(serverId),
|
||||
userId = apiClient.getCurrentUserId(),
|
||||
playedIndicator = card.querySelector(".playedIndicator"),
|
||||
playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null,
|
||||
options = {
|
||||
Limit: parseInt(playedIndicatorHtml || "10"),
|
||||
Fields: "PrimaryImageAspectRatio,DateCreated",
|
||||
ParentId: itemId,
|
||||
GroupItems: !1
|
||||
},
|
||||
actionableParent = dom.parentWithTag(e.target, ["A", "BUTTON", "INPUT"]);
|
||||
if (!actionableParent || actionableParent.classList.contains("cardContent")) return apiClient.getJSON(apiClient.getUrl("Users/" + userId + "/Items/Latest", options)).then(function(items) {
|
||||
if (1 === items.length) return void appRouter.showItem(items[0]);
|
||||
var url = "itemdetails.html?id=" + itemId + "&serverId=" + serverId;
|
||||
Dashboard.navigate(url)
|
||||
}), e.stopPropagation(), e.preventDefault(), !1
|
||||
}
|
||||
|
||||
function onItemsContainerClick(e) {
|
||||
var groupedCard = dom.parentWithClass(e.target, "groupedCard");
|
||||
groupedCard && onGroupedCardClick(e, groupedCard)
|
||||
}
|
||||
return {
|
||||
onItemsContainerClick: onItemsContainerClick
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue