From 2b54b4ac06e512c09b335433a9a935db7578fc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= <root@acid-chicken.com> Date: Thu, 23 Aug 2018 00:34:35 +0900 Subject: [PATCH 1/2] Update url-preview.vue --- .../common/views/components/url-preview.vue | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue index 95dafa8f4c..655958188e 100644 --- a/src/client/app/common/views/components/url-preview.vue +++ b/src/client/app/common/views/components/url-preview.vue @@ -1,5 +1,7 @@ <template> -<iframe v-if="player" :src="player" heigth="250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen /> +<div v-if="player.url" class="player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`"> + <iframe :src="player.url" :width="player.width" :heigth="player.height" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen /> +</div> <div v-else-if="tweetUrl && detail" class="twitter"> <blockquote ref="tweet" class="twitter-tweet" :data-theme="$store.state.device.darkmode ? 'dark' : null"> <a :href="url"></a> @@ -46,7 +48,11 @@ export default Vue.extend({ thumbnail: null, icon: null, sitename: null, - player: null, + player: { + url: null, + width: null, + height: null + }, tweetUrl: null, misskeyUrl }; @@ -170,9 +176,17 @@ export default Vue.extend({ </script> <style lang="stylus" scoped> -iframe +.twitter + position relative width 100% + > iframe + height 100% + left 0 + position absolute + top 0 + width 100% + root(isDark) > a display block From d704aca0355d5ca92c071d8c63440e6ca09c7b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= <root@acid-chicken.com> Date: Thu, 23 Aug 2018 00:40:32 +0900 Subject: [PATCH 2/2] Update url-preview.vue --- src/client/app/common/views/components/url-preview.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue index 655958188e..be69012737 100644 --- a/src/client/app/common/views/components/url-preview.vue +++ b/src/client/app/common/views/components/url-preview.vue @@ -1,6 +1,6 @@ <template> <div v-if="player.url" class="player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`"> - <iframe :src="player.url" :width="player.width" :heigth="player.height" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen /> + <iframe :src="player.url" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen /> </div> <div v-else-if="tweetUrl && detail" class="twitter"> <blockquote ref="tweet" class="twitter-tweet" :data-theme="$store.state.device.darkmode ? 'dark' : null">