lint fixes

This commit is contained in:
syuilo 2023-10-29 16:09:20 +09:00
parent a161a9c1e7
commit 7436e0da18
15 changed files with 48 additions and 17 deletions

View file

@ -42,6 +42,7 @@ export default defineComponent({
setup(props, { slots, expose }) { setup(props, { slots, expose }) {
const $style = useCssModule(); // 使 const $style = useCssModule(); // 使
function getDateText(time: string) { function getDateText(time: string) {
const date = new Date(time).getDate(); const date = new Date(time).getDate();
const month = new Date(time).getMonth() + 1; const month = new Date(time).getMonth() + 1;
@ -121,6 +122,7 @@ export default defineComponent({
el.style.top = `${el.offsetTop}px`; el.style.top = `${el.offsetTop}px`;
el.style.left = `${el.offsetLeft}px`; el.style.left = `${el.offsetLeft}px`;
} }
function onLeaveCanceled(el: HTMLElement) { function onLeaveCanceled(el: HTMLElement) {
el.style.top = ''; el.style.top = '';
el.style.left = ''; el.style.left = '';

View file

@ -160,6 +160,7 @@ async function ok() {
function cancel() { function cancel() {
done(true); done(true);
} }
/* /*
function onBgClick() { function onBgClick() {
if (props.cancelableByBgClick) cancel(); if (props.cancelableByBgClick) cancel();

View file

@ -505,6 +505,7 @@ function appendFile(file: Misskey.entities.DriveFile) {
function appendFolder(folderToAppend: Misskey.entities.DriveFolder) { function appendFolder(folderToAppend: Misskey.entities.DriveFolder) {
addFolder(folderToAppend); addFolder(folderToAppend);
} }
/* /*
function prependFile(file: Misskey.entities.DriveFile) { function prependFile(file: Misskey.entities.DriveFile) {
addFile(file, true); addFile(file, true);

View file

@ -84,6 +84,7 @@ onMounted(() => {
return getParentBg(el.parentElement); return getParentBg(el.parentElement);
} }
} }
const rawBg = getParentBg(el.value); const rawBg = getParentBg(el.value);
const _bg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg); const _bg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
_bg.setAlpha(0.85); _bg.setAlpha(0.85);

View file

@ -145,11 +145,13 @@ const onGlobalMousedown = (event: MouseEvent) => {
}; };
let childCloseTimer: null | number = null; let childCloseTimer: null | number = null;
function onItemMouseEnter(item) { function onItemMouseEnter(item) {
childCloseTimer = window.setTimeout(() => { childCloseTimer = window.setTimeout(() => {
closeChild(); closeChild();
}, 300); }, 300);
} }
function onItemMouseLeave(item) { function onItemMouseLeave(item) {
if (childCloseTimer) window.clearTimeout(childCloseTimer); if (childCloseTimer) window.clearTimeout(childCloseTimer);
} }

View file

@ -499,6 +499,7 @@ function blur() {
} }
const repliesLoaded = ref(false); const repliesLoaded = ref(false);
function loadReplies() { function loadReplies() {
repliesLoaded.value = true; repliesLoaded.value = true;
os.api('notes/children', { os.api('notes/children', {
@ -510,6 +511,7 @@ function loadReplies() {
} }
const conversationLoaded = ref(false); const conversationLoaded = ref(false);
function loadConversation() { function loadConversation() {
conversationLoaded.value = true; conversationLoaded.value = true;
os.api('notes/conversation', { os.api('notes/conversation', {

View file

@ -87,6 +87,7 @@ function arrayToEntries(entities: MisskeyEntity[]): [string, MisskeyEntity][] {
function concatMapWithArray(map: MisskeyEntityMap, entities: MisskeyEntity[]): MisskeyEntityMap { function concatMapWithArray(map: MisskeyEntityMap, entities: MisskeyEntity[]): MisskeyEntityMap {
return new Map([...map, ...arrayToEntries(entities)]); return new Map([...map, ...arrayToEntries(entities)]);
} }
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';

View file

@ -59,6 +59,7 @@ function toggleSensitive(file) {
emit('changeSensitive', file, !file.isSensitive); emit('changeSensitive', file, !file.isSensitive);
}); });
} }
async function rename(file) { async function rename(file) {
const { canceled, result } = await os.inputText({ const { canceled, result } = await os.inputText({
title: i18n.ts.enterFileName, title: i18n.ts.enterFileName,

View file

@ -134,9 +134,11 @@ async function enter(el: HTMLElement) {
setTimeout(renderTab, 170); setTimeout(renderTab, 170);
} }
function afterEnter(el: HTMLElement) { function afterEnter(el: HTMLElement) {
//el.style.width = ''; //el.style.width = '';
} }
async function leave(el: HTMLElement) { async function leave(el: HTMLElement) {
const elementWidth = el.getBoundingClientRect().width; const elementWidth = el.getBoundingClientRect().width;
el.style.width = elementWidth + 'px'; el.style.width = elementWidth + 'px';
@ -145,6 +147,7 @@ async function leave(el: HTMLElement) {
el.style.width = '0'; el.style.width = '0';
el.style.paddingLeft = '0'; el.style.paddingLeft = '0';
} }
function afterLeave(el: HTMLElement) { function afterLeave(el: HTMLElement) {
el.style.width = ''; el.style.width = '';
} }

View file

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header> <template #header>
<XHeader :actions="headerActions" :tabs="headerTabs" /> <XHeader :actions="headerActions" :tabs="headerTabs"/>
</template> </template>
<MkSpacer :contentMax="900"> <MkSpacer :contentMax="900">
<MkSwitch :modelValue="publishing" @update:modelValue="onChangePublishing"> <MkSwitch :modelValue="publishing" @update:modelValue="onChangePublishing">
@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch> </MkSwitch>
<div> <div>
<div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad"> <div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad">
<MkAd v-if="ad.url" :specify="ad" /> <MkAd v-if="ad.url" :specify="ad"/>
<MkInput v-model="ad.url" type="url"> <MkInput v-model="ad.url" type="url">
<template #label>URL</template> <template #label>URL</template>
</MkInput> </MkInput>
@ -51,8 +51,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<span> <span>
{{ i18n.ts._ad.timezoneinfo }} {{ i18n.ts._ad.timezoneinfo }}
<div v-for="(day, index) in daysOfWeek" :key="index"> <div v-for="(day, index) in daysOfWeek" :key="index">
<input :id="`ad${ad.id}-${index}`" type="checkbox" :checked="(ad.dayOfWeek & (1 << index)) !== 0" <input
@change="toggleDayOfWeek(ad, index)"> :id="`ad${ad.id}-${index}`" type="checkbox" :checked="(ad.dayOfWeek & (1 << index)) !== 0"
@change="toggleDayOfWeek(ad, index)"
>
<label :for="`ad${ad.id}-${index}`">{{ day }}</label> <label :for="`ad${ad.id}-${index}`">{{ day }}</label>
</div> </div>
</span> </span>
@ -61,9 +63,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.memo }}</template> <template #label>{{ i18n.ts.memo }}</template>
</MkTextarea> </MkTextarea>
<div class="buttons"> <div class="buttons">
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"><i <MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)">
class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton> <i
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }} class="ti ti-device-floppy"
></i> {{ i18n.ts.save }}
</MkButton>
<MkButton class="button" inline danger @click="remove(ad)">
<i class="ti ti-trash"></i> {{ i18n.ts.remove }}
</MkButton> </MkButton>
</div> </div>
</div> </div>
@ -115,6 +121,7 @@ const onChangePublishing = (v) => {
publishing = v; publishing = v;
refresh(); refresh();
}; };
// (index) // (index)
function toggleDayOfWeek(ad, index) { function toggleDayOfWeek(ad, index) {
ad.dayOfWeek ^= 1 << index; ad.dayOfWeek ^= 1 << index;
@ -187,6 +194,7 @@ function save(ad) {
}); });
} }
} }
function more() { function more() {
os.api('admin/ad/list', { untilId: ads.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => { os.api('admin/ad/list', { untilId: ads.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => {
ads = ads.concat(adsResponse.map(r => { ads = ads.concat(adsResponse.map(r => {

View file

@ -36,8 +36,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_s"> <div class="_gaps_s">
<MkSwitch v-model="suspended" :disabled="!instance" @update:modelValue="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</MkSwitch> <MkSwitch v-model="suspended" :disabled="!instance" @update:modelValue="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</MkSwitch>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch> <MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
<MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch> <MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
<MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton> <MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton>
</div> </div>
</FormSection> </FormSection>
@ -171,8 +171,8 @@ async function fetch(): Promise<void> {
}); });
suspended = instance.isSuspended; suspended = instance.isSuspended;
isBlocked = instance.isBlocked; isBlocked = instance.isBlocked;
isSilenced = instance.isSilenced; isSilenced = instance.isSilenced;
faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview'); faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview');
} }
async function toggleBlock(): Promise<void> { async function toggleBlock(): Promise<void> {
@ -183,14 +183,16 @@ async function toggleBlock(): Promise<void> {
blockedHosts: isBlocked ? meta.blockedHosts.concat([host]) : meta.blockedHosts.filter(x => x !== host), blockedHosts: isBlocked ? meta.blockedHosts.concat([host]) : meta.blockedHosts.filter(x => x !== host),
}); });
} }
async function toggleSilenced(): Promise<void> { async function toggleSilenced(): Promise<void> {
if (!meta) throw new Error('No meta?'); if (!meta) throw new Error('No meta?');
if (!instance) throw new Error('No instance?'); if (!instance) throw new Error('No instance?');
const { host } = instance; const { host } = instance;
await os.api('admin/update-meta', { await os.api('admin/update-meta', {
silencedHosts: isSilenced ? meta.silencedHosts.concat([host]) : meta.silencedHosts.filter(x => x !== host), silencedHosts: isSilenced ? meta.silencedHosts.concat([host]) : meta.silencedHosts.filter(x => x !== host),
}); });
} }
async function toggleSuspend(): Promise<void> { async function toggleSuspend(): Promise<void> {
if (!instance) throw new Error('No instance?'); if (!instance) throw new Error('No instance?');
await os.api('admin/federation/update-instance', { await os.api('admin/federation/update-instance', {

View file

@ -298,12 +298,14 @@ const emojiIndexLangs = ['en-US'];
function downloadEmojiIndex(lang: string) { function downloadEmojiIndex(lang: string) {
async function main() { async function main() {
const currentIndexes = defaultStore.state.additionalUnicodeEmojiIndexes; const currentIndexes = defaultStore.state.additionalUnicodeEmojiIndexes;
function download() { function download() {
switch (lang) { switch (lang) {
case 'en-US': return import('../../unicode-emoji-indexes/en-US.json').then(x => x.default); case 'en-US': return import('../../unicode-emoji-indexes/en-US.json').then(x => x.default);
default: throw new Error('unrecognized lang: ' + lang); default: throw new Error('unrecognized lang: ' + lang);
} }
} }
currentIndexes[lang] = await download(); currentIndexes[lang] = await download();
await defaultStore.set('additionalUnicodeEmojiIndexes', currentIndexes); await defaultStore.set('additionalUnicodeEmojiIndexes', currentIndexes);
} }
@ -340,6 +342,7 @@ function removePinnedList() {
let smashCount = 0; let smashCount = 0;
let smashTimer: number | null = null; let smashTimer: number | null = null;
function testNotification(): void { function testNotification(): void {
const notification: Misskey.entities.Notification = { const notification: Misskey.entities.Notification = {
id: Math.random().toString(), id: Math.random().toString(),

View file

@ -108,6 +108,7 @@ async function del(): Promise<void> {
router.push('/settings/webhook'); router.push('/settings/webhook');
} }
const headerActions = $computed(() => []); const headerActions = $computed(() => []);
const headerTabs = $computed(() => []); const headerTabs = $computed(() => []);

View file

@ -56,6 +56,7 @@ function copyUrl(file: Misskey.entities.DriveFile) {
copyToClipboard(file.url); copyToClipboard(file.url);
os.success(); os.success();
} }
/* /*
function addApp() { function addApp() {
alert('not implemented yet'); alert('not implemented yet');

View file

@ -46,6 +46,7 @@ export function onScrollTop(el: HTMLElement, cb: () => unknown, tolerance = 1, o
}; };
function removeListener() { container.removeEventListener('scroll', onScroll); } function removeListener() { container.removeEventListener('scroll', onScroll); }
container.addEventListener('scroll', onScroll, { passive: true }); container.addEventListener('scroll', onScroll, { passive: true });
return removeListener; return removeListener;
} }
@ -71,6 +72,7 @@ export function onScrollBottom(el: HTMLElement, cb: () => unknown, tolerance = 1
function removeListener() { function removeListener() {
containerOrWindow.removeEventListener('scroll', onScroll); containerOrWindow.removeEventListener('scroll', onScroll);
} }
containerOrWindow.addEventListener('scroll', onScroll, { passive: true }); containerOrWindow.addEventListener('scroll', onScroll, { passive: true });
return removeListener; return removeListener;
} }