Added resolve of thumbnail url

This commit is contained in:
Vincenzo Cestone 2022-03-22 12:55:35 +01:00
parent 49b6ea230b
commit 92751d590a
1 changed files with 3 additions and 2 deletions

View File

@ -39,7 +39,7 @@ window.customElements.define('d4s-social-search', class extends HTMLElement {
window.customElements.define('d4s-social-posts', class extends HTMLElement {
#basepath = 'https://api.dev.d4science.org/rest'
#basepath = 'https://api.d4science.org/rest'
#quantity = 20
constructor() {
@ -63,10 +63,11 @@ window.customElements.define('d4s-social-posts', class extends HTMLElement {
li.setAttribute('class', 'd4s-social-post')
const datetime = new Date(0)
datetime.setUTCMilliseconds(post.time)
const thumbnail = (!post.thumbnail_url.startsWith('http')) ? 'https://' + d4s.clientId + post.thumbnail_url : post.thumbnail_url
li.innerHTML = `
<div class="d4s-post-heading">
<div class="d4s-post-avatar">
<img src="${post.thumbnail_url}" onerror="this.style.display='none'" width="32px" height="32px"></slot>
<img src="${thumbnail}" onerror="this.style.display='none'" width="32px" height="32px"></slot>
</div>
<div class="d4s-post-meta">
<div class="fullname">${post.full_name}</div>