mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Lint code
This commit is contained in:
@@ -437,7 +437,7 @@ export class AdminAccountDetails implements OnInit, OnDestroy {
|
||||
}
|
||||
highlighCharacter = (char: Character | undefined): boolean => {
|
||||
return !!char && includes(this.ponyNames, char.name.toLowerCase());
|
||||
}
|
||||
};
|
||||
clearSessions() {
|
||||
if (this.account) {
|
||||
this.clearingSessions = true;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { transliterate } from 'transliteration';
|
||||
})
|
||||
export class TranslitPipe implements PipeTransform {
|
||||
transform(value: string) {
|
||||
if (!value || /^[a-z0-9-_.,\[\]!@#$%^&*{}|\/\\ ]+$/i.test(value))
|
||||
if (!value || /^[a-z0-9-_.,[]!@#$%^&*{}|\/\\ ]+$/i.test(value))
|
||||
return undefined;
|
||||
|
||||
const translit = transliterate(value);
|
||||
|
||||
@@ -8,7 +8,7 @@ function icon(value: string | undefined, defaultValue: any): any {
|
||||
|
||||
const extensions = {
|
||||
browser: [
|
||||
[/(Amigo|YaBrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
|
||||
[/(Amigo|YaBrowser)\/([\w.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ export class Help {
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.route.fragment.subscribe(f => {
|
||||
const element = document.querySelector("#" + f);
|
||||
const element = document.querySelector('#' + f);
|
||||
if (element) setTimeout(() => element.scrollIntoView(), 10);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class AdminModel {
|
||||
console.error(error);
|
||||
this.error = error.message;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
private checkError = <T>(promise: Promise<T>) => promise.catch(this.handleError) as Promise<T | undefined>;
|
||||
private running = true;
|
||||
private initializedLive = false;
|
||||
|
||||
@@ -43,9 +43,9 @@ function getTracks(season: Season, holiday: Holiday, map: MapType) {
|
||||
'trees-winter',
|
||||
'reindeer-winter',
|
||||
] : [
|
||||
'trees',
|
||||
'reindeer',
|
||||
]),
|
||||
'trees',
|
||||
'reindeer',
|
||||
]),
|
||||
'season',
|
||||
'ambient',
|
||||
'building',
|
||||
|
||||
@@ -467,7 +467,7 @@ export class Model {
|
||||
|
||||
this.pending = true;
|
||||
|
||||
const alert = !!this.accountAlert ? 'y' : '';
|
||||
const alert = this.accountAlert ? 'y' : '';
|
||||
|
||||
return this.post<JoinResponse>('/api/game/join', { version, ponyId, serverId, alert, url: location.href })
|
||||
.finally(() => this.pending = false);
|
||||
|
||||
@@ -57,4 +57,4 @@ export class RollbarErrorHandler implements ErrorHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ export class CharacterPreview implements OnDestroy, OnChanges, AfterViewInit {
|
||||
this.lastFrame = now;
|
||||
this.tryDraw();
|
||||
}
|
||||
}
|
||||
};
|
||||
private tryDraw() {
|
||||
try {
|
||||
this.draw();
|
||||
|
||||
@@ -248,10 +248,10 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
||||
private say(message: string, chatType: ChatType, entityId: number): boolean {
|
||||
this.game.lastChatMessageType = chatType;
|
||||
if (message.toLowerCase().startsWith('/shrug')) {
|
||||
var rawMessage = message.substring(6);
|
||||
let rawMessage = message.substring(6);
|
||||
return !!this.game.send(server =>
|
||||
server.say(entityId, ((rawMessage !== '') ? rawMessage + ' ' : '') + `¯\\_(ツ)_/¯`,
|
||||
chatType));
|
||||
chatType));
|
||||
} else {
|
||||
return !!this.game.send(server => server.say(entityId, message, chatType));
|
||||
}
|
||||
|
||||
@@ -694,17 +694,17 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
scrollHandler = () => {
|
||||
this.scrollingToEnd = true;
|
||||
this.scroll.nativeElement.scrollTop = 99999;
|
||||
}
|
||||
};
|
||||
clickNameHandler = (message: ChatLogMessage) => {
|
||||
this.zone.run(() => this.nameClick.emit(message));
|
||||
}
|
||||
};
|
||||
clickLabel = (message: ChatLogMessage) => {
|
||||
this.zone.run(() => {
|
||||
if (message.label) {
|
||||
this.toggleType.emit(message.label);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
private clearList() {
|
||||
removeAllNodes(this.linesElement);
|
||||
}
|
||||
@@ -772,12 +772,12 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
return findEntityFromMessages(id, this.whisper) ||
|
||||
findEntityFromMessages(id, this.party) ||
|
||||
findEntityFromMessages(id, this.local);
|
||||
}
|
||||
};
|
||||
private findEntityFromMessagesByName = (name: string): FakeEntity | undefined => {
|
||||
return findEntityFromMessagesByName(name, this.game.playerId, this.whisper) ||
|
||||
findEntityFromMessagesByName(name, this.game.playerId, this.party) ||
|
||||
findEntityFromMessagesByName(name, this.game.playerId, this.local);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function findEntityFromMessages(id: number, messages: ChatLogMessage[]): FakeEntity | undefined {
|
||||
|
||||
@@ -199,7 +199,7 @@ export class Dropdown {
|
||||
} else if (this.autoClose && e.keyCode === 27) { // esc
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
private canvasCloseHandler: any = () => this.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,5 +54,5 @@ export class FocusTrap implements OnInit, OnDestroy {
|
||||
this.lastActiveElement.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -166,4 +166,4 @@ const declarations = [
|
||||
exports: [declarations]
|
||||
})
|
||||
export class SharedModule {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class SignInBox implements OnInit {
|
||||
.then(data => {
|
||||
this.mocks = data;
|
||||
})
|
||||
.catch(noop)
|
||||
.catch(noop);
|
||||
}
|
||||
async createNew() {
|
||||
const name = prompt('Account name');
|
||||
|
||||
@@ -32,7 +32,7 @@ export class ToolsFrame {
|
||||
if (this.popoverIsOpen) {
|
||||
this.togglePopover();
|
||||
}
|
||||
}
|
||||
};
|
||||
togglePopover() {
|
||||
const rect = (this.element.nativeElement as HTMLElement).getBoundingClientRect();
|
||||
this.placement = (rect.left < (window.innerWidth / 2)) ? 'right' : 'left';
|
||||
|
||||
@@ -472,8 +472,8 @@ export class ToolsAnimation implements OnInit, OnDestroy {
|
||||
}
|
||||
} else {
|
||||
const frames = this.headAnimation.frames
|
||||
.map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']'])
|
||||
.map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame);
|
||||
.map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']'])
|
||||
.map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame);
|
||||
console.log(`frames: [\n${frames.map(x => `\t${x}`).join(',\n')}\n]`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,5 +170,5 @@ export class ToolsRegions implements OnInit, OnDestroy {
|
||||
this.player.y += dy * delta * PONY_SPEED_TROT;
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user