Update: Design improvements, title position, year

pull/16/head
Juraj Nyíri 4 years ago
parent aef2125332
commit 79b70f74e6

@ -20,7 +20,7 @@ class ContentCardExample extends HTMLElement {
this.appendChild(card); this.appendChild(card);
this.content.innerHTML = ""; this.content.innerHTML = "";
var count = 0; var count = 0;
var maxCount = 10; var maxCount = 20;
this.data.Movies.some((movieData) => { this.data.Movies.some((movieData) => {
if (count < maxCount) { if (count < maxCount) {
count++; count++;
@ -38,38 +38,40 @@ class ContentCardExample extends HTMLElement {
} }
getMovieElement = (data, hass, server_id) => { getMovieElement = (data, hass, server_id) => {
const width = 138;
const height = 206;
const thumbURL = const thumbURL =
"http://" + "http://" +
this.config.plexIP + this.config.plexIP +
":" + ":" +
this.config.plexPort + this.config.plexPort +
data.thumb + "/photo/:/transcode?width=" +
"?X-Plex-Token=" + width +
this.config.plexToken; "&height=" +
const thumbSmall = height +
"http://" + "&minSize=1&upscale=1&url=" +
this.config.plexIP +
":" +
this.config.plexPort +
"/photo/:/transcode?width=138&height=206&minSize=1&upscale=1&url=" +
data.thumb + data.thumb +
"%3FX-Plex-Token%3DRbdSQWgKZ_3NqxzZnRwk&X-Plex-Token=RbdSQWgKZ_3NqxzZnRwk"; "%3FX-Plex-Token%3DRbdSQWgKZ_3NqxzZnRwk&X-Plex-Token=RbdSQWgKZ_3NqxzZnRwk";
//const thumbElem = document.createElement("img");
//thumbElem.src = thumbURL; const container = document.createElement("div");
//thumbElem.style = "width:100%;"; container.style.float = "left";
container.style.width = width + "px";
container.style["margin-bottom"] = "20px";
container.style["margin-right"] = "10px";
const movieElem = document.createElement("div"); const movieElem = document.createElement("div");
//movieElem.appendChild(thumbElem);
movieElem.style = movieElem.style =
"float:left; width:138px; height:206px; margin-right:10px; margin-bottom:10px; background-image: url('" + "width:" +
thumbSmall + width +
"'); background-repeat: no-repeat; background-size: contain;"; "px; height:" +
height +
"px; margin-bottom:5px; background-image: url('" +
thumbURL +
"'); background-repeat: no-repeat; background-size: contain; border-radius: 5px;";
const playButton = this.getPlayButton(); const playButton = this.getPlayButton();
const titleElem = document.createElement("div");
titleElem.innerHTML = data.title;
const interactiveArea = document.createElement("div"); const interactiveArea = document.createElement("div");
interactiveArea.className = "interactiveArea"; interactiveArea.className = "interactiveArea";
//interactiveArea.append(titleElem);
interactiveArea.append(playButton); interactiveArea.append(playButton);
movieElem.append(interactiveArea); movieElem.append(interactiveArea);
@ -90,7 +92,21 @@ class ContentCardExample extends HTMLElement {
command, command,
}); });
}); });
return movieElem;
const titleElem = document.createElement("div");
titleElem.innerHTML = data.title;
titleElem.style =
"text-overflow: ellipsis; white-space: nowrap; overflow: hidden;";
const yearElem = document.createElement("div");
yearElem.innerHTML = data.year;
yearElem.style = "color:hsla(0,0%,100%,.45);";
container.appendChild(movieElem);
container.appendChild(titleElem);
container.appendChild(yearElem);
return container;
}; };
loadCustomStyles = () => { loadCustomStyles = () => {

Loading…
Cancel
Save