mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-05 06:33:09 +02:00
make eslint happy
also add some types to `chiptune2.ts`
This commit is contained in:
parent
e0afeff248
commit
fa60c1d4bf
3 changed files with 16 additions and 12 deletions
|
@ -7,11 +7,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div class="_gaps_m">
|
||||
<MkSelect v-model="type">
|
||||
<option value="all">{{ i18n.ts.all }}</option>
|
||||
<option value="following" v-if="hasSender">{{ i18n.ts.following }}</option>
|
||||
<option value="follower" v-if="hasSender">{{ i18n.ts.followers }}</option>
|
||||
<option value="mutualFollow" v-if="hasSender">{{ i18n.ts.mutualFollow }}</option>
|
||||
<option value="followingOrFollower" v-if="hasSender">{{ i18n.ts.followingOrFollower }}</option>
|
||||
<option value="list" v-if="hasSender">{{ i18n.ts.userList }}</option>
|
||||
<option v-if="hasSender" value="following">{{ i18n.ts.following }}</option>
|
||||
<option v-if="hasSender" value="follower">{{ i18n.ts.followers }}</option>
|
||||
<option v-if="hasSender" value="mutualFollow">{{ i18n.ts.mutualFollow }}</option>
|
||||
<option v-if="hasSender" value="followingOrFollower">{{ i18n.ts.followingOrFollower }}</option>
|
||||
<option v-if="hasSender" value="list">{{ i18n.ts.userList }}</option>
|
||||
<option value="never">{{ i18n.ts.none }}</option>
|
||||
</MkSelect>
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
|
||||
const ChiptuneAudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
|
@ -6,6 +5,11 @@ const ChiptuneAudioContext = window.AudioContext || window.webkitAudioContext;
|
|||
let libopenmpt
|
||||
let libopenmptLoadPromise
|
||||
|
||||
type ChiptuneJsConfig = {
|
||||
repeatCount: number | null;
|
||||
context: AudioContext | null;
|
||||
};
|
||||
|
||||
export function ChiptuneJsConfig (repeatCount?: number, context?: AudioContext) {
|
||||
this.repeatCount = repeatCount;
|
||||
this.context = context;
|
||||
|
@ -13,7 +17,7 @@ export function ChiptuneJsConfig (repeatCount?: number, context?: AudioContext)
|
|||
|
||||
ChiptuneJsConfig.prototype.constructor = ChiptuneJsConfig;
|
||||
|
||||
export function ChiptuneJsPlayer (config: object) {
|
||||
export function ChiptuneJsPlayer (config: ChiptuneJsConfig) {
|
||||
this.config = config;
|
||||
this.audioContext = config.context || new ChiptuneAudioContext();
|
||||
this.context = this.audioContext.createGain();
|
||||
|
@ -27,7 +31,7 @@ ChiptuneJsPlayer.prototype.initialize = function() {
|
|||
if (libopenmptLoadPromise) return libopenmptLoadPromise;
|
||||
if (libopenmpt) return Promise.resolve();
|
||||
|
||||
libopenmptLoadPromise = new Promise(async (resolve, reject) => {
|
||||
libopenmptLoadPromise = new Promise<void>(async (resolve, reject) => {
|
||||
try {
|
||||
const { Module } = await import('./libopenmpt/libopenmpt.js');
|
||||
await new Promise((resolve) => {
|
||||
|
|
|
@ -9,9 +9,9 @@ const koRegex3 = /(야(?=\?))|(야$)|(야(?= ))/gm;
|
|||
|
||||
function ifAfter(prefix, fn) {
|
||||
const preLen = prefix.length;
|
||||
const regex = new RegExp(prefix,'i');
|
||||
return (x,pos,string) => {
|
||||
return pos > 0 && string.substring(pos-preLen,pos).match(regex) ? fn(x) : x;
|
||||
const regex = new RegExp(prefix, 'i');
|
||||
return (x, pos, string) => {
|
||||
return pos > 0 && string.substring(pos - preLen, pos).match(regex) ? fn(x) : x;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ export function nyaize(text: string): string {
|
|||
.replace(/one/gi, ifAfter('every', x => x === 'ONE' ? 'NYAN' : 'nyan'))
|
||||
// ko-KR
|
||||
.replace(koRegex1, match => String.fromCharCode(
|
||||
match.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
|
||||
match.charCodeAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
|
||||
))
|
||||
.replace(koRegex2, '다냥')
|
||||
.replace(koRegex3, '냥');
|
||||
|
|
Loading…
Reference in a new issue