feat: ALT button (#9265)

This commit is contained in:
freeplay 2023-06-25 20:26:15 -04:00
parent 403837051d
commit c867899440
3 changed files with 77 additions and 41 deletions

View file

@ -941,6 +941,7 @@ deleteAccountConfirm: "This will irreversibly delete your account. Proceed?"
incorrectPassword: "Incorrect password." incorrectPassword: "Incorrect password."
voteConfirm: "Confirm your vote for \"{choice}\"?" voteConfirm: "Confirm your vote for \"{choice}\"?"
hide: "Hide" hide: "Hide"
alt: "ALT"
leaveGroup: "Leave group" leaveGroup: "Leave group"
leaveGroupConfirm: "Are you sure you want to leave \"{name}\"?" leaveGroupConfirm: "Are you sure you want to leave \"{name}\"?"
useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile" useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile"

View file

@ -16,24 +16,33 @@
</div> </div>
</button> </button>
<div v-else class="gqnyydlz"> <div v-else class="gqnyydlz">
<a :href="image.url" :title="image.name"> <a :href="image.url">
<ImgWithBlurhash <ImgWithBlurhash
:hash="image.blurhash" :hash="image.blurhash"
:src="url" :src="url"
:alt="image.comment" :alt="image.comment"
:type="image.type" :type="image.type"
:title="image.comment"
:cover="false" :cover="false"
/> />
<div v-if="image.type === 'image/gif'" class="gif">GIF</div> <div v-if="image.type === 'image/gif'" class="gif">GIF</div>
</a> </a>
<button <div class="buttons">
v-tooltip="i18n.ts.hide" <button
class="_button hide" v-if="image.comment"
@click="hide = true" v-tooltip="i18n.ts.alt"
> class="_button"
<i class="ph-eye-slash ph-bold ph-lg"></i> @click.stop="captionPopup"
</button> >
<i class="ph-subtitles ph-bold ph-lg"></i>
</button>
<button
v-tooltip="i18n.ts.hide"
class="_button"
@click="hide = true"
>
<i class="ph-eye-slash ph-bold ph-lg"></i>
</button>
</div>
</div> </div>
</template> </template>
@ -44,6 +53,8 @@ import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue"; import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import * as os from "@/os";
const props = defineProps<{ const props = defineProps<{
image: misskey.entities.DriveFile; image: misskey.entities.DriveFile;
@ -59,6 +70,13 @@ const url =
? getStaticImageUrl(props.image.thumbnailUrl) ? getStaticImageUrl(props.image.thumbnailUrl)
: props.image.thumbnailUrl; : props.image.thumbnailUrl;
function captionPopup() {
os.alert({
type: "info",
text: props.image.comment
})
}
// Plugin:register_note_view_interruptor 使watch // Plugin:register_note_view_interruptor 使watch
watch( watch(
() => props.image, () => props.image,
@ -110,22 +128,22 @@ watch(
position: relative; position: relative;
background: var(--bg); background: var(--bg);
> .hide { > .buttons {
display: block; display: flex;
gap: 4px;
position: absolute; position: absolute;
border-radius: 6px; border-radius: 6px;
background-color: var(--accentedBg); overflow: hidden;
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
color: var(--accent);
font-size: 0.8em;
padding: 6px 8px;
text-align: center;
top: 12px; top: 12px;
right: 12px; right: 12px;
> * {
> i { background-color: var(--accentedBg);
display: block; -webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
color: var(--accent);
font-size: 0.8em;
padding: 6px 8px;
text-align: center;
} }
} }

View file

@ -32,7 +32,6 @@
> >
<video <video
:poster="video.thumbnailUrl" :poster="video.thumbnailUrl"
:title="video.comment"
:aria-label="video.comment" :aria-label="video.comment"
preload="none" preload="none"
controls controls
@ -41,13 +40,23 @@
<source :src="video.url" :type="video.type" /> <source :src="video.url" :type="video.type" />
</video> </video>
</VuePlyr> </VuePlyr>
<button <div class="buttons">
v-tooltip="i18n.ts.hide" <button
class="_button hide" v-if="video.comment"
@click="hide = true" v-tooltip="i18n.ts.alt"
> class="_button"
<i class="ph-eye-slash ph-bold ph-lg"></i> @click.stop="captionPopup"
</button> >
<i class="ph-subtitles ph-bold ph-lg"></i>
</button>
<button
v-tooltip="i18n.ts.hide"
class="_button"
@click="hide = true"
>
<i class="ph-eye-slash ph-bold ph-lg"></i>
</button>
</div>
</div> </div>
</template> </template>
@ -58,6 +67,7 @@ import type * as misskey from "calckey-js";
import { defaultStore } from "@/store"; import { defaultStore } from "@/store";
import "vue-plyr/dist/vue-plyr.css"; import "vue-plyr/dist/vue-plyr.css";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import * as os from "@/os";
const props = defineProps<{ const props = defineProps<{
video: misskey.entities.DriveFile; video: misskey.entities.DriveFile;
@ -72,6 +82,13 @@ const hide = ref(
: props.video.isSensitive && defaultStore.state.nsfw !== "ignore" : props.video.isSensitive && defaultStore.state.nsfw !== "ignore"
); );
function captionPopup() {
os.alert({
type: "info",
text: props.video.comment
})
}
onMounted(() => { onMounted(() => {
mini.value = plyr.value.player.media.scrollWidth < 300; mini.value = plyr.value.player.media.scrollWidth < 300;
if (mini.value) { if (mini.value) {
@ -87,22 +104,22 @@ onMounted(() => {
position: relative; position: relative;
--plyr-color-main: var(--accent); --plyr-color-main: var(--accent);
> .hide { > .buttons {
display: block; display: flex;
gap: 4px;
position: absolute; position: absolute;
border-radius: 6px; border-radius: 6px;
background-color: var(--accentedBg); overflow: hidden;
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
color: var(--accent);
font-size: 0.8em;
padding: 6px 8px;
text-align: center;
top: 12px; top: 12px;
right: 12px; right: 12px;
> * {
> i { background-color: var(--accentedBg);
display: block; -webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
color: var(--accent);
font-size: 0.8em;
padding: 6px 8px;
text-align: center;
} }
} }