|
1 | 1 | <template>
|
2 |
| -<div v-if="playerEnabled" :class="$style.player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`"> |
3 |
| - <button :class="$style.disablePlayer" :title="i18n.ts.disablePlayer" @click="playerEnabled = false"><i class="ti ti-x"></i></button> |
4 |
| - <iframe v-if="player.url.startsWith('http://') || player.url.startsWith('https://')" :class="$style.playerIframe" :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/> |
5 |
| - <span v-else>invalid url</span> |
6 |
| -</div> |
7 |
| -<div v-else-if="tweetId && tweetExpanded" ref="twitter" :class="$style.twitter"> |
8 |
| - <iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&hideCard=false&hideThread=false&lang=en&theme=${$store.state.darkMode ? 'dark' : 'light'}&id=${tweetId}`"></iframe> |
9 |
| -</div> |
| 2 | +<template v-if="playerEnabled"> |
| 3 | + <div :class="$style.player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`"> |
| 4 | + <iframe v-if="player.url.startsWith('http://') || player.url.startsWith('https://')" :class="$style.playerIframe" :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/> |
| 5 | + <span v-else>invalid url</span> |
| 6 | + </div> |
| 7 | + <div :class="$style.action"> |
| 8 | + <MkButton :small="true" inline @click="playerEnabled = false"> |
| 9 | + <i class="ti ti-x"></i> {{ i18n.ts.disablePlayer }} |
| 10 | + </MkButton> |
| 11 | + </div> |
| 12 | +</template> |
| 13 | +<template v-else-if="tweetId && tweetExpanded"> |
| 14 | + <div ref="twitter" :class="$style.twitter"> |
| 15 | + <iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&hideCard=false&hideThread=false&lang=en&theme=${$store.state.darkMode ? 'dark' : 'light'}&id=${tweetId}`"></iframe> |
| 16 | + </div> |
| 17 | + <div :class="$style.action"> |
| 18 | + <MkButton :small="true" inline @click="tweetExpanded = false"> |
| 19 | + <i class="ti ti-x"></i> {{ i18n.ts.close }} |
| 20 | + </MkButton> |
| 21 | + </div> |
| 22 | +</template> |
10 | 23 | <div v-else :class="$style.urlPreview">
|
11 | 24 | <component :is="self ? 'MkA' : 'a'" :class="[$style.link, { [$style.compact]: compact }]" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
|
12 | 25 | <div v-if="thumbnail" :class="$style.thumbnail" :style="`background-image: url('${thumbnail}')`">
|
|
0 commit comments