fix lints (#8737)
* fix: emits use ev instead of e * fix: errors use err instead of e * fix: replace use of data where possible * fix: events use evt instead of e * fix: use strict equals * fix: use emoji instead of e * fix: vue lints
This commit is contained in:
parent
9c80403072
commit
3dae18b93c
@ -11,10 +11,10 @@ import { i18n } from './i18n';
|
||||
|
||||
type Account = misskey.entities.MeDetailed;
|
||||
|
||||
const data = localStorage.getItem('account');
|
||||
const accountData = localStorage.getItem('account');
|
||||
|
||||
// TODO: 外部からはreadonlyに
|
||||
export const $i = data ? reactive(JSON.parse(data) as Account) : null;
|
||||
export const $i = accountData ? reactive(JSON.parse(accountData) as Account) : null;
|
||||
|
||||
export const iAmModerator = $i != null && ($i.isAdmin || $i.isModerator);
|
||||
|
||||
@ -52,7 +52,7 @@ export async function signout() {
|
||||
return Promise.all(registrations.map(registration => registration.unregister()));
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (err) {}
|
||||
//#endregion
|
||||
|
||||
document.cookie = `igi=; path=/`;
|
||||
@ -104,8 +104,8 @@ function fetchAccount(token: string): Promise<Account> {
|
||||
});
|
||||
}
|
||||
|
||||
export function updateAccount(data) {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
export function updateAccount(accountData) {
|
||||
for (const [key, value] of Object.entries(accountData)) {
|
||||
$i[key] = value;
|
||||
}
|
||||
localStorage.setItem('account', JSON.stringify($i));
|
||||
|
@ -37,7 +37,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const window = ref<InstanceType<typeof XWindow>>();
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="bcekxzvu _card _gap">
|
||||
<div class="_content target">
|
||||
<MkAvatar class="avatar" :user="report.targetUser" :show-indicator="true"/>
|
||||
<MkA class="info" :to="userPage(report.targetUser)" v-user-preview="report.targetUserId">
|
||||
<MkA v-user-preview="report.targetUserId" class="info" :to="userPage(report.targetUser)">
|
||||
<MkUserName class="name" :user="report.targetUser"/>
|
||||
<MkAcct class="acct" :user="report.targetUser" style="display: block;"/>
|
||||
</MkA>
|
||||
|
@ -48,8 +48,8 @@ async function onClick() {
|
||||
});
|
||||
isFollowing.value = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
wait.value = false;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: boolean): void;
|
||||
(ev: 'update:modelValue', v: boolean): void;
|
||||
}>();
|
||||
|
||||
const label = computed(() => {
|
||||
|
@ -90,8 +90,8 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', v: { canceled: boolean; result: any }): void;
|
||||
(e: 'closed'): void;
|
||||
(ev: 'done', v: { canceled: boolean; result: any }): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const modal = ref<InstanceType<typeof MkModal>>();
|
||||
@ -122,14 +122,14 @@ function onBgClick() {
|
||||
if (props.cancelableByBgClick) cancel();
|
||||
}
|
||||
*/
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') cancel();
|
||||
function onKeydown(evt: KeyboardEvent) {
|
||||
if (evt.key === 'Escape') cancel();
|
||||
}
|
||||
|
||||
function onInputKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
function onInputKeydown(evt: KeyboardEvent) {
|
||||
if (evt.key === 'Enter') {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
ok();
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ if (props.user.isFollowing == null) {
|
||||
}
|
||||
|
||||
function onFollowChange(user: Misskey.entities.UserDetailed) {
|
||||
if (user.id == props.user.id) {
|
||||
if (user.id === props.user.id) {
|
||||
isFollowing.value = user.isFollowing;
|
||||
hasPendingFollowRequestFromYou.value = user.hasPendingFollowRequestFromYou;
|
||||
}
|
||||
@ -96,8 +96,8 @@ async function onClick() {
|
||||
hasPendingFollowRequestFromYou.value = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
wait.value = false;
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ import { instance } from '@/instance';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'closed'): void;
|
||||
(ev: 'done'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
let dialog: InstanceType<typeof XModalWindow> = $ref();
|
||||
|
@ -44,7 +44,7 @@
|
||||
<template #label><span v-text="form[item].label || item"></span><span v-if="form[item].required === false"> ({{ $ts.optional }})</span></template>
|
||||
<template v-if="form[item].description" #caption>{{ form[item].description }}</template>
|
||||
</FormRange>
|
||||
<MkButton v-else-if="form[item].type === 'button'" @click="form[item].action($event, values)" class="_formBlock">
|
||||
<MkButton v-else-if="form[item].type === 'button'" class="_formBlock" @click="form[item].action($event, values)">
|
||||
<span v-text="form[item].content || item"></span>
|
||||
</MkButton>
|
||||
</template>
|
||||
|
@ -31,7 +31,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: boolean): void;
|
||||
(ev: 'update:modelValue', v: boolean): void;
|
||||
}>();
|
||||
|
||||
let button = $ref<HTMLElement>();
|
||||
|
@ -32,7 +32,7 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click', ev: MouseEvent): void;
|
||||
(ev: 'click', v: MouseEvent): void;
|
||||
}>();
|
||||
|
||||
const url = $computed(() => defaultStore.state.disableShowingAnimatedImages
|
||||
|
@ -46,7 +46,7 @@ export default defineComponent({
|
||||
const url = computed(() => {
|
||||
if (char.value) {
|
||||
let codes = Array.from(char.value).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');
|
||||
codes = codes.filter(x => x && x.length);
|
||||
return `${twemojiSvgBase}/${codes.join('-')}.svg`;
|
||||
} else {
|
||||
|
@ -17,7 +17,7 @@ const props = withDefaults(defineProps<{
|
||||
mode: 'relative',
|
||||
});
|
||||
|
||||
const _time = typeof props.time == 'string' ? new Date(props.time) : props.time;
|
||||
const _time = typeof props.time === 'string' ? new Date(props.time) : props.time;
|
||||
const absolute = _time.toLocaleString();
|
||||
|
||||
let now = $ref(new Date());
|
||||
|
@ -25,7 +25,7 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const modal = $ref<InstanceType<typeof MkModal>>();
|
||||
|
@ -77,7 +77,7 @@ export default defineComponent({
|
||||
|
||||
computed: {
|
||||
remainingLength(): number {
|
||||
if (typeof this.inputValue != "string") return 512;
|
||||
if (typeof this.inputValue !== "string") return 512;
|
||||
return 512 - length(this.inputValue);
|
||||
}
|
||||
},
|
||||
@ -116,17 +116,17 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
onKeydown(e) {
|
||||
if (e.which === 27) { // ESC
|
||||
onKeydown(evt) {
|
||||
if (evt.which === 27) { // ESC
|
||||
this.cancel();
|
||||
}
|
||||
},
|
||||
|
||||
onInputKeydown(e) {
|
||||
if (e.which === 13) { // Enter
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onInputKeydown(evt) {
|
||||
if (evt.which === 13) { // Enter
|
||||
if (evt.ctrlKey) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this.ok();
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
<div
|
||||
v-if="!muted"
|
||||
v-show="!isDeleted"
|
||||
ref="el"
|
||||
v-hotkey="keymap"
|
||||
v-size="{ max: [500, 450, 350, 300] }"
|
||||
ref="el"
|
||||
class="lxwezrsl _block"
|
||||
:tabindex="!isDeleted ? '-1' : null"
|
||||
:class="{ renote: isRenote }"
|
||||
@ -197,7 +197,7 @@ const keymap = {
|
||||
'q': () => renoteButton.value.renote(true),
|
||||
'esc': blur,
|
||||
'm|o': () => menu(true),
|
||||
's': () => showContent.value != showContent.value,
|
||||
's': () => showContent.value !== showContent.value,
|
||||
};
|
||||
|
||||
useNoteCapture({
|
||||
|
@ -185,7 +185,7 @@ const keymap = {
|
||||
'down|j|tab': focusAfter,
|
||||
'esc': blur,
|
||||
'm|o': () => menu(true),
|
||||
's': () => showContent.value != showContent.value,
|
||||
's': () => showContent.value !== showContent.value,
|
||||
};
|
||||
|
||||
useNoteCapture({
|
||||
|
@ -52,16 +52,16 @@ export default defineComponent({
|
||||
const promise = new Promise((ok) => {
|
||||
const canvas = this.hpml.canvases[this.block.canvasId];
|
||||
canvas.toBlob(blob => {
|
||||
const data = new FormData();
|
||||
data.append('file', blob);
|
||||
data.append('i', this.$i.token);
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob);
|
||||
formData.append('i', this.$i.token);
|
||||
if (this.$store.state.uploadFolder) {
|
||||
data.append('folderId', this.$store.state.uploadFolder);
|
||||
formData.append('folderId', this.$store.state.uploadFolder);
|
||||
}
|
||||
|
||||
fetch(apiUrl + '/drive/files/create', {
|
||||
method: 'POST',
|
||||
body: data
|
||||
body: formData,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(f => {
|
||||
|
@ -38,8 +38,8 @@ export default defineComponent({
|
||||
let ast;
|
||||
try {
|
||||
ast = parse(props.page.script);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
/*os.alert({
|
||||
type: 'error',
|
||||
text: 'Syntax error :('
|
||||
@ -48,11 +48,11 @@ export default defineComponent({
|
||||
}
|
||||
hpml.aiscript.exec(ast).then(() => {
|
||||
hpml.eval();
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
/*os.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
text: err
|
||||
});*/
|
||||
});
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ function add() {
|
||||
}
|
||||
|
||||
function remove(i) {
|
||||
choices.value = choices.value.filter((_, _i) => _i != i);
|
||||
choices.value = choices.value.filter((_, _i) => _i !== i);
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
@ -98,7 +98,7 @@ export default defineComponent({
|
||||
}, {
|
||||
done: result => {
|
||||
if (!result || result.canceled) return;
|
||||
let comment = result.result.length == 0 ? null : result.result;
|
||||
let comment = result.result.length === 0 ? null : result.result;
|
||||
os.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
comment: comment,
|
||||
|
@ -107,7 +107,7 @@ const props = withDefaults(defineProps<{
|
||||
fixed?: boolean;
|
||||
autofocus?: boolean;
|
||||
}>(), {
|
||||
initialVisibleUsers: [],
|
||||
initialVisibleUsers: () => [],
|
||||
autofocus: true,
|
||||
});
|
||||
|
||||
|
@ -27,8 +27,8 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'closed'): void;
|
||||
(ev: 'done'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const dialog = $ref<InstanceType<typeof XModalWindow>>();
|
||||
|
@ -124,20 +124,20 @@ export default defineComponent({
|
||||
this.meta.tosUrl && !this.ToSAgreement ||
|
||||
this.meta.enableHcaptcha && !this.hCaptchaResponse ||
|
||||
this.meta.enableRecaptcha && !this.reCaptchaResponse ||
|
||||
this.passwordRetypeState == 'not-match';
|
||||
this.passwordRetypeState === 'not-match';
|
||||
},
|
||||
|
||||
shouldShowProfileUrl(): boolean {
|
||||
return (this.username != '' &&
|
||||
this.usernameState != 'invalid-format' &&
|
||||
this.usernameState != 'min-range' &&
|
||||
this.usernameState != 'max-range');
|
||||
return (this.username !== '' &&
|
||||
this.usernameState !== 'invalid-format' &&
|
||||
this.usernameState !== 'min-range' &&
|
||||
this.usernameState !== 'max-range');
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChangeUsername() {
|
||||
if (this.username == '') {
|
||||
if (this.username === '') {
|
||||
this.usernameState = null;
|
||||
return;
|
||||
}
|
||||
@ -165,7 +165,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
onChangeEmail() {
|
||||
if (this.email == '') {
|
||||
if (this.email === '') {
|
||||
this.emailState = null;
|
||||
return;
|
||||
}
|
||||
@ -188,7 +188,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
onChangePassword() {
|
||||
if (this.password == '') {
|
||||
if (this.password === '') {
|
||||
this.passwordStrength = '';
|
||||
return;
|
||||
}
|
||||
@ -198,12 +198,12 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
onChangePasswordRetype() {
|
||||
if (this.retypedPassword == '') {
|
||||
if (this.retypedPassword === '') {
|
||||
this.passwordRetypeState = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match';
|
||||
this.passwordRetypeState = this.password === this.retypedPassword ? 'match' : 'not-match';
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
|
@ -19,8 +19,8 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'note'): void;
|
||||
(e: 'queue', count: number): void;
|
||||
(ev: 'note'): void;
|
||||
(ev: 'queue', count: number): void;
|
||||
}>();
|
||||
|
||||
provide('inChannel', computed(() => props.src === 'channel'));
|
||||
@ -95,7 +95,7 @@ if (props.src === 'antenna') {
|
||||
visibility: 'specified'
|
||||
};
|
||||
const onNote = note => {
|
||||
if (note.visibility == 'specified') {
|
||||
if (note.visibility === 'specified') {
|
||||
prepend(note);
|
||||
}
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const zIndex = os.claimZIndex('high');
|
||||
|
@ -90,7 +90,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onMousedown(e: MouseEvent) {
|
||||
onMousedown(evt: MouseEvent) {
|
||||
function distance(p, q) {
|
||||
return Math.hypot(p.x - q.x, p.y - q.y);
|
||||
}
|
||||
@ -104,18 +104,18 @@ export default defineComponent({
|
||||
return Math.max(dist1, dist2, dist3, dist4) * 2;
|
||||
}
|
||||
|
||||
const rect = e.target.getBoundingClientRect();
|
||||
const rect = evt.target.getBoundingClientRect();
|
||||
|
||||
const ripple = document.createElement('div');
|
||||
ripple.style.top = (e.clientY - rect.top - 1).toString() + 'px';
|
||||
ripple.style.left = (e.clientX - rect.left - 1).toString() + 'px';
|
||||
ripple.style.top = (evt.clientY - rect.top - 1).toString() + 'px';
|
||||
ripple.style.left = (evt.clientX - rect.left - 1).toString() + 'px';
|
||||
|
||||
this.$refs.ripples.appendChild(ripple);
|
||||
|
||||
const circleCenterX = e.clientX - rect.left;
|
||||
const circleCenterY = e.clientY - rect.top;
|
||||
const circleCenterX = evt.clientX - rect.left;
|
||||
const circleCenterY = evt.clientY - rect.top;
|
||||
|
||||
const scale = calcCircleScale(e.target.clientWidth, e.target.clientHeight, circleCenterX, circleCenterY);
|
||||
const scale = calcCircleScale(evt.target.clientWidth, evt.target.clientHeight, circleCenterX, circleCenterY);
|
||||
|
||||
window.setTimeout(() => {
|
||||
ripple.style.transform = 'scale(' + (scale / 2) + ')';
|
||||
|
@ -19,7 +19,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
let rootEl = $ref<HTMLDivElement>();
|
||||
@ -63,8 +63,8 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function onMousedown(e: Event) {
|
||||
if (!contains(rootEl, e.target) && (rootEl != e.target)) emit('closed');
|
||||
function onMousedown(evt: Event) {
|
||||
if (!contains(rootEl, evt.target) && (rootEl !== evt.target)) emit('closed');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -60,7 +60,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'close'): void;
|
||||
(ev: 'close'): void;
|
||||
}>();
|
||||
|
||||
let itemsEl = $ref<HTMLDivElement>();
|
||||
|
@ -79,10 +79,10 @@ export default defineComponent({
|
||||
this.$refs.modal.close();
|
||||
},
|
||||
|
||||
onKeydown(e) {
|
||||
if (e.which === 27) { // Esc
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onKeydown(evt) {
|
||||
if (evt.which === 27) { // Esc
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'queue', count: number): void;
|
||||
(ev: 'queue', count: number): void;
|
||||
}>();
|
||||
|
||||
type Item = { id: string; [another: string]: unknown; };
|
||||
@ -112,7 +112,7 @@ const init = async (): Promise<void> => {
|
||||
offset.value = res.length;
|
||||
error.value = false;
|
||||
fetching.value = false;
|
||||
}, e => {
|
||||
}, err => {
|
||||
error.value = true;
|
||||
fetching.value = false;
|
||||
});
|
||||
@ -155,7 +155,7 @@ const fetchMore = async (): Promise<void> => {
|
||||
}
|
||||
offset.value += res.length;
|
||||
moreFetching.value = false;
|
||||
}, e => {
|
||||
}, err => {
|
||||
moreFetching.value = false;
|
||||
});
|
||||
};
|
||||
@ -183,7 +183,7 @@ const fetchMoreAhead = async (): Promise<void> => {
|
||||
}
|
||||
offset.value += res.length;
|
||||
moreFetching.value = false;
|
||||
}, e => {
|
||||
}, err => {
|
||||
moreFetching.value = false;
|
||||
});
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
let modal = $ref<InstanceType<typeof MkModal>>();
|
||||
|
@ -139,10 +139,10 @@ export default defineComponent({
|
||||
this.showing = false;
|
||||
},
|
||||
|
||||
onKeydown(e) {
|
||||
if (e.which === 27) { // Esc
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onKeydown(evt) {
|
||||
if (evt.which === 27) { // Esc
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
@ -162,15 +162,15 @@ export default defineComponent({
|
||||
this.top();
|
||||
},
|
||||
|
||||
onHeaderMousedown(e) {
|
||||
onHeaderMousedown(evt) {
|
||||
const main = this.$el as any;
|
||||
|
||||
if (!contains(main, document.activeElement)) main.focus();
|
||||
|
||||
const position = main.getBoundingClientRect();
|
||||
|
||||
const clickX = e.touches && e.touches.length > 0 ? e.touches[0].clientX : e.clientX;
|
||||
const clickY = e.touches && e.touches.length > 0 ? e.touches[0].clientY : e.clientY;
|
||||
const clickX = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientX : evt.clientX;
|
||||
const clickY = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientY : evt.clientY;
|
||||
const moveBaseX = clickX - position.left;
|
||||
const moveBaseY = clickY - position.top;
|
||||
const browserWidth = window.innerWidth;
|
||||
@ -204,10 +204,10 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 上ハンドル掴み時
|
||||
onTopHandleMousedown(e) {
|
||||
onTopHandleMousedown(evt) {
|
||||
const main = this.$el as any;
|
||||
|
||||
const base = e.clientY;
|
||||
const base = evt.clientY;
|
||||
const height = parseInt(getComputedStyle(main, '').height, 10);
|
||||
const top = parseInt(getComputedStyle(main, '').top, 10);
|
||||
|
||||
@ -230,10 +230,10 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 右ハンドル掴み時
|
||||
onRightHandleMousedown(e) {
|
||||
onRightHandleMousedown(evt) {
|
||||
const main = this.$el as any;
|
||||
|
||||
const base = e.clientX;
|
||||
const base = evt.clientX;
|
||||
const width = parseInt(getComputedStyle(main, '').width, 10);
|
||||
const left = parseInt(getComputedStyle(main, '').left, 10);
|
||||
const browserWidth = window.innerWidth;
|
||||
@ -254,10 +254,10 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 下ハンドル掴み時
|
||||
onBottomHandleMousedown(e) {
|
||||
onBottomHandleMousedown(evt) {
|
||||
const main = this.$el as any;
|
||||
|
||||
const base = e.clientY;
|
||||
const base = evt.clientY;
|
||||
const height = parseInt(getComputedStyle(main, '').height, 10);
|
||||
const top = parseInt(getComputedStyle(main, '').top, 10);
|
||||
const browserHeight = window.innerHeight;
|
||||
@ -278,10 +278,10 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 左ハンドル掴み時
|
||||
onLeftHandleMousedown(e) {
|
||||
onLeftHandleMousedown(evt) {
|
||||
const main = this.$el as any;
|
||||
|
||||
const base = e.clientX;
|
||||
const base = evt.clientX;
|
||||
const width = parseInt(getComputedStyle(main, '').width, 10);
|
||||
const left = parseInt(getComputedStyle(main, '').left, 10);
|
||||
|
||||
@ -304,27 +304,27 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 左上ハンドル掴み時
|
||||
onTopLeftHandleMousedown(e) {
|
||||
this.onTopHandleMousedown(e);
|
||||
this.onLeftHandleMousedown(e);
|
||||
onTopLeftHandleMousedown(evt) {
|
||||
this.onTopHandleMousedown(evt);
|
||||
this.onLeftHandleMousedown(evt);
|
||||
},
|
||||
|
||||
// 右上ハンドル掴み時
|
||||
onTopRightHandleMousedown(e) {
|
||||
this.onTopHandleMousedown(e);
|
||||
this.onRightHandleMousedown(e);
|
||||
onTopRightHandleMousedown(evt) {
|
||||
this.onTopHandleMousedown(evt);
|
||||
this.onRightHandleMousedown(evt);
|
||||
},
|
||||
|
||||
// 右下ハンドル掴み時
|
||||
onBottomRightHandleMousedown(e) {
|
||||
this.onBottomHandleMousedown(e);
|
||||
this.onRightHandleMousedown(e);
|
||||
onBottomRightHandleMousedown(evt) {
|
||||
this.onBottomHandleMousedown(evt);
|
||||
this.onRightHandleMousedown(evt);
|
||||
},
|
||||
|
||||
// 左下ハンドル掴み時
|
||||
onBottomLeftHandleMousedown(e) {
|
||||
this.onBottomHandleMousedown(e);
|
||||
this.onLeftHandleMousedown(e);
|
||||
onBottomLeftHandleMousedown(evt) {
|
||||
this.onBottomHandleMousedown(evt);
|
||||
this.onLeftHandleMousedown(evt);
|
||||
},
|
||||
|
||||
// 高さを適用
|
||||
|
@ -70,7 +70,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (typeof this.q == 'object') {
|
||||
if (typeof this.q === 'object') {
|
||||
this.user = this.q;
|
||||
this.fetched = true;
|
||||
} else {
|
||||
|
@ -60,9 +60,9 @@ import * as os from '@/os';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'ok', selected: misskey.entities.UserDetailed): void;
|
||||
(e: 'cancel'): void;
|
||||
(e: 'closed'): void;
|
||||
(ev: 'ok', selected: misskey.entities.UserDetailed): void;
|
||||
(ev: 'cancel'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
let username = $ref('');
|
||||
|
@ -57,9 +57,9 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'changeVisibility', v: typeof misskey.noteVisibilities[number]): void;
|
||||
(e: 'changeLocalOnly', v: boolean): void;
|
||||
(e: 'closed'): void;
|
||||
(ev: 'changeVisibility', v: typeof misskey.noteVisibilities[number]): void;
|
||||
(ev: 'changeLocalOnly', v: boolean): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
let v = $ref(props.currentVisibility);
|
||||
|
@ -21,8 +21,8 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done');
|
||||
(e: 'closed');
|
||||
(ev: 'done');
|
||||
(ev: 'closed');
|
||||
}>();
|
||||
|
||||
function done() {
|
||||
|
@ -19,7 +19,7 @@
|
||||
<div class="customize-container">
|
||||
<button class="config _button" @click.prevent.stop="configWidget(element.id)"><i class="fas fa-cog"></i></button>
|
||||
<button class="remove _button" @click.prevent.stop="removeWidget(element)"><i class="fas fa-times"></i></button>
|
||||
<component class="handle" :ref="el => widgetRefs[element.id] = el" :is="`mkw-${element.name}`" :widget="element" @updateProps="updateWidget(element.id, $event)"/>
|
||||
<component :is="`mkw-${element.name}`" :ref="el => widgetRefs[element.id] = el" class="handle" :widget="element" @updateProps="updateWidget(element.id, $event)"/>
|
||||
</div>
|
||||
</template>
|
||||
</XDraggable>
|
||||
|
@ -1,7 +1,7 @@
|
||||
export default (v, digits = 0) => {
|
||||
if (v == null) return '?';
|
||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (v == 0) return '0';
|
||||
if (v === 0) return '0';
|
||||
const isMinus = v < 0;
|
||||
if (isMinus) v = -v;
|
||||
const i = Math.floor(Math.log(v) / Math.log(1024));
|
||||
|
@ -146,7 +146,7 @@ if ($i && $i.token) {
|
||||
try {
|
||||
document.body.innerHTML = '<div>Please wait...</div>';
|
||||
await login(i);
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
// Render the error screen
|
||||
// TODO: ちゃんとしたコンポーネントをレンダリングする(v10とかのトラブルシューティングゲーム付きのやつみたいな)
|
||||
document.body.innerHTML = '<div id="err">Oops!</div>';
|
||||
@ -249,7 +249,7 @@ if (lastVersion !== version) {
|
||||
popup(defineAsyncComponent(() => import('@/components/updated.vue')), {}, {}, 'closed');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ stream.on('_disconnected_', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('emojiAdded', data => {
|
||||
stream.on('emojiAdded', emojiData => {
|
||||
// TODO
|
||||
//store.commit('instance/set', );
|
||||
});
|
||||
|
@ -4,11 +4,11 @@ import { api } from './os';
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
||||
const data = localStorage.getItem('instance');
|
||||
const instanceData = localStorage.getItem('instance');
|
||||
|
||||
// TODO: instanceをリアクティブにするかは再考の余地あり
|
||||
|
||||
export const instance: Misskey.entities.InstanceMetadata = reactive(data ? JSON.parse(data) : {
|
||||
export const instance: Misskey.entities.InstanceMetadata = reactive(instanceData ? JSON.parse(instanceData) : {
|
||||
// TODO: set default values
|
||||
});
|
||||
|
||||
|
@ -59,10 +59,10 @@ export const apiWithDialog = ((
|
||||
token?: string | null | undefined,
|
||||
) => {
|
||||
const promise = api(endpoint, data, token);
|
||||
promiseDialog(promise, null, (e) => {
|
||||
promiseDialog(promise, null, (err) => {
|
||||
alert({
|
||||
type: 'error',
|
||||
text: e.message + '\n' + (e as any).id,
|
||||
text: err.message + '\n' + (err as any).id,
|
||||
});
|
||||
});
|
||||
|
||||
@ -72,7 +72,7 @@ export const apiWithDialog = ((
|
||||
export function promiseDialog<T extends Promise<any>>(
|
||||
promise: T,
|
||||
onSuccess?: ((res: any) => void) | null,
|
||||
onFailure?: ((e: Error) => void) | null,
|
||||
onFailure?: ((err: Error) => void) | null,
|
||||
text?: string,
|
||||
): T {
|
||||
const showing = ref(true);
|
||||
@ -88,14 +88,14 @@ export function promiseDialog<T extends Promise<any>>(
|
||||
showing.value = false;
|
||||
}, 1000);
|
||||
}
|
||||
}).catch(e => {
|
||||
}).catch(err => {
|
||||
showing.value = false;
|
||||
if (onFailure) {
|
||||
onFailure(e);
|
||||
onFailure(err);
|
||||
} else {
|
||||
alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
text: err,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -175,10 +175,10 @@ const menu = (ev: MouseEvent) => {
|
||||
type: 'info',
|
||||
text: i18n.ts.exportRequested,
|
||||
});
|
||||
}).catch((e) => {
|
||||
}).catch((err) => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e.message,
|
||||
text: err.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -195,10 +195,10 @@ const menu = (ev: MouseEvent) => {
|
||||
type: 'info',
|
||||
text: i18n.ts.importRequested,
|
||||
});
|
||||
}).catch((e) => {
|
||||
}).catch((err) => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e.message,
|
||||
text: err.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -265,10 +265,10 @@ const invite = () => {
|
||||
type: 'info',
|
||||
text: x.code
|
||||
});
|
||||
}).catch(e => {
|
||||
}).catch(err => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
text: err,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -111,8 +111,8 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
setBannerImage(e) {
|
||||
selectFile(e.currentTarget ?? e.target, null).then(file => {
|
||||
setBannerImage(evt) {
|
||||
selectFile(evt.currentTarget ?? evt.target, null).then(file => {
|
||||
this.bannerId = file.id;
|
||||
});
|
||||
},
|
||||
|
@ -79,9 +79,9 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if (this.selectedTags.size === 0) {
|
||||
this.searchEmojis = this.customEmojis.filter(e => e.name.includes(this.q) || e.aliases.includes(this.q));
|
||||
this.searchEmojis = this.customEmojis.filter(emoji => emoji.name.includes(this.q) || emoji.aliases.includes(this.q));
|
||||
} else {
|
||||
this.searchEmojis = this.customEmojis.filter(e => (e.name.includes(this.q) || e.aliases.includes(this.q)) && [...this.selectedTags].every(t => e.aliases.includes(t)));
|
||||
this.searchEmojis = this.customEmojis.filter(emoji => (emoji.name.includes(this.q) || emoji.aliases.includes(this.q)) && [...this.selectedTags].every(t => emoji.aliases.includes(t)));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -25,10 +25,10 @@ function menu(ev) {
|
||||
type: 'info',
|
||||
text: i18n.ts.exportRequested,
|
||||
});
|
||||
}).catch((e) => {
|
||||
}).catch((err) => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e.message,
|
||||
text: err.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export default defineComponent({
|
||||
uri: acct
|
||||
});
|
||||
promise.then(res => {
|
||||
if (res.type == 'User') {
|
||||
if (res.type === 'User') {
|
||||
this.follow(res.object);
|
||||
} else if (res.type === 'Note') {
|
||||
this.$router.push(`/notes/${res.object.id}`);
|
||||
|
@ -91,8 +91,8 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
selectFile(e) {
|
||||
selectFiles(e.currentTarget ?? e.target, null).then(files => {
|
||||
selectFile(evt) {
|
||||
selectFiles(evt.currentTarget ?? evt.target, null).then(files => {
|
||||
this.files = this.files.concat(files);
|
||||
});
|
||||
},
|
||||
|
@ -119,8 +119,8 @@ export default defineComponent({
|
||||
postId: this.postId
|
||||
}).then(post => {
|
||||
this.post = post;
|
||||
}).catch(e => {
|
||||
this.error = e;
|
||||
}).catch(err => {
|
||||
this.error = err;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -90,14 +90,14 @@ export default defineComponent({
|
||||
getAcct: Acct.toString,
|
||||
|
||||
isMe(message) {
|
||||
return message.userId == this.$i.id;
|
||||
return message.userId === this.$i.id;
|
||||
},
|
||||
|
||||
onMessage(message) {
|
||||
if (message.recipientId) {
|
||||
this.messages = this.messages.filter(m => !(
|
||||
(m.recipientId == message.recipientId && m.userId == message.userId) ||
|
||||
(m.recipientId == message.userId && m.userId == message.recipientId)));
|
||||
(m.recipientId === message.recipientId && m.userId === message.userId) ||
|
||||
(m.recipientId === message.userId && m.userId === message.recipientId)));
|
||||
|
||||
this.messages.unshift(message);
|
||||
} else if (message.groupId) {
|
||||
@ -108,7 +108,7 @@ export default defineComponent({
|
||||
|
||||
onRead(ids) {
|
||||
for (const id of ids) {
|
||||
const found = this.messages.find(m => m.id == id);
|
||||
const found = this.messages.find(m => m.id === id);
|
||||
if (found) {
|
||||
if (found.recipientId) {
|
||||
found.isRead = true;
|
||||
|
@ -59,7 +59,7 @@ export default defineComponent({
|
||||
return this.user ? 'user:' + this.user.id : 'group:' + this.group.id;
|
||||
},
|
||||
canSend(): boolean {
|
||||
return (this.text != null && this.text != '') || this.file != null;
|
||||
return (this.text != null && this.text !== '') || this.file != null;
|
||||
},
|
||||
room(): any {
|
||||
return this.$parent;
|
||||
@ -88,12 +88,11 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onPaste(e: ClipboardEvent) {
|
||||
const data = e.clipboardData;
|
||||
const items = data.items;
|
||||
async onPaste(evt: ClipboardEvent) {
|
||||
const items = evt.clipboardData.items;
|
||||
|
||||
if (items.length == 1) {
|
||||
if (items[0].kind == 'file') {
|
||||
if (items.length === 1) {
|
||||
if (items[0].kind === 'file') {
|
||||
const file = items[0].getAsFile();
|
||||
const lio = file.name.lastIndexOf('.');
|
||||
const ext = lio >= 0 ? file.name.slice(lio) : '';
|
||||
@ -101,7 +100,7 @@ export default defineComponent({
|
||||
if (formatted) this.upload(file, formatted);
|
||||
}
|
||||
} else {
|
||||
if (items[0].kind == 'file') {
|
||||
if (items[0].kind === 'file') {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: this.$ts.onlyOneFileCanBeAttached
|
||||
@ -110,23 +109,23 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
onDragover(e) {
|
||||
const isFile = e.dataTransfer.items[0].kind == 'file';
|
||||
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
|
||||
onDragover(evt) {
|
||||
const isFile = evt.dataTransfer.items[0].kind === 'file';
|
||||
const isDriveFile = evt.dataTransfer.types[0] === _DATA_TRANSFER_DRIVE_FILE_;
|
||||
if (isFile || isDriveFile) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
|
||||
evt.preventDefault();
|
||||
evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === 'all' ? 'copy' : 'move';
|
||||
}
|
||||
},
|
||||
|
||||
onDrop(e): void {
|
||||
onDrop(evt): void {
|
||||
// ファイルだったら
|
||||
if (e.dataTransfer.files.length == 1) {
|
||||
e.preventDefault();
|
||||
this.upload(e.dataTransfer.files[0]);
|
||||
if (evt.dataTransfer.files.length === 1) {
|
||||
evt.preventDefault();
|
||||
this.upload(evt.dataTransfer.files[0]);
|
||||
return;
|
||||
} else if (e.dataTransfer.files.length > 1) {
|
||||
e.preventDefault();
|
||||
} else if (evt.dataTransfer.files.length > 1) {
|
||||
evt.preventDefault();
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: this.$ts.onlyOneFileCanBeAttached
|
||||
@ -135,17 +134,17 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
//#region ドライブのファイル
|
||||
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
||||
if (driveFile != null && driveFile != '') {
|
||||
const driveFile = evt.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
||||
if (driveFile != null && driveFile !== '') {
|
||||
this.file = JSON.parse(driveFile);
|
||||
e.preventDefault();
|
||||
evt.preventDefault();
|
||||
}
|
||||
//#endregion
|
||||
},
|
||||
|
||||
onKeydown(e) {
|
||||
onKeydown(evt) {
|
||||
this.typing();
|
||||
if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey) && this.canSend) {
|
||||
if ((evt.which === 10 || evt.which === 13) && (evt.ctrlKey || evt.metaKey) && this.canSend) {
|
||||
this.send();
|
||||
}
|
||||
},
|
||||
@ -154,8 +153,8 @@ export default defineComponent({
|
||||
this.typing();
|
||||
},
|
||||
|
||||
chooseFile(e) {
|
||||
selectFile(e.currentTarget ?? e.target, this.$ts.selectFile).then(file => {
|
||||
chooseFile(evt) {
|
||||
selectFile(evt.currentTarget ?? evt.target, this.$ts.selectFile).then(file => {
|
||||
this.file = file;
|
||||
});
|
||||
},
|
||||
@ -193,9 +192,9 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
saveDraft() {
|
||||
const data = JSON.parse(localStorage.getItem('message_drafts') || '{}');
|
||||
const drafts = JSON.parse(localStorage.getItem('message_drafts') || '{}');
|
||||
|
||||
data[this.draftKey] = {
|
||||
drafts[this.draftKey] = {
|
||||
updatedAt: new Date(),
|
||||
data: {
|
||||
text: this.text,
|
||||
@ -203,15 +202,15 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
localStorage.setItem('message_drafts', JSON.stringify(data));
|
||||
localStorage.setItem('message_drafts', JSON.stringify(drafts));
|
||||
},
|
||||
|
||||
deleteDraft() {
|
||||
const data = JSON.parse(localStorage.getItem('message_drafts') || '{}');
|
||||
const drafts = JSON.parse(localStorage.getItem('message_drafts') || '{}');
|
||||
|
||||
delete data[this.draftKey];
|
||||
delete drafts[this.draftKey];
|
||||
|
||||
localStorage.setItem('message_drafts', JSON.stringify(data));
|
||||
localStorage.setItem('message_drafts', JSON.stringify(drafts));
|
||||
},
|
||||
|
||||
async insertEmoji(ev) {
|
||||
|
@ -166,23 +166,23 @@ const Component = defineComponent({
|
||||
});
|
||||
},
|
||||
|
||||
onDragover(e) {
|
||||
const isFile = e.dataTransfer.items[0].kind == 'file';
|
||||
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
|
||||
onDragover(evt) {
|
||||
const isFile = evt.dataTransfer.items[0].kind === 'file';
|
||||
const isDriveFile = evt.dataTransfer.types[0] === _DATA_TRANSFER_DRIVE_FILE_;
|
||||
|
||||
if (isFile || isDriveFile) {
|
||||
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
|
||||
evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === 'all' ? 'copy' : 'move';
|
||||
} else {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
evt.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
},
|
||||
|
||||
onDrop(e): void {
|
||||
onDrop(evt): void {
|
||||
// ファイルだったら
|
||||
if (e.dataTransfer.files.length == 1) {
|
||||
this.form.upload(e.dataTransfer.files[0]);
|
||||
if (evt.dataTransfer.files.length === 1) {
|
||||
this.form.upload(evt.dataTransfer.files[0]);
|
||||
return;
|
||||
} else if (e.dataTransfer.files.length > 1) {
|
||||
} else if (evt.dataTransfer.files.length > 1) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: this.$ts.onlyOneFileCanBeAttached
|
||||
@ -191,8 +191,8 @@ const Component = defineComponent({
|
||||
}
|
||||
|
||||
//#region ドライブのファイル
|
||||
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
||||
if (driveFile != null && driveFile != '') {
|
||||
const driveFile = evt.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
||||
if (driveFile != null && driveFile !== '') {
|
||||
const file = JSON.parse(driveFile);
|
||||
this.form.file = file;
|
||||
}
|
||||
@ -209,7 +209,7 @@ const Component = defineComponent({
|
||||
limit: max + 1,
|
||||
untilId: this.existMoreMessages ? this.messages[0].id : undefined
|
||||
}).then(messages => {
|
||||
if (messages.length == max + 1) {
|
||||
if (messages.length === max + 1) {
|
||||
this.existMoreMessages = true;
|
||||
messages.pop();
|
||||
} else {
|
||||
@ -235,7 +235,7 @@ const Component = defineComponent({
|
||||
const _isBottom = isBottom(this.$el, 64);
|
||||
|
||||
this.messages.push(message);
|
||||
if (message.userId != this.$i.id && !document.hidden) {
|
||||
if (message.userId !== this.$i.id && !document.hidden) {
|
||||
this.connection.send('read', {
|
||||
id: message.id
|
||||
});
|
||||
@ -246,7 +246,7 @@ const Component = defineComponent({
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottom();
|
||||
});
|
||||
} else if (message.userId != this.$i.id) {
|
||||
} else if (message.userId !== this.$i.id) {
|
||||
// Notify
|
||||
this.notifyNewMessage();
|
||||
}
|
||||
@ -256,7 +256,7 @@ const Component = defineComponent({
|
||||
if (this.user) {
|
||||
if (!Array.isArray(x)) x = [x];
|
||||
for (const id of x) {
|
||||
if (this.messages.some(x => x.id == id)) {
|
||||
if (this.messages.some(x => x.id === id)) {
|
||||
const exist = this.messages.map(x => x.id).indexOf(id);
|
||||
this.messages[exist] = {
|
||||
...this.messages[exist],
|
||||
@ -266,7 +266,7 @@ const Component = defineComponent({
|
||||
}
|
||||
} else if (this.group) {
|
||||
for (const id of x.ids) {
|
||||
if (this.messages.some(x => x.id == id)) {
|
||||
if (this.messages.some(x => x.id === id)) {
|
||||
const exist = this.messages.map(x => x.id).indexOf(id);
|
||||
this.messages[exist] = {
|
||||
...this.messages[exist],
|
||||
|
@ -136,8 +136,8 @@ export default defineComponent({
|
||||
this.hasPrev = prev.length !== 0;
|
||||
this.hasNext = next.length !== 0;
|
||||
});
|
||||
}).catch(e => {
|
||||
this.error = e;
|
||||
}).catch(err => {
|
||||
this.error = err;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ export default defineComponent({
|
||||
username: this.username,
|
||||
}).then(page => {
|
||||
this.page = page;
|
||||
}).catch(e => {
|
||||
this.error = e;
|
||||
}).catch(err => {
|
||||
this.error = err;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -121,10 +121,10 @@ function submit() {
|
||||
}).then(() => {
|
||||
os.success();
|
||||
$i!.twoFactorEnabled = true;
|
||||
}).catch(e => {
|
||||
}).catch(err => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e
|
||||
text: err,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ async function install() {
|
||||
let ast;
|
||||
try {
|
||||
ast = parse(code.value);
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: 'Syntax error :('
|
||||
@ -60,8 +60,8 @@ async function install() {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = meta.get(null);
|
||||
if (data == null) {
|
||||
const metadata = meta.get(null);
|
||||
if (metadata == null) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: 'No metadata found :('
|
||||
@ -69,7 +69,7 @@ async function install() {
|
||||
return;
|
||||
}
|
||||
|
||||
const { name, version, author, description, permissions, config } = data;
|
||||
const { name, version, author, description, permissions, config } = metadata;
|
||||
if (name == null || version == null || author == null) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
|
@ -29,7 +29,7 @@ function parseThemeCode(code: string) {
|
||||
|
||||
try {
|
||||
theme = JSON5.parse(code);
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts._theme.invalid
|
||||
|
@ -43,6 +43,14 @@ import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: 'Edit webhook',
|
||||
icon: 'fas fa-bolt',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
});
|
||||
|
||||
const webhook = await os.api('i/webhooks/show', {
|
||||
webhookId: new URLSearchParams(window.location.search).get('id')
|
||||
});
|
||||
@ -78,12 +86,4 @@ async function save(): Promise<void> {
|
||||
active,
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: 'Edit webhook',
|
||||
icon: 'fas fa-bolt',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
@ -71,7 +71,7 @@ watch(hardMutedWords, () => {
|
||||
async function save() {
|
||||
const parseMutes = (mutes, tab) => {
|
||||
// split into lines, remove empty lines and unnecessary whitespace
|
||||
let lines = mutes.trim().split('\n').map(line => line.trim()).filter(line => line != '');
|
||||
let lines = mutes.trim().split('\n').map(line => line.trim()).filter(line => line !== '');
|
||||
|
||||
// check each line if it is a RegExp or not
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
|
@ -153,11 +153,11 @@ export default defineComponent({
|
||||
);
|
||||
}
|
||||
//#endregion
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
title: e.message,
|
||||
text: e.name
|
||||
title: err.message,
|
||||
text: err.name
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ function showPreview() {
|
||||
}
|
||||
|
||||
function setBgColor(color: typeof bgColors[number]) {
|
||||
if (theme.base != color.kind) {
|
||||
if (theme.base !== color.kind) {
|
||||
const base = color.kind === 'dark' ? darkTheme : lightTheme;
|
||||
for (const prop of Object.keys(base.props)) {
|
||||
if (prop === 'accent') continue;
|
||||
|
@ -232,10 +232,10 @@ export default defineComponent({
|
||||
await os.api('admin/delete-all-files-of-a-user', { userId: this.user.id });
|
||||
os.success();
|
||||
};
|
||||
await process().catch(e => {
|
||||
await process().catch(err => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
text: err.toString(),
|
||||
});
|
||||
});
|
||||
await this.refreshUser();
|
||||
|
@ -260,8 +260,8 @@ export default defineComponent({
|
||||
this.user = null;
|
||||
os.api('users/show', Acct.parse(this.acct)).then(user => {
|
||||
this.user = user;
|
||||
}).catch(e => {
|
||||
this.error = e;
|
||||
}).catch(err => {
|
||||
this.error = err;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -14,9 +14,9 @@ export async function fetchThemes(): Promise<void> {
|
||||
try {
|
||||
const themes = await api('i/registry/get', { scope: ['client'], key: 'themes' });
|
||||
localStorage.setItem(lsCacheKey, JSON.stringify(themes));
|
||||
} catch (e) {
|
||||
if (e.code === 'NO_SUCH_KEY') return;
|
||||
throw e;
|
||||
} catch (err) {
|
||||
if (err.code === 'NO_SUCH_KEY') return;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ export async function addTheme(theme: Theme): Promise<void> {
|
||||
}
|
||||
|
||||
export async function removeTheme(theme: Theme): Promise<void> {
|
||||
const themes = getThemes().filter(t => t.id != theme.id);
|
||||
const themes = getThemes().filter(t => t.id !== theme.id);
|
||||
await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes });
|
||||
localStorage.setItem(lsCacheKey, JSON.stringify(themes));
|
||||
}
|
||||
|
@ -14,30 +14,29 @@ export function swInject() {
|
||||
console.log('sw msg', ev.data);
|
||||
}
|
||||
|
||||
const data = ev.data; // as SwMessage
|
||||
if (data.type !== 'order') return;
|
||||
if (ev.data.type !== 'order') return;
|
||||
|
||||
if (data.loginId !== $i?.id) {
|
||||
return getAccountFromId(data.loginId).then(account => {
|
||||
if (ev.data.loginId !== $i?.id) {
|
||||
return getAccountFromId(ev.data.loginId).then(account => {
|
||||
if (!account) return;
|
||||
return login(account.token, data.url);
|
||||
return login(account.token, ev.data.url);
|
||||
});
|
||||
}
|
||||
|
||||
switch (data.order) {
|
||||
switch (ev.data.order) {
|
||||
case 'post':
|
||||
return post(data.options);
|
||||
return post(ev.data.options);
|
||||
case 'push':
|
||||
if (router.currentRoute.value.path === data.url) {
|
||||
if (router.currentRoute.value.path === ev.data.url) {
|
||||
return window.scroll({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
if (navHook) {
|
||||
return navHook(data.url);
|
||||
return navHook(ev.data.url);
|
||||
}
|
||||
if (sideViewHook && defaultStore.state.defaultSideView && data.url !== '/') {
|
||||
return sideViewHook(data.url);
|
||||
if (sideViewHook && defaultStore.state.defaultSideView && ev.data.url !== '/') {
|
||||
return sideViewHook(ev.data.url);
|
||||
}
|
||||
return router.push(data.url);
|
||||
return router.push(ev.data.url);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
removeWidget(widget) {
|
||||
this.$store.set('widgets', this.$store.state.widgets.filter(w => w.id != widget.id));
|
||||
this.$store.set('widgets', this.$store.state.widgets.filter(w => w.id !== widget.id));
|
||||
},
|
||||
|
||||
updateWidget({ id, data }) {
|
||||
this.$store.set('widgets', this.$store.state.widgets.map(w => w.id === id ? {
|
||||
...w,
|
||||
data: data
|
||||
data,
|
||||
} : w));
|
||||
},
|
||||
|
||||
|
@ -276,14 +276,14 @@ export function setColumnWidgets(id: Column['id'], widgets: ColumnWidget[]) {
|
||||
saveDeck();
|
||||
}
|
||||
|
||||
export function updateColumnWidget(id: Column['id'], widgetId: string, data: any) {
|
||||
export function updateColumnWidget(id: Column['id'], widgetId: string, WidgetData: any) {
|
||||
const columns = copy(deckStore.state.columns);
|
||||
const columnIndex = deckStore.state.columns.findIndex(c => c.id === id);
|
||||
const column = copy(deckStore.state.columns[columnIndex]);
|
||||
if (column == null) return;
|
||||
column.widgets = column.widgets.map(w => w.id === widgetId ? {
|
||||
...w,
|
||||
data: data
|
||||
data: widgetData,
|
||||
} : w);
|
||||
columns[columnIndex] = column;
|
||||
deckStore.set('columns', columns);
|
||||
|
@ -14,7 +14,7 @@ import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'mounted', el: Element): void;
|
||||
(ev: 'mounted', el: Element): void;
|
||||
}>();
|
||||
|
||||
let editMode = $ref(false);
|
||||
@ -32,13 +32,13 @@ function addWidget(widget) {
|
||||
}
|
||||
|
||||
function removeWidget(widget) {
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.filter(w => w.id != widget.id));
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.filter(w => w.id !== widget.id));
|
||||
}
|
||||
|
||||
function updateWidget({ id, data }) {
|
||||
defaultStore.set('widgets', defaultStore.state.widgets.map(w => w.id === id ? {
|
||||
...w,
|
||||
data: data
|
||||
data,
|
||||
} : w));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user