wip
This commit is contained in:
@ -19,7 +19,8 @@
|
||||
:type="video.type"
|
||||
>
|
||||
</video>
|
||||
<i class="fas fa-eye-slash" @click="hide = true"></i>
|
||||
<i class="fas fa-window-restore" @click="popup"></i>
|
||||
<!-- <i class="fas fa-eye-slash" @click="hide = true"></i> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -27,12 +28,18 @@
|
||||
import { ref } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import { defaultStore } from '@/store';
|
||||
import * as os from '@/os';
|
||||
|
||||
const props = defineProps<{
|
||||
video: misskey.entities.DriveFile;
|
||||
}>();
|
||||
|
||||
const hide = ref((defaultStore.state.nsfw === 'force') ? true : props.video.isSensitive && (defaultStore.state.nsfw !== 'ignore'));
|
||||
|
||||
function popup() {
|
||||
os.pageWindow(`/media-player/${encodeURIComponent(props.video.id)}`);
|
||||
hide.value = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<transition :name="$store.state.animation ? 'zoom' : ''" mode="out-in">
|
||||
<component :is="self ? 'MkA' : 'a'" v-if="!fetching" class="link" :class="{ compact }" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
|
||||
<div v-if="thumbnail" class="thumbnail" :style="`background-image: url('${thumbnail}')`">
|
||||
<button v-if="!playerEnabled && player.url" class="_button" :title="i18n.ts.enablePlayer" @click.prevent="playerEnabled = false" @click="openPlayer()"><i class="fas fa-play-circle"></i></button>
|
||||
<button v-if="!playerEnabled && player.url" class="_button" :title="i18n.ts.enablePlayer" @click.prevent="isMobile? playerEnabled = true : openPlayer()"><i class="fas fa-play-circle"></i></button>
|
||||
</div>
|
||||
<article>
|
||||
<header>
|
||||
@ -33,10 +33,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { url as local, lang } from '@/config';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { url as local, lang, url } from '@/config';
|
||||
import { i18n } from '@/i18n';
|
||||
import * as os from '@/os';
|
||||
import { deviceKind } from '@/scripts/device-kind';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
@ -47,6 +48,9 @@ const props = withDefaults(defineProps<{
|
||||
compact: false,
|
||||
});
|
||||
|
||||
const MOBILE_THRESHOLD = 500;
|
||||
const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
|
||||
|
||||
const self = props.url.startsWith(local);
|
||||
const attr = self ? 'to' : 'href';
|
||||
const target = self ? null : '_blank';
|
||||
@ -105,7 +109,7 @@ function adjustTweetHeight(message: any) {
|
||||
}
|
||||
|
||||
const openPlayer = () => {
|
||||
os.pageWindow(`/ytplayer/${encodeURIComponent(requestUrl.href)}`);
|
||||
os.pageWindow(`/media-player/${encodeURIComponent(requestUrl.href)}`);
|
||||
};
|
||||
|
||||
(window as any).addEventListener('message', adjustTweetHeight);
|
||||
|
Reference in New Issue
Block a user