enhance(frontend): X (formally known as Twitter) (MisskeyIO#208)
* enhance(frontend): TwitterアイコンをXに変更 (misskey-dev#11436) cheery-picked from007ed5c929
Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com> * fix(frontend/MkUrlPreview): allow fullscreen from tweets (misskey-dev#11712) cheery-picked from2896fc6cb4
Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com> * enhance(frontend): x.comでも展開ができるように (misskey-dev#11757) cheery-picked fromcb80dff7df
Co-authored-by: maguroshouta <54607611+maguroshouta@users.noreply.github.com>
This commit is contained in:
parent
6a06711ffd
commit
ae9245abdc
4 changed files with 37 additions and 12 deletions
|
@ -28,7 +28,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
<template v-else-if="tweetId && tweetExpanded">
|
||||
<div ref="twitter">
|
||||
<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=${defaultStore.state.darkMode ? 'dark' : 'light'}&id=${tweetId}`"></iframe>
|
||||
<iframe
|
||||
ref="tweet"
|
||||
allow="fullscreen;web-share"
|
||||
sandbox="allow-popups allow-scripts allow-same-origin"
|
||||
scrolling="no"
|
||||
:style="{ position: 'relative', width: '100%', height: `${tweetHeight}px`, border: 0 }"
|
||||
:src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&hideCard=false&hideThread=false&lang=en&theme=${defaultStore.state.darkMode ? 'dark' : 'light'}&id=${tweetId}`"
|
||||
></iframe>
|
||||
</div>
|
||||
<div :class="$style.action">
|
||||
<MkButton :small="true" inline @click="tweetExpanded = false">
|
||||
|
@ -60,7 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template v-if="showActions">
|
||||
<div v-if="tweetId" :class="$style.action">
|
||||
<MkButton :small="true" inline @click="tweetExpanded = true">
|
||||
<i class="ti ti-brand-twitter"></i> {{ i18n.ts.expandTweet }}
|
||||
<i class="ti ti-brand-x"></i> {{ i18n.ts.expandTweet }}
|
||||
</MkButton>
|
||||
</div>
|
||||
<div v-if="!playerEnabled && player.url" :class="$style.action">
|
||||
|
@ -126,7 +133,7 @@ let unknownUrl = $ref(false);
|
|||
const requestUrl = new URL(props.url);
|
||||
if (!['http:', 'https:'].includes(requestUrl.protocol)) throw new Error('invalid url');
|
||||
|
||||
if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twitter.com') {
|
||||
if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twitter.com' || requestUrl.hostname === 'x.com' || requestUrl.hostname === 'mobile.x.com') {
|
||||
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
|
||||
if (m) tweetId = m[1];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue