1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-27 22:38:34 +09:00
This commit is contained in:
NoriDev 2023-08-31 17:49:17 +09:00
parent 588e157d2e
commit b3e7c89f7f
6 changed files with 55 additions and 54 deletions

View File

@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-if="full" :class="$style.text">{{ i18n.ts.processing }}</span><MkLoading :em="true" :colored="false"/>
</template>
</button>
<div v-else-if="disableIfFollowing && isFollowing"><i class="ti ti-circle-check"></i><span style="padding-left: 3px;">{{ i18n.ts.alreadyFollowed }}</span></div>
<div v-else-if="disableIfFollowing && isFollowing"><i class="ti ti-circle-check"></i><span style="padding-left: 3px;">{{ i18n.ts.alreadyFollowed }}</span></div>
</template>
<script lang="ts" setup>
@ -137,8 +137,8 @@ onMounted(() => {
connection.on('follow', onFollowChange);
connection.on('unfollow', onFollowChange);
showFollowButton = $i != null && $i.id != props.user.id;
eventBus.emit('showFollowButton', showFollowButton);
showFollowButton = $i != null && $i.id !== props.user.id;
eventBus.emit('showFollowButton', showFollowButton);
});
onBeforeUnmount(() => {

View File

@ -8,9 +8,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<i v-if="warn" class="ti ti-alert-triangle" :class="$style.i"></i>
<i v-else class="ti ti-info-circle" :class="$style.i"></i>
<slot></slot>
<button v-if="closeable" v-tooltip="i18n.ts.close" :class="$style.close" class="_button" @click.stop="close" :aria-label="i18n.t('close')">
<i class="ti ti-x"></i>
</button>
<button v-if="closeable" v-tooltip="i18n.ts.close" :class="$style.close" class="_button" :aria-label="i18n.t('close')" @click.stop="close">
<i class="ti ti-x"></i>
</button>
</div>
</template>

View File

@ -40,15 +40,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</span>
<span v-if="note.localOnly" style="margin-right: 0.5em;"><i v-tooltip="i18n.ts._visibility['disableFederation']" class="ti ti-rocket-off"></i></span>
<span v-if="note.channel" style="margin-right: 0.5em;"><i v-tooltip="note.channel.name" class="ti ti-device-tv"></i></span>
<span :class="$style.renoteTime">
<button ref="renoteTime" class="_button">
<span :class="$style.renoteTime">
<button ref="renoteTime" class="_button">
<i class="ti ti-dots" :class="$style.renoteMenu" @click="showRenoteMenu()"></i>
</button>
<MkA :to="notePage(note)">
<MkTime v-if="defaultStore.state.enableAbsoluteTime" :time="note.createdAt" mode="absolute"/>
<MkTime v-else :time="note.createdAt" mode="relative"/>
<MkA :to="notePage(note)">
<MkTime v-if="defaultStore.state.enableAbsoluteTime" :time="note.createdAt" mode="absolute"/>
<MkTime v-else :time="note.createdAt" mode="relative"/>
</MkA>
</span>
</span>
</div>
</div>
<MkNoteSub v-if="appearNote.reply && !renoteCollapsed" :note="appearNote.reply" :class="$style.replyTo"/>
@ -139,7 +139,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</button>
<button v-if="appearNote.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-tooltip="i18n.ts.reaction" :class="$style.footerButton" class="_button" @mousedown="react()">
<i v-if="appearNote.myReaction == null" class="ti ti-mood-plus"></i>
<i v-else class="ti ti-mood-edit"></i>
<i v-else class="ti ti-mood-edit"></i>
</button>
<button v-if="appearNote.myReaction != null && appearNote.reactionAcceptance == 'likeOnly'" ref="reactButton" :class="$style.footerButton" class="_button" @click="undoReact(appearNote)">
<i class="ti ti-heart-minus"></i>
@ -319,7 +319,7 @@ async function renote() {
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.renoteConfirm,
caption: i18n.ts.renoteConfirmDescription,
caption: i18n.ts.renoteConfirmDescription,
});
if (canceled) return;
}

View File

@ -395,7 +395,7 @@ let easterEggEngine = $ref(null);
const containerEl = $shallowRef<HTMLElement>();
const whatIsNewCherryPick = () => {
window.open(`https://github.com/kokonect-link/cherrypick/blob/develop/CHANGELOG_CHERRYPICK.md#${version.replace(/\./g, '')}`, '_blank');
window.open(`https://github.com/kokonect-link/cherrypick/blob/develop/CHANGELOG_CHERRYPICK.md#${version.replace(/\./g, '')}`, '_blank');
};
function iconLoaded() {
@ -434,11 +434,12 @@ function getTreasure() {
}
onMounted(() => {
if (window.location.host == 'localhost:3000') isKokonect = true;
else if (window.location.host == 'kokonect.link') isKokonect = true;
else if (window.location.host == 'beta.kokonect.link') isKokonect = true;
else if (window.location.host == 'universe.noridev.moe') isKokonect = true;
})
if (window.location.host === 'localhost:3000') isKokonect = true;
else if (window.location.host === '127.0.0.1:3000') isKokonect = true;
else if (window.location.host === 'kokonect.link') isKokonect = true;
else if (window.location.host === 'beta.kokonect.link') isKokonect = true;
else if (window.location.host === 'universe.noridev.moe') isKokonect = true;
});
onBeforeUnmount(() => {
if (easterEggEngine) {

View File

@ -101,6 +101,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent, provide, onMounted, onBeforeUnmount, ref, watch, ComputedRef, shallowRef, Ref, onUnmounted } from 'vue';
import tinycolor from 'tinycolor2';
import XCommon from './_common_/common.vue';
import type MkStickyContainer from '@/components/global/MkStickyContainer.vue';
import { instanceName } from '@/config';
@ -117,7 +118,6 @@ import { eventBus } from '@/scripts/cherrypick/eventBus';
import { CURRENT_STICKY_BOTTOM } from '@/const';
import { useScrollPositionManager } from '@/nirax';
import CPAvatar from '@/components/global/CPAvatar-Friendly.vue';
import tinycolor from 'tinycolor2';
import { globalEvents } from '@/events';
const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
@ -211,20 +211,20 @@ defaultStore.loaded.then(() => {
});
const calcBg = () => {
const rawBg = 'var(--panel)';
const rawPostBg = 'var(--accent)';
const tinyBg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
const tinyPostBg = tinycolor(rawPostBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawPostBg.slice(4, -1)) : rawPostBg);
if (defaultStore.state.useBlurEffect) {
tinyBg.setAlpha(0.7);
tinyPostBg.setAlpha(0.7);
}
else {
tinyBg.setAlpha(1);
tinyPostBg.setAlpha(1);
}
bg.value = tinyBg.toRgbString();
PostBg.value = tinyPostBg.toRgbString();
const rawBg = 'var(--panel)';
const rawPostBg = 'var(--accent)';
const tinyBg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
const tinyPostBg = tinycolor(rawPostBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawPostBg.slice(4, -1)) : rawPostBg);
if (defaultStore.state.useBlurEffect) {
tinyBg.setAlpha(0.7);
tinyPostBg.setAlpha(0.7);
}
else {
tinyBg.setAlpha(1);
tinyPostBg.setAlpha(1);
}
bg.value = tinyBg.toRgbString();
PostBg.value = tinyPostBg.toRgbString();
};
onMounted(() => {
@ -238,8 +238,8 @@ onMounted(() => {
eventBus.on('queueUpdated', (q) => queueUpdated(q));
calcBg();
globalEvents.on('themeChanged', calcBg);
calcBg();
globalEvents.on('themeChanged', calcBg);
});
onBeforeUnmount(() => {
@ -247,7 +247,7 @@ onBeforeUnmount(() => {
});
onUnmounted(() => {
globalEvents.off('themeChanged', calcBg);
globalEvents.off('themeChanged', calcBg);
});
function onScroll() {

View File

@ -106,7 +106,7 @@ import { deviceKind } from '@/scripts/device-kind';
import { miLocalStorage } from '@/local-storage';
import { CURRENT_STICKY_BOTTOM } from '@/const';
import { useScrollPositionManager } from '@/nirax';
import {eventBus} from "@/scripts/cherrypick/eventBus";
import { eventBus } from '@/scripts/cherrypick/eventBus';
const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
const XSidebar = defineAsyncComponent(() => import('@/ui/_common_/navbar.vue'));
@ -184,27 +184,27 @@ onMounted(() => {
}, { passive: true });
}
contents.value.rootEl.addEventListener('scroll', onScroll);
contents.value.rootEl.addEventListener('scroll', onScroll);
});
onBeforeUnmount(() => {
contents.value.rootEl.removeEventListener('scroll', onScroll);
contents.value.rootEl.removeEventListener('scroll', onScroll);
});
function onScroll() {
const currentScrollPosition = contents.value.rootEl.scrollTop;
if (currentScrollPosition < 0) {
return;
}
// Stop executing this function if the difference between
// current scroll position and last scroll position is less than some offset
if (Math.abs(currentScrollPosition - lastScrollPosition) < 60) {
return;
}
showEl = currentScrollPosition < lastScrollPosition;
lastScrollPosition = currentScrollPosition;
showEl = !showEl;
eventBus.emit('showEl', showEl);
const currentScrollPosition = contents.value.rootEl.scrollTop;
if (currentScrollPosition < 0) {
return;
}
// Stop executing this function if the difference between
// current scroll position and last scroll position is less than some offset
if (Math.abs(currentScrollPosition - lastScrollPosition) < 60) {
return;
}
showEl = currentScrollPosition < lastScrollPosition;
lastScrollPosition = currentScrollPosition;
showEl = !showEl;
eventBus.emit('showEl', showEl);
}
const onContextmenu = (ev) => {