If the thumbnail fails to load, replace with Poke placeholder
This commit is contained in:
parent
b2ed5701f6
commit
0b4457ccb4
1 changed files with 10 additions and 1 deletions
|
@ -25,7 +25,12 @@ const ViewsFormat = ViewsConversion.format(Views)
|
|||
|
||||
<a href={'/watch?v=' + ID} class="video-item" data-astro-reload>
|
||||
<div class="video-item-thumbnail">
|
||||
<img src={'https://i.ytimg.com/vi/' + ID + '/maxresdefault.jpg'}/>
|
||||
<img onload=`
|
||||
if (this.naturalWidth == '120') {
|
||||
src='https://md.sudovanilla.org/images/pt-th-fl.png'
|
||||
}
|
||||
`
|
||||
src={'https://i.ytimg.com/vi/' + ID + '/maxresdefault.jpg'}/>
|
||||
</div>
|
||||
<div class="video-item-details">
|
||||
<p id="vi-title">{Title}</p>
|
||||
|
@ -34,6 +39,10 @@ const ViewsFormat = ViewsConversion.format(Views)
|
|||
</div>
|
||||
</a>
|
||||
|
||||
<script is:inline>
|
||||
document.querySelectorAll("img[src='https://i.ytimg.com/vi/undefined/maxresdefault.jpg']").forEach(img => {img.src='https://md.sudovanilla.org/images/pt-th-fl.png'})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.video-item {
|
||||
display: flex;
|
||||
|
|
Reference in a new issue