1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-28 14:58:15 +09:00
This commit is contained in:
syuilo 2022-03-01 21:36:20 +09:00
parent 645dbebd86
commit b80ec1fa3f
9 changed files with 40 additions and 47 deletions

View File

@ -57,7 +57,7 @@ const lib = emojilist.filter(x => x.category !== 'flags');
const char2file = (char: string) => {
let codes = Array.from(char).map(x => x.codePointAt(0)?.toString(16));
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
if (!codes.includes('200d')) codes = codes.filter(x => x !== 'fe0f');
return codes.filter(x => x && x.length).join('-');
};
@ -208,7 +208,7 @@ function exec() {
});
}
} else if (props.type === 'hashtag') {
if (!props.q || props.q == '') {
if (!props.q || props.q === '') {
hashtags.value = JSON.parse(localStorage.getItem('hashtags') || '[]');
fetching.value = false;
} else {
@ -231,7 +231,7 @@ function exec() {
}
}
} else if (props.type === 'emoji') {
if (!props.q || props.q == '') {
if (!props.q || props.q === '') {
// 使
emojis.value = defaultStore.state.recentlyUsedEmojis.map(emoji => emojiDb.find(e => e.emoji == emoji)).filter(x => x) as EmojiDef[];
return;
@ -241,37 +241,37 @@ function exec() {
const max = 30;
emojiDb.some(x => {
if (x.name.startsWith(props.q || '') && !x.aliasOf && !matched.some(y => y.emoji == x.emoji)) matched.push(x);
return matched.length == max;
if (x.name.startsWith(props.q ?? '') && !x.aliasOf && !matched.some(y => y.emoji === x.emoji)) matched.push(x);
return matched.length === max;
});
if (matched.length < max) {
emojiDb.some(x => {
if (x.name.startsWith(props.q || '') && !matched.some(y => y.emoji == x.emoji)) matched.push(x);
return matched.length == max;
if (x.name.startsWith(props.q ?? '') && !matched.some(y => y.emoji === x.emoji)) matched.push(x);
return matched.length === max;
});
}
if (matched.length < max) {
emojiDb.some(x => {
if (x.name.includes(props.q || '') && !matched.some(y => y.emoji == x.emoji)) matched.push(x);
return matched.length == max;
if (x.name.includes(props.q ?? '') && !matched.some(y => y.emoji === x.emoji)) matched.push(x);
return matched.length === max;
});
}
emojis.value = matched;
} else if (props.type === 'mfmTag') {
if (!props.q || props.q == '') {
if (!props.q || props.q === '') {
mfmTags.value = MFM_TAGS;
return;
}
mfmTags.value = MFM_TAGS.filter(tag => tag.startsWith(props.q || ''));
mfmTags.value = MFM_TAGS.filter(tag => tag.startsWith(props.q ?? ''));
}
}
function onMousedown(e: Event) {
if (!contains(rootEl.value, e.target) && (rootEl.value != e.target)) props.close();
if (!contains(rootEl.value, e.target) && (rootEl.value !== e.target)) props.close();
}
function onKeydown(e: KeyboardEvent) {
@ -348,7 +348,7 @@ function chooseUser() {
onUpdated(() => {
setPosition();
items.value = suggests.value?.children || [];
items.value = suggests.value?.children ?? [];
});
onMounted(() => {

View File

@ -93,7 +93,7 @@ function requestRender() {
}
function callback(response?: string) {
emit('update:modelValue', typeof response == 'string' ? response : null);
emit('update:modelValue', typeof response === 'string' ? response : null);
}
onMounted(() => {

View File

@ -53,8 +53,8 @@ export default defineComponent({
if (el.key == null && item.id) el.key = item.id;
if (
i != props.items.length - 1 &&
new Date(item.createdAt).getDate() != new Date(props.items[i + 1].createdAt).getDate()
i !== props.items.length - 1 &&
new Date(item.createdAt).getDate() !== new Date(props.items[i + 1].createdAt).getDate()
) {
const separator = h('div', {
class: 'separator',

View File

@ -45,7 +45,7 @@ export default defineComponent({
},
render() {
if (this.text == null || this.text == '') return;
if (this.text == null || this.text === '') return;
const ast = (this.plain ? mfm.parsePlain : mfm.parse)(this.text, { fnNameList: MFM_TAGS });

View File

@ -6,33 +6,26 @@
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
<script lang="ts" setup>
import { onMounted } from 'vue';
import XNotification from './notification.vue';
import * as os from '@/os';
export default defineComponent({
components: {
XNotification
},
props: {
notification: {
type: Object,
required: true
}
},
emits: ['closed'],
data() {
return {
showing: true,
zIndex: os.claimZIndex('high'),
};
},
mounted() {
window.setTimeout(() => {
this.showing = false;
}, 6000);
}
defineProps<{
notification: any; // TODO
}>();
const emit = defineEmits<{
(ev: 'closed'): void;
}>();
const zIndex = os.claimZIndex('high');
let showing = $ref(true);
onMounted(() => {
window.setTimeout(() => {
showing = false;
}, 6000);
});
</script>

View File

@ -22,12 +22,12 @@ const emit = defineEmits<{
(e: 'closed'): void;
}>();
const showing = ref(true);
const zIndex = os.claimZIndex('high');
let showing = $ref(true);
onMounted(() => {
window.setTimeout(() => {
showing.value = false;
showing = false;
}, 4000);
});
</script>

View File

@ -67,7 +67,7 @@ let tweetHeight = $ref(150);
const requestUrl = new URL(props.url);
if (requestUrl.hostname == 'twitter.com') {
if (requestUrl.hostname === 'twitter.com') {
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
if (m) tweetId = m[1];
}

View File

@ -544,7 +544,7 @@ export const uploads = ref<{
}[]>([]);
export function upload(file: File, folder?: any, name?: string, keepOriginal: boolean = defaultStore.state.keepOriginalUploading): Promise<Misskey.entities.DriveFile> {
if (folder && typeof folder == 'object') folder = folder.id;
if (folder && typeof folder === 'object') folder = folder.id;
return new Promise((resolve, reject) => {
const id = Math.random().toString();

View File

@ -123,8 +123,8 @@ export default defineComponent({
const installedThemes = ref(getThemes());
const themes = computed(() => builtinThemes.concat(installedThemes.value));
const darkThemes = computed(() => themes.value.filter(t => t.base == 'dark' || t.kind == 'dark'));
const lightThemes = computed(() => themes.value.filter(t => t.base == 'light' || t.kind == 'light'));
const darkThemes = computed(() => themes.value.filter(t => t.base === 'dark' || t.kind === 'dark'));
const lightThemes = computed(() => themes.value.filter(t => t.base === 'light' || t.kind === 'light'));
const darkTheme = ColdDeviceStorage.ref('darkTheme');
const darkThemeId = computed({
get() {