Revised basepath url. Check uri_thumbnail not null

This commit is contained in:
Vincenzo Cestone 2022-12-14 14:09:37 +01:00
parent e40c69e9a6
commit cc746e0fef
1 changed files with 8 additions and 6 deletions

View File

@ -3,7 +3,7 @@
*/ */
window.customElements.define('d4s-social-posts', class extends HTMLElement { window.customElements.define('d4s-social-posts', class extends HTMLElement {
#basepath = 'https://api.d4science.org/rest' #basepath = 'https://api.d4science.org'
#from = 1 #from = 1
#quantity = 10 #quantity = 10
@ -14,9 +14,9 @@ window.customElements.define('d4s-social-posts', class extends HTMLElement {
#shadowRoot = null #shadowRoot = null
#unorderedlist = null #unorderedlist = null
//#restRecentPosts = '/2/posts/get-posts-vre' // old get, gets all posts unfiltered //#restRecentPosts = '/rest/2/posts/get-posts-vre' // old get, gets all posts unfiltered
#restRecentPosts = '/2/posts/get-recent-posts-vre-by-range' #restRecentPosts = '/rest/2/posts/get-recent-posts-vre-by-range'
#restComments = '/2/comments/get-comments-by-post-id' #restComments = '/rest/2/comments/get-comments-by-post-id'
#style = `<style> #style = `<style>
.d4s-social-posts { .d4s-social-posts {
@ -244,8 +244,10 @@ window.customElements.define('d4s-social-posts', class extends HTMLElement {
if (post.link_title !== "") { if (post.link_title !== "") {
var attimg = document.createElement('div') var attimg = document.createElement('div')
attimg.classList.add('attachment-div') attimg.classList.add('attachment-div')
attimg.innerHTML += `<img src="${post.uri_thumbnail}" class="attachment-img" onerror="this.style.display='none'"/>` if (post.uri_thumbnail != "null") {
li.querySelector('.d4s-post-attachment').appendChild(attimg) attimg.innerHTML += `<img src="${post.uri_thumbnail}" class="attachment-img" onerror="this.style.display='none'"/>`
li.querySelector('.d4s-post-attachment').appendChild(attimg)
}
var attdesc = document.createElement('div') var attdesc = document.createElement('div')
attdesc.classList.add('attachment-info') attdesc.classList.add('attachment-info')
attdesc.innerHTML += ` attdesc.innerHTML += `