2018-12-08 17:44:12 +00:00
|
|
|
<div class="non-autoplay-gifv {$largeInlineMedia ? '' : 'fixed-size'}"
|
2018-12-08 17:42:38 +00:00
|
|
|
style="width: {width}px; height: {height}px;"
|
2018-02-02 02:48:59 +00:00
|
|
|
on:mouseover="onMouseOver(event)"
|
|
|
|
ref:node
|
|
|
|
>
|
2018-05-02 00:05:36 +00:00
|
|
|
{#if playing}
|
2018-03-31 17:45:11 +00:00
|
|
|
<AutoplayVideo
|
2018-05-02 00:05:36 +00:00
|
|
|
ariaLabel={label}
|
|
|
|
{poster}
|
|
|
|
{src}
|
|
|
|
{width}
|
|
|
|
{height}
|
2018-12-08 17:42:38 +00:00
|
|
|
{focus}
|
2018-02-02 02:48:59 +00:00
|
|
|
/>
|
2018-05-02 00:05:36 +00:00
|
|
|
{:else}
|
2018-03-14 06:07:30 +00:00
|
|
|
<LazyImage
|
2018-05-02 00:05:36 +00:00
|
|
|
alt={label || ''}
|
|
|
|
title={label || ''}
|
|
|
|
src={staticSrc}
|
|
|
|
fallback={oneTransparentPixel}
|
|
|
|
{width}
|
|
|
|
{height}
|
2018-03-14 06:07:30 +00:00
|
|
|
background="var(--loading-bg)"
|
2018-12-08 17:42:38 +00:00
|
|
|
{focus}
|
2018-03-14 06:07:30 +00:00
|
|
|
/>
|
2018-05-02 00:05:36 +00:00
|
|
|
{/if}
|
|
|
|
<PlayVideoIcon className={playing ? 'hidden' : ''}/>
|
2018-02-02 02:48:59 +00:00
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.non-autoplay-gifv {
|
|
|
|
cursor: zoom-in;
|
2018-12-08 17:42:38 +00:00
|
|
|
display: flex;
|
2018-03-10 19:28:30 +00:00
|
|
|
position: relative;
|
2018-12-08 17:42:38 +00:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2018-03-10 19:28:30 +00:00
|
|
|
}
|
2018-12-08 17:42:38 +00:00
|
|
|
|
|
|
|
.fixed-size {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-10 19:28:30 +00:00
|
|
|
:global(.non-autoplay-gifv .play-video-icon) {
|
|
|
|
transition: opacity 0.2s linear;
|
2018-02-02 02:48:59 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { mouseover } from '../_utils/events'
|
2018-03-10 19:28:30 +00:00
|
|
|
import PlayVideoIcon from './PlayVideoIcon.html'
|
2018-03-10 07:30:17 +00:00
|
|
|
import { ONE_TRANSPARENT_PIXEL } from '../_static/media'
|
2018-03-14 06:07:30 +00:00
|
|
|
import LazyImage from './LazyImage.html'
|
2018-03-31 17:45:11 +00:00
|
|
|
import AutoplayVideo from './AutoplayVideo.html'
|
2018-03-10 07:30:17 +00:00
|
|
|
|
2018-02-02 02:48:59 +00:00
|
|
|
export default {
|
|
|
|
methods: {
|
2018-04-20 04:38:01 +00:00
|
|
|
onMouseOver (mouseOver) {
|
2018-08-30 04:42:57 +00:00
|
|
|
this.set({ playing: mouseOver })
|
2018-02-02 02:48:59 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
events: {
|
2018-03-14 06:07:30 +00:00
|
|
|
mouseover
|
2018-03-10 07:30:17 +00:00
|
|
|
},
|
|
|
|
data: () => ({
|
2018-12-08 17:42:38 +00:00
|
|
|
oneTransparentPixel: ONE_TRANSPARENT_PIXEL,
|
|
|
|
focus: void 0
|
2018-03-10 19:28:30 +00:00
|
|
|
}),
|
|
|
|
components: {
|
2018-03-14 06:07:30 +00:00
|
|
|
PlayVideoIcon,
|
2018-03-31 17:45:11 +00:00
|
|
|
LazyImage,
|
|
|
|
AutoplayVideo
|
2018-03-10 19:28:30 +00:00
|
|
|
}
|
2018-02-02 02:48:59 +00:00
|
|
|
}
|
2018-12-08 17:42:38 +00:00
|
|
|
</script>
|