mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Improved code
This commit is contained in:
@@ -157,6 +157,12 @@ export interface HSVA {
|
|||||||
a: number;
|
a: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface HSL {
|
||||||
|
h: number;
|
||||||
|
s: number;
|
||||||
|
l: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface RGB {
|
export interface RGB {
|
||||||
r: number;
|
r: number;
|
||||||
g: number;
|
g: number;
|
||||||
@@ -493,3 +499,37 @@ export function h2rgb(h: number): RGB {
|
|||||||
b: Math.round(b * 255)
|
b: Math.round(b * 255)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function rgb2hsl(rgb: RGB): HSL {
|
||||||
|
const r = rgb.r / 255;
|
||||||
|
const g = rgb.g / 255;
|
||||||
|
const b = rgb.b / 255;
|
||||||
|
let max = Math.max(r, g, b);
|
||||||
|
let min = Math.min(r, g, b);
|
||||||
|
let delta = max - min;
|
||||||
|
let h = 0;
|
||||||
|
let s;
|
||||||
|
let l;
|
||||||
|
|
||||||
|
if (max === min) h = 0;
|
||||||
|
else if (r === max) h = (g - b) / delta;
|
||||||
|
else if (g === max) h = 2 + (b - r) / delta;
|
||||||
|
else if (b === max) h = 4 + (r - g) / delta;
|
||||||
|
|
||||||
|
h = Math.min(h * 60, 360);
|
||||||
|
if (h < 0) h += 360;
|
||||||
|
l = (min + max) / 2;
|
||||||
|
|
||||||
|
if (max === min) s = 0;
|
||||||
|
else if (l <= 0.5) s = delta / (max + min);
|
||||||
|
else s = delta / (2 - max - min);
|
||||||
|
h = Math.floor(h);
|
||||||
|
s = Math.floor(s * 100);
|
||||||
|
l = Math.floor(l * 100);
|
||||||
|
|
||||||
|
return { h, s, l };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hsl2CSS(hsl: HSL) {
|
||||||
|
return `hsl(${hsl.h},${hsl.s}%,${hsl.l}%)`;
|
||||||
|
}
|
||||||
|
|||||||
@@ -683,6 +683,7 @@ export interface BrowserSettings {
|
|||||||
scale?: number;
|
scale?: number;
|
||||||
walkByDefault?: boolean;
|
walkByDefault?: boolean;
|
||||||
brightNight?: boolean;
|
brightNight?: boolean;
|
||||||
|
timestamp?: '24' | '12';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EntityTypeName {
|
export interface EntityTypeName {
|
||||||
|
|||||||
@@ -5,6 +5,14 @@
|
|||||||
aria-label="Chat message")
|
aria-label="Chat message")
|
||||||
.chat-box-type(#typeBox (click)="toggleChatType()")
|
.chat-box-type(#typeBox (click)="toggleChatType()")
|
||||||
| #[span(#typePrefix)][#[span.chat-box-type-name(#typeName)]]:
|
| #[span(#typePrefix)][#[span.chat-box-type-name(#typeName)]]:
|
||||||
|
.emotes.emoji-box([style.display]="emojiBoxState")
|
||||||
|
ul
|
||||||
|
li(*ngFor="let e of emotes" (click)="addEmoji(e.symbol)"
|
||||||
|
)
|
||||||
|
span.emote-sample.mr-2
|
||||||
|
emote-box([emote]="e.names[0]")
|
||||||
|
|
||||||
|
emote-box.game-button.chat-emoji-button([emote]="btnEmoji" (click)="toggleEmojiBox()" (mouseenter)="onMouseEnter($event)")
|
||||||
button.game-button.chat-send-button((click)="send($event)" title="Send message" aria-label="Send message")
|
button.game-button.chat-send-button((click)="send($event)" title="Send message" aria-label="Send message")
|
||||||
fa-icon([icon]="sendIcon")
|
fa-icon([icon]="sendIcon")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
@import '../../../../styles/partials/variables';
|
@import '../../../../styles/partials/variables';
|
||||||
|
|
||||||
.chat-box {
|
.chat-box {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
height: 37px;
|
height: 37px;
|
||||||
@@ -48,32 +47,27 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
.chat-party>&,
|
||||||
.chat-party > &, .chat-party-think > & {
|
.chat-party-think>& {
|
||||||
color: $chat-party;
|
color: $chat-party;
|
||||||
}
|
}
|
||||||
|
.chat-say>&,
|
||||||
.chat-say > &, .chat-think > & {
|
.chat-think>& {
|
||||||
color: $chat-color;
|
color: $chat-color;
|
||||||
}
|
}
|
||||||
|
.chat-sup>& {
|
||||||
.chat-sup > & {
|
|
||||||
color: $supporter-1;
|
color: $supporter-1;
|
||||||
}
|
}
|
||||||
|
.chat-sup1>& {
|
||||||
.chat-sup1 > & {
|
|
||||||
color: $supporter-1;
|
color: $supporter-1;
|
||||||
}
|
}
|
||||||
|
.chat-sup2>& {
|
||||||
.chat-sup2 > & {
|
|
||||||
color: $supporter-2;
|
color: $supporter-2;
|
||||||
}
|
}
|
||||||
|
.chat-sup3>& {
|
||||||
.chat-sup3 > & {
|
|
||||||
color: $supporter-3;
|
color: $supporter-3;
|
||||||
}
|
}
|
||||||
|
.chat-whisper>& {
|
||||||
.chat-whisper > & {
|
|
||||||
color: $chat-whisper;
|
color: $chat-whisper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,3 +80,69 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-emoji-button {
|
||||||
|
user-select: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 30px;
|
||||||
|
bottom: 3px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
-webkit-filter: grayscale(100%);
|
||||||
|
filter: grayscale(100%);
|
||||||
|
&:hover {
|
||||||
|
bottom: 4px;
|
||||||
|
-webkit-filter: grayscale(0);
|
||||||
|
filter: grayscale(0%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.emoji-box {
|
||||||
|
display: flex;
|
||||||
|
padding: 10px;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #000000;
|
||||||
|
opacity: 0.95;
|
||||||
|
bottom: 40px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 190px;
|
||||||
|
overflow-y: auto;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 7px;
|
||||||
|
}
|
||||||
|
/* Add a thumb */
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: rgb(77, 77, 77);
|
||||||
|
border-radius: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.emoji-box ul {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emoji-box li {
|
||||||
|
display: inline;
|
||||||
|
list-style: none;
|
||||||
|
column-width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emote-sample {
|
||||||
|
user-select: none;
|
||||||
|
display: inline-block;
|
||||||
|
width: 29px;
|
||||||
|
height: 29px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0, 255, 255, 0.2);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.emote-sample emote-box {
|
||||||
|
line-height: 2;
|
||||||
|
}
|
||||||
@@ -9,10 +9,11 @@ import { faComment, faAngleDoubleRight } from '../../../client/icons';
|
|||||||
import { isInParty } from '../../../client/partyUtils';
|
import { isInParty } from '../../../client/partyUtils';
|
||||||
import { handleActionCommand } from '../../../client/playerActions';
|
import { handleActionCommand } from '../../../client/playerActions';
|
||||||
import { hasHeadAnimation } from '../../../common/pony';
|
import { hasHeadAnimation } from '../../../common/pony';
|
||||||
import { AutocompleteState, autocompleteMesssage, replaceEmojis } from '../../../client/emoji';
|
import { AutocompleteState, autocompleteMesssage, replaceEmojis, emojis } from '../../../client/emoji';
|
||||||
import { replaceNodes } from '../../../client/htmlUtils';
|
import { replaceNodes } from '../../../client/htmlUtils';
|
||||||
import { invalidEnumReturn } from '../../../common/utils';
|
import { invalidEnumReturn } from '../../../common/utils';
|
||||||
import { findMatchingEntityNames, findEntityOrMockByAnyMeans, findBestEntityByName } from '../../../client/handlers';
|
import { findMatchingEntityNames, findEntityOrMockByAnyMeans, findBestEntityByName } from '../../../client/handlers';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
const chatTypeNames: string[] = [];
|
const chatTypeNames: string[] = [];
|
||||||
const chatTypeClasses: string[] = [];
|
const chatTypeClasses: string[] = [];
|
||||||
@@ -33,7 +34,7 @@ setupChatType(ChatType.Think, 'think');
|
|||||||
setupChatType(ChatType.PartyThink, 'party think');
|
setupChatType(ChatType.PartyThink, 'party think');
|
||||||
|
|
||||||
function isActionCommand(message: string) {
|
function isActionCommand(message: string) {
|
||||||
return /^\/(yawn|sneeze|achoo|laugh|lol|haha|хаха|jaja)/i.test(message);
|
return /^\/(yawn|sneeze|excite|tada|wink|achoo|laugh|lol|haha|хаха|jaja|hug)/i.test(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -45,6 +46,8 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
readonly maxSayLength = SAY_MAX_LENGTH;
|
readonly maxSayLength = SAY_MAX_LENGTH;
|
||||||
readonly commentIcon = faComment;
|
readonly commentIcon = faComment;
|
||||||
readonly sendIcon = faAngleDoubleRight;
|
readonly sendIcon = faAngleDoubleRight;
|
||||||
|
readonly emotes = emojis;
|
||||||
|
emojiBoxState = 'none';
|
||||||
@ViewChild('inputElement', { static: true }) inputElement!: ElementRef;
|
@ViewChild('inputElement', { static: true }) inputElement!: ElementRef;
|
||||||
@ViewChild('typeBox', { static: true }) typeBox!: ElementRef;
|
@ViewChild('typeBox', { static: true }) typeBox!: ElementRef;
|
||||||
@ViewChild('typePrefix', { static: true }) typePrefix!: ElementRef;
|
@ViewChild('typePrefix', { static: true }) typePrefix!: ElementRef;
|
||||||
@@ -54,12 +57,14 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
isOpen = false;
|
isOpen = false;
|
||||||
message: string | undefined = '';
|
message: string | undefined = '';
|
||||||
chatType = ChatType.Say;
|
chatType = ChatType.Say;
|
||||||
|
btnEmoji = emojis[0].names[0];
|
||||||
private pasted = false;
|
private pasted = false;
|
||||||
private lastMessages: string[] = [];
|
private lastMessages: string[] = [];
|
||||||
private state: AutocompleteState = {};
|
private state: AutocompleteState = {};
|
||||||
private subscriptions: Subscription[];
|
private subscriptions: Subscription[];
|
||||||
private _disabled = false;
|
private _disabled = false;
|
||||||
constructor(private game: PonyTownGame, zone: NgZone) {
|
constructor(private game: PonyTownGame, zone: NgZone) {
|
||||||
|
|
||||||
this.subscriptions = [
|
this.subscriptions = [
|
||||||
this.game.onChat.subscribe(() => zone.run(() => this.chat(undefined))),
|
this.game.onChat.subscribe(() => zone.run(() => this.chat(undefined))),
|
||||||
this.game.onToggleChat.subscribe(() => zone.run(() => this.toggle())),
|
this.game.onToggleChat.subscribe(() => zone.run(() => this.toggle())),
|
||||||
@@ -92,6 +97,18 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.subscriptions.forEach(s => s.unsubscribe());
|
this.subscriptions.forEach(s => s.unsubscribe());
|
||||||
}
|
}
|
||||||
|
addEmoji(emoji: string) {
|
||||||
|
this.toggleEmojiBox();
|
||||||
|
if (!this.message) this.message = emoji;
|
||||||
|
else if (this.input.maxLength > this.message.length) {
|
||||||
|
this.message += emoji;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toggleEmojiBox() {
|
||||||
|
if (this.emojiBoxState === 'none')
|
||||||
|
this.emojiBoxState = 'inline-block';
|
||||||
|
else this.emojiBoxState = 'none';
|
||||||
|
}
|
||||||
send(_event: Event | undefined) {
|
send(_event: Event | undefined) {
|
||||||
let chatType = this.chatType;
|
let chatType = this.chatType;
|
||||||
let message = replaceEmojis(cleanMessage(this.message || '')).substr(0, SAY_MAX_LENGTH);
|
let message = replaceEmojis(cleanMessage(this.message || '')).substr(0, SAY_MAX_LENGTH);
|
||||||
@@ -136,7 +153,6 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
this.lastMessages.shift();
|
this.lastMessages.shift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,6 +275,7 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
private close() {
|
private close() {
|
||||||
if (this.isOpen) {
|
if (this.isOpen) {
|
||||||
|
this.emojiBoxState = 'none';
|
||||||
this.input.blur();
|
this.input.blur();
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.chatBox.nativeElement.hidden = true;
|
this.chatBox.nativeElement.hidden = true;
|
||||||
@@ -273,6 +290,11 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
|||||||
this.open();
|
this.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onMouseEnter(event: MouseEvent) {
|
||||||
|
if (!event.target) return;
|
||||||
|
const emoji = _.sample(emojis) || emojis[0];
|
||||||
|
this.btnEmoji = emoji.names[0];
|
||||||
|
}
|
||||||
toggleChatType() {
|
toggleChatType() {
|
||||||
const chatTypes = getChatTypes(this.game);
|
const chatTypes = getChatTypes(this.game);
|
||||||
this.chatType = chatTypes[(chatTypes.indexOf(this.chatType) + 1) % chatTypes.length];
|
this.chatType = chatTypes[(chatTypes.indexOf(this.chatType) + 1) % chatTypes.length];
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
| Party
|
| Party
|
||||||
a.link-plain.chat-log-tab(#whisperTab tabindex (click)="switchTab('whisper')")
|
a.link-plain.chat-log-tab(#whisperTab tabindex (click)="switchTab('whisper')")
|
||||||
| Whisper
|
| Whisper
|
||||||
|
input.link-plain.chat-log-tab.chat-log-filter(#filterTab type="text" [style.background-color]="filterColor" (keyup.enter)="(unFocus())" (keyup.esc)="(unFocus())" [placeholder]="'Filter'" (keyup)="filterChat()")
|
||||||
.chat-log-scroll-outer()
|
.chat-log-scroll-outer()
|
||||||
.chat-log-scroll-inner(#scroll)
|
.chat-log-scroll-inner(#scroll)
|
||||||
.chat-log-scroll-inner-inner(#lines)
|
.chat-log-scroll-inner-inner(#lines)
|
||||||
@@ -25,3 +26,4 @@ button.game-button.chat-log-toggle(#toggleButton (click)="toggle()" title="Toggl
|
|||||||
path.main-bubble(fill="currentColor" d="M416 192c0-88.4-93.1-160-208-160S0 103.6 0 192c0 34.3 14.1 65.9 38 92-13.4 30.2-35.5 54.2-35.8 54.5-2.2 2.3-2.8 5.7-1.5 8.7S4.8 352 8 352c36.6 0 66.9-12.3 88.7-25 32.2 15.7 70.3 25 111.3 25 114.9 0 208-71.6 208-160z")
|
path.main-bubble(fill="currentColor" d="M416 192c0-88.4-93.1-160-208-160S0 103.6 0 192c0 34.3 14.1 65.9 38 92-13.4 30.2-35.5 54.2-35.8 54.5-2.2 2.3-2.8 5.7-1.5 8.7S4.8 352 8 352c36.6 0 66.9-12.3 88.7-25 32.2 15.7 70.3 25 111.3 25 114.9 0 208-71.6 208-160z")
|
||||||
path(fill="currentColor" d="M538 412c23.9-26 38-57.7 38-92 0-66.9-53.5-124.2-129.3-148.1.9 6.6 1.3 13.3 1.3 20.1 0 105.9-107.7 192-240 192-10.8 0-21.3-.8-31.7-1.9C207.8 439.6 281.8 480 368 480c41 0 79.1-9.2 111.3-25 21.8 12.7 52.1 25 88.7 25 3.2 0 6.1-1.9 7.3-4.8 1.3-2.9.7-6.3-1.5-8.7-.3-.3-22.4-24.2-35.8-54.5z")
|
path(fill="currentColor" d="M538 412c23.9-26 38-57.7 38-92 0-66.9-53.5-124.2-129.3-148.1.9 6.6 1.3 13.3 1.3 20.1 0 105.9-107.7 192-240 192-10.8 0-21.3-.8-31.7-1.9C207.8 439.6 281.8 480 368 480c41 0 79.1-9.2 111.3-25 21.8 12.7 52.1 25 88.7 25 3.2 0 6.1-1.9 7.3-4.8 1.3-2.9.7-6.3-1.5-8.7-.3-.3-22.4-24.2-35.8-54.5z")
|
||||||
.whispers-count(#count)
|
.whispers-count(#count)
|
||||||
|
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
@import '../../../../styles/partials/variables';
|
@import '../../../../styles/partials/variables';
|
||||||
|
|
||||||
$chat-log-bg: rgba(0, 0, 0, 0.2);
|
$chat-log-bg: rgba(0, 0, 0, 0.2);
|
||||||
$chat-log-bg-faded: rgba(0, 0, 0, 0.1);
|
$chat-log-bg-faded: rgba(0, 0, 0, 0.1);
|
||||||
$chat-log-bg-hover: rgba(0, 0, 0, 0.5);
|
$chat-log-bg-hover: rgba(0, 0, 0, 0.5);
|
||||||
$chat-log-tabs-height: 30px;
|
$chat-log-tabs-height: 30px;
|
||||||
$chat-log-buttons-width: 40px;
|
$chat-log-buttons-width: 40px;
|
||||||
|
|
||||||
$resizer-size: 12px;
|
$resizer-size: 12px;
|
||||||
$resizer-offset: $resizer-size / 2;
|
$resizer-offset: $resizer-size / 2;
|
||||||
|
|
||||||
.chat-log {
|
.chat-log {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -84,6 +81,7 @@ $resizer-offset: $resizer-size / 2;
|
|||||||
left: 30px;
|
left: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
text-shadow: 0px 0px 4px #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-log-tab {
|
.chat-log-tab {
|
||||||
@@ -95,7 +93,6 @@ $resizer-offset: $resizer-size / 2;
|
|||||||
border-top-right-radius: $border-radius-base;
|
border-top-right-radius: $border-radius-base;
|
||||||
color: white;
|
color: white;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: $chat-log-bg;
|
background: $chat-log-bg;
|
||||||
}
|
}
|
||||||
@@ -157,3 +154,45 @@ $resizer-offset: $resizer-size / 2;
|
|||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
color: rgba(255, 255, 255, 0.2);
|
color: rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-log-filter {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
border: none;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-log-filter::-webkit-input-placeholder {
|
||||||
|
opacity: 1;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 0px 0px 4px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-log-filter:-moz-placeholder {
|
||||||
|
/* Firefox 18- */
|
||||||
|
opacity: 1;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 0px 0px 4px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-log-filter::-moz-placeholder {
|
||||||
|
/* Firefox 19+ */
|
||||||
|
opacity: 1;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 0px 0px 4px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-log-filter:-ms-input-placeholder {
|
||||||
|
opacity: 1;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 0px 0px 4px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 360px) {
|
||||||
|
.chat-log-filter {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 35px;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@ import { DEFAULT_CHATLOG_OPACITY, PONY_TYPE, SECOND } from '../../../common/cons
|
|||||||
import { faCaretUp, faArrowDown } from '../../../client/icons';
|
import { faCaretUp, faArrowDown } from '../../../client/icons';
|
||||||
import { sampleMessages } from '../../../common/debugData';
|
import { sampleMessages } from '../../../common/debugData';
|
||||||
import { findEntityById } from '../../../common/worldMap';
|
import { findEntityById } from '../../../common/worldMap';
|
||||||
|
import { colorToRGBA, rgb2hsl, HSL, hsl2CSS } from '../../../common/color';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
interface IndexEntryUser {
|
interface IndexEntryUser {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -103,11 +105,9 @@ export function createChatLogLineDOM(clickLabel: ClickHandler, clickName: ClickH
|
|||||||
line.root = element('div', 'chat-line', [
|
line.root = element('div', 'chat-line', [
|
||||||
element('span', 'chat-line-lead'),
|
element('span', 'chat-line-lead'),
|
||||||
line.time = element('span', 'chat-line-name', [
|
line.time = element('span', 'chat-line-name', [
|
||||||
textNode(`[`),
|
|
||||||
line.timeContent = element(
|
line.timeContent = element(
|
||||||
'span', 'chat-line-time-content', [textNode('')], undefined),
|
'span', 'chat-line-time-content', [textNode('')], undefined),
|
||||||
line.index = element('span', 'chat-line-time-index', [line.indexText = textNode('')]),
|
line.index = element('span', 'chat-line-time-index', [line.indexText = textNode('')]),
|
||||||
textNode('] '),
|
|
||||||
]),
|
]),
|
||||||
line.label = element(
|
line.label = element(
|
||||||
'span', 'chat-line-label mr-1', [line.labelText = textNode('')], undefined, { click: () => clickLabel(line.entry) }),
|
'span', 'chat-line-label mr-1', [line.labelText = textNode('')], undefined, { click: () => clickLabel(line.entry) }),
|
||||||
@@ -127,7 +127,7 @@ export function createChatLogLineDOM(clickLabel: ClickHandler, clickName: ClickH
|
|||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateChatLogLine(line: ChatLogLineDOM, entry: ChatLogMessage) {
|
export function updateChatLogLine(line: ChatLogLineDOM, entry: ChatLogMessage, hourMode?: '12' | '24') {
|
||||||
const { classes, label, message, prefix, suffix } = entry;
|
const { classes, label, message, prefix, suffix } = entry;
|
||||||
const hasSpace = message.indexOf(' ') !== -1;
|
const hasSpace = message.indexOf(' ') !== -1;
|
||||||
|
|
||||||
@@ -137,27 +137,23 @@ export function updateChatLogLine(line: ChatLogLineDOM, entry: ChatLogMessage) {
|
|||||||
line.labelText.nodeValue = label ? `[${label}]` : '';
|
line.labelText.nodeValue = label ? `[${label}]` : '';
|
||||||
|
|
||||||
updateChatLogName(line, entry);
|
updateChatLogName(line, entry);
|
||||||
updateTime(line);
|
updateTime(line, hourMode);
|
||||||
|
|
||||||
line.prefixText.nodeValue = prefix || '';
|
line.prefixText.nodeValue = prefix || '';
|
||||||
line.suffixText.nodeValue = suffix ? ` ${suffix}: ` : ': ';
|
line.suffixText.nodeValue = suffix ? ` ${suffix}: ` : ': ';
|
||||||
replaceNodes(line.message, message);
|
replaceNodes(line.message, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTime(line: ChatLogLineDOM) {
|
function updateTime(line: ChatLogLineDOM, hourMode?: '12' | '24') {
|
||||||
line.time.style.display = 'inline';
|
line.time.style.display = 'inline';
|
||||||
replaceNodes(line.timeContent, getCurrentTime());
|
if (!hourMode) return;
|
||||||
|
if (hourMode === '24')
|
||||||
|
replaceNodes(line.timeContent, `[${moment().format('HH:mm:ss')}] `);
|
||||||
|
if (hourMode === '12')
|
||||||
|
replaceNodes(line.timeContent, `[${moment().format('LTS')}] `);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentTime() {
|
function setNameColors(line: ChatLogLineDOM | undefined, colors?: string[]) {
|
||||||
const date = new Date();
|
|
||||||
const hours = date.getHours().toString();
|
|
||||||
const minutes = date.getMinutes().toString();
|
|
||||||
const seconds = date.getSeconds().toString();
|
|
||||||
return `${hours.length === 1 ? `0${hours}` : hours}:${minutes.length === 1 ? `0${minutes}` : minutes}:${seconds.length === 1 ? `0${seconds}` : seconds}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNameColors(line: ChatLogLineDOM | undefined, colors?: string[] | null) {
|
|
||||||
if (!colors || !line) return;
|
if (!colors || !line) return;
|
||||||
if (colors[1]) line.name.style.color = colors[1];
|
if (colors[1]) line.name.style.color = colors[1];
|
||||||
if (colors[0]) line.nameContent.style.color = colors[0];
|
if (colors[0]) line.nameContent.style.color = colors[0];
|
||||||
@@ -232,6 +228,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
local: ChatLogMessage[] = [];
|
local: ChatLogMessage[] = [];
|
||||||
party: ChatLogMessage[] = [];
|
party: ChatLogMessage[] = [];
|
||||||
whisper: ChatLogMessage[] = [];
|
whisper: ChatLogMessage[] = [];
|
||||||
|
filterColor = this.inactiveBg;
|
||||||
unread = 0;
|
unread = 0;
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
private startX = 0;
|
private startX = 0;
|
||||||
@@ -243,9 +240,8 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
private indexes = new Map<string, IndexEntry>();
|
private indexes = new Map<string, IndexEntry>();
|
||||||
private messageCounter = 0;
|
private messageCounter = 0;
|
||||||
private lastOpacity = 0;
|
private lastOpacity = 0;
|
||||||
private autoClear: null | NodeJS.Timeout = null;
|
private autoClear?: NodeJS.Timeout;
|
||||||
private autoUnfocus: null | NodeJS.Timeout = null;
|
private autoUnfocus?: NodeJS.Timeout;
|
||||||
filterColor = this.inactiveBg;
|
|
||||||
constructor(
|
constructor(
|
||||||
private game: PonyTownGame,
|
private game: PonyTownGame,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
@@ -460,7 +456,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
if (!value) {
|
if (!value) {
|
||||||
this.clearTimeOutAutoClear();
|
this.clearTimeOutAutoClear();
|
||||||
this.unFocus();
|
this.unFocus();
|
||||||
this.showHideChatLogLines('', false);
|
this.filterChatLogLines('', false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else this.filterColor = this.bg;
|
else this.filterColor = this.bg;
|
||||||
@@ -482,9 +478,10 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
value = value.slice(1);
|
value = value.slice(1);
|
||||||
try {
|
try {
|
||||||
const regExp = new RegExp(value);
|
const regExp = new RegExp(value);
|
||||||
this.showHideChatLogLines(regExp, toLowerCase);
|
this.filterChatLogLines(regExp, toLowerCase);
|
||||||
this.filterTab.nativeElement.style.color = '';
|
this.filterTab.nativeElement.style.color = '';
|
||||||
} catch (err) {
|
} catch (err) {// If the user inputs invalid regExp we just notify him by changing text color to red
|
||||||
|
if (DEVELOPMENT) console.error(err);
|
||||||
this.filterTab.nativeElement.style.color = '#ff6666';
|
this.filterTab.nativeElement.style.color = '#ff6666';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -493,10 +490,10 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
value = value.toLowerCase();
|
value = value.toLowerCase();
|
||||||
toLowerCase = true;
|
toLowerCase = true;
|
||||||
}
|
}
|
||||||
this.showHideChatLogLines(value, toLowerCase);
|
this.filterChatLogLines(value, toLowerCase);
|
||||||
|
|
||||||
}
|
}
|
||||||
showHideChatLogLines(content: string | RegExp, caseSensitive: boolean) {
|
filterChatLogLines(content: string | RegExp, caseSensitive: boolean) {
|
||||||
const lines = this.linesElement.getElementsByTagName('div');
|
const lines = this.linesElement.getElementsByTagName('div');
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
@@ -507,11 +504,12 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
|
|
||||||
if (typeof content === 'string') {
|
if (typeof content === 'string') {
|
||||||
if (caseSensitive)
|
if (caseSensitive)
|
||||||
textContent.toLowerCase().includes(content) ? lines[i].hidden = false : lines[i].hidden = true;
|
lines[i].hidden = !textContent.toLowerCase().includes(content);
|
||||||
else
|
else
|
||||||
textContent.includes(content) ? lines[i].hidden = false : lines[i].hidden = true;
|
lines[i].hidden = !textContent.includes(content);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
textContent.match(content) ? lines[i].hidden = false : lines[i].hidden = true;
|
lines[i].hidden = !textContent.match(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,79 +521,45 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
lines[i].hidden = false;
|
lines[i].hidden = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private getRGB(hex: string) {
|
|
||||||
const bigint = parseInt(hex, 16);
|
|
||||||
const r = (bigint >> 16) & 255;
|
|
||||||
const g = (bigint >> 8) & 255;
|
|
||||||
const b = bigint & 255;
|
|
||||||
return [r, g, b];
|
|
||||||
}
|
|
||||||
|
|
||||||
private RGBToHSL(rgb: number[]) {
|
brightenDarkColors(hsl: HSL) {
|
||||||
let r = rgb[0] / 255;
|
if (hsl.l < 40) {
|
||||||
let g = rgb[1] / 255;
|
if (hsl.l > 20 && hsl.l < 40) {
|
||||||
let b = rgb[2] / 255;
|
hsl.l += 20;
|
||||||
let max = Math.max(r, g, b);
|
if (hsl.s > 11) hsl.s -= 11;
|
||||||
let min = Math.min(r, g, b);
|
|
||||||
let delta = max - min;
|
|
||||||
let h = 0;
|
|
||||||
let s;
|
|
||||||
let l;
|
|
||||||
|
|
||||||
if (max === min) h = 0;
|
|
||||||
else if (r === max) h = (g - b) / delta;
|
|
||||||
else if (g === max) h = 2 + (b - r) / delta;
|
|
||||||
else if (b === max) h = 4 + (r - g) / delta;
|
|
||||||
|
|
||||||
h = Math.min(h * 60, 360);
|
|
||||||
|
|
||||||
if (h < 0) h += 360;
|
|
||||||
|
|
||||||
l = (min + max) / 2;
|
|
||||||
|
|
||||||
if (max === min) s = 0;
|
|
||||||
else if (l <= 0.5) s = delta / (max + min);
|
|
||||||
else s = delta / (2 - max - min);
|
|
||||||
h = Math.floor(h);
|
|
||||||
s = Math.floor(s * 100);
|
|
||||||
l = Math.floor(l * 100);
|
|
||||||
|
|
||||||
if (l < 40) {
|
|
||||||
if (l > 20 && l < 40) {
|
|
||||||
l += 20;
|
|
||||||
if (s > 11) s -= 11;
|
|
||||||
} else {
|
} else {
|
||||||
l = 40;
|
hsl.l = 40;
|
||||||
if (s > 11) s = 0;
|
if (hsl.s > 11) hsl.s = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return hsl;
|
||||||
|
}
|
||||||
|
|
||||||
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
||||||
}
|
|
||||||
fixColor(color: string) {
|
fixColor(color: string) {
|
||||||
while (color.length <= 7) {
|
while (color.length <= 7) {
|
||||||
color = `0${color}`;
|
color = `0${color}`;
|
||||||
}
|
}
|
||||||
color = color.replace(/0/g, '1');
|
|
||||||
return color.substr(0, 6);
|
return color.substr(0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCharaterColors(id: number | undefined) {
|
|
||||||
if (!id) return null;
|
private getCharacterColors(id: number | undefined) {
|
||||||
|
if (!id) return;
|
||||||
const entity = findEntityById(this.game.map, id) as Pony;
|
const entity = findEntityById(this.game.map, id) as Pony;
|
||||||
if (!entity || !entity.palettePonyInfo) return null;
|
if (!entity || !entity.palettePonyInfo) return;
|
||||||
let colors = [];
|
let colors = [];
|
||||||
let body = entity.palettePonyInfo.body;
|
let { body, mane } = entity.palettePonyInfo;
|
||||||
let mane = entity.palettePonyInfo.mane;
|
|
||||||
if (body && body.palette && body.palette.colors[1]) {
|
if (body && body.palette && body.palette.colors[1]) {
|
||||||
let bodyColor = this.fixColor(body.palette.colors[1].toString(16));
|
const rgb = colorToRGBA(body.palette.colors[1]);
|
||||||
const RGB = this.getRGB(bodyColor);
|
const hsl = rgb2hsl(rgb);
|
||||||
colors.push(this.RGBToHSL(RGB));
|
this.brightenDarkColors(hsl);
|
||||||
|
colors.push(hsl2CSS(hsl));
|
||||||
}
|
}
|
||||||
if (mane && mane.palette && mane.palette.colors[1]) {
|
if (mane && mane.palette && mane.palette.colors[1]) {
|
||||||
let maneColor = this.fixColor(mane.palette.colors[1].toString(16));
|
const rgb = colorToRGBA(mane.palette.colors[1]);
|
||||||
const RGB = this.getRGB(maneColor);
|
const hsl = rgb2hsl(rgb);
|
||||||
colors.push(this.RGBToHSL(RGB));
|
this.brightenDarkColors(hsl);
|
||||||
|
colors.push(hsl2CSS(hsl));
|
||||||
} else if (colors && colors[0]) {
|
} else if (colors && colors[0]) {
|
||||||
colors.push((colors[0]));
|
colors.push((colors[0]));
|
||||||
}
|
}
|
||||||
@@ -604,12 +568,12 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
}
|
}
|
||||||
clearTimeOutAutoClear() {
|
clearTimeOutAutoClear() {
|
||||||
if (this.autoClear) clearTimeout(this.autoClear);
|
if (this.autoClear) clearTimeout(this.autoClear);
|
||||||
this.autoClear = null;
|
this.autoClear = undefined;
|
||||||
this.filterColor = this.inactiveBg;
|
this.filterColor = this.inactiveBg;
|
||||||
}
|
}
|
||||||
clearTimeOutAutoUnfocus() {
|
clearTimeOutAutoUnfocus() {
|
||||||
if (this.autoUnfocus) clearTimeout(this.autoUnfocus);
|
if (this.autoUnfocus) clearTimeout(this.autoUnfocus);
|
||||||
this.autoUnfocus = null;
|
this.autoUnfocus = undefined;
|
||||||
}
|
}
|
||||||
unFocus() {
|
unFocus() {
|
||||||
this.clearTimeOutAutoUnfocus();
|
this.clearTimeOutAutoUnfocus();
|
||||||
@@ -624,9 +588,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
const open = this.open;
|
const open = this.open;
|
||||||
const scrolledToEnd = open ? this.scrolledToEnd : false;
|
const scrolledToEnd = open ? this.scrolledToEnd : false;
|
||||||
const tab = this.activeTab;
|
const tab = this.activeTab;
|
||||||
let colors: string[] | null = null;
|
const colors = this.getCharacterColors(message.id);
|
||||||
colors = this.getCharaterColors(message.id);
|
|
||||||
|
|
||||||
|
|
||||||
this.addEntryToList(this.local, GENERAL_CHAT_LIMIT, open && tab === 'local', entry);
|
this.addEntryToList(this.local, GENERAL_CHAT_LIMIT, open && tab === 'local', entry);
|
||||||
setNameColors(entry.dom, colors);
|
setNameColors(entry.dom, colors);
|
||||||
@@ -686,7 +648,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
entry.dom = removedDom || createChatLogLineDOM(this.clickLabel, this.clickNameHandler);
|
entry.dom = removedDom || createChatLogLineDOM(this.clickLabel, this.clickNameHandler);
|
||||||
updateChatLogLine(entry.dom, entry);
|
updateChatLogLine(entry.dom, entry, this.settings.timestamp);
|
||||||
this.linesElement.appendChild(entry.dom.root);
|
this.linesElement.appendChild(entry.dom.root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -702,6 +664,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
this.regenerateList();
|
this.regenerateList();
|
||||||
this.scrollToEnd();
|
this.scrollToEnd();
|
||||||
this.updateTabs();
|
this.updateTabs();
|
||||||
|
this.filterChat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private updateTabs() {
|
private updateTabs() {
|
||||||
@@ -749,8 +712,8 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
this.messages.forEach(entry => {
|
this.messages.forEach(entry => {
|
||||||
if (!entry.dom) {
|
if (!entry.dom) {
|
||||||
entry.dom = createChatLogLineDOM(this.clickLabel, this.clickNameHandler);
|
entry.dom = createChatLogLineDOM(this.clickLabel, this.clickNameHandler);
|
||||||
setNameColors(entry.dom, this.getCharaterColors(entry.entityId));
|
setNameColors(entry.dom, this.getCharacterColors(entry.entityId));
|
||||||
updateChatLogLine(entry.dom, entry);
|
updateChatLogLine(entry.dom, entry, this.settings.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.appendChild(entry.dom.root);
|
lines.appendChild(entry.dom.root);
|
||||||
@@ -767,7 +730,8 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resizeX) {
|
if (resizeX) {
|
||||||
this.settings.chatlogWidth = clamp(x - this.startX, 200 + 74.7, 2000);
|
const filterBoxWidth = 80;
|
||||||
|
this.settings.chatlogWidth = clamp(x - this.startX, 200 + filterBoxWidth, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resizeY) {
|
if (resizeY) {
|
||||||
|
|||||||
@@ -71,6 +71,17 @@
|
|||||||
[(checked)]="account.ignoreNonFriendWhispers"
|
[(checked)]="account.ignoreNonFriendWhispers"
|
||||||
help="Don't show any whispers from players who are not on your friends list")
|
help="Don't show any whispers from players who are not on your friends list")
|
||||||
| Only allow whispers from friends
|
| Only allow whispers from friends
|
||||||
|
.form-group
|
||||||
|
.form-group
|
||||||
|
label#chatlog-opacity-label Message timestamp
|
||||||
|
div
|
||||||
|
.btn-group.ml-2(btnCheckbox)
|
||||||
|
button.btn.btn-outline-secondary.d-none.d-sm-block([class.active]='off' (click)='switchTimestamp()') Off
|
||||||
|
button.btn.btn-outline-secondary.d-none.d-sm-block([class.active]='twelve' (click)='switchTimestamp("12")') 12
|
||||||
|
button.btn.btn-outline-secondary.d-none.d-sm-block([class.active]='twentyFour' (click)='switchTimestamp("24")') 24
|
||||||
|
span.ml-2 {{timestampText}}
|
||||||
|
//small.form-text.text-muted.mt-0 Shows message time
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label#chatlog-opacity-label Chatlog background opacity
|
label#chatlog-opacity-label Chatlog background opacity
|
||||||
div
|
div
|
||||||
@@ -78,7 +89,6 @@
|
|||||||
[(value)]="account.chatlogOpacity" style="max-width: 300px" labelledBy="chatlog-opacity-label")
|
[(value)]="account.chatlogOpacity" style="max-width: 300px" labelledBy="chatlog-opacity-label")
|
||||||
| {{(account.chatlogOpacity / 100) | percent}}
|
| {{(account.chatlogOpacity / 100) | percent}}
|
||||||
small.form-text.text-muted.mt-0 Changes chatlog background to make it more readable or less obtrusive.
|
small.form-text.text-muted.mt-0 Changes chatlog background to make it more readable or less obtrusive.
|
||||||
.form-group
|
|
||||||
label#chatlog-range-label Chatlog range
|
label#chatlog-range-label Chatlog range
|
||||||
div
|
div
|
||||||
slider-bar.mr-2(
|
slider-bar.mr-2(
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ export class SettingsModal implements OnInit, OnDestroy {
|
|||||||
readonly graphicsIcon = faImage;
|
readonly graphicsIcon = faImage;
|
||||||
readonly exportIcon = faDownload;
|
readonly exportIcon = faDownload;
|
||||||
readonly importIcon = faUpload;
|
readonly importIcon = faUpload;
|
||||||
|
off = false;
|
||||||
|
twelve = false;
|
||||||
|
twentyFour = false;
|
||||||
|
timestampText: 'Disabled' | '24 Hour mode' | '12 Hour mode' = 'Disabled';
|
||||||
@Output() close = new EventEmitter();
|
@Output() close = new EventEmitter();
|
||||||
account: AccountSettings = {};
|
account: AccountSettings = {};
|
||||||
browser: BrowserSettings = {};
|
browser: BrowserSettings = {};
|
||||||
@@ -59,6 +63,7 @@ export class SettingsModal implements OnInit, OnDestroy {
|
|||||||
this.browser = this.settingsService.browser;
|
this.browser = this.settingsService.browser;
|
||||||
this.setupDefaults();
|
this.setupDefaults();
|
||||||
this.subscription = this.game.onLeft.subscribe(() => this.cancel());
|
this.subscription = this.game.onLeft.subscribe(() => this.cancel());
|
||||||
|
this.updateTimestampRadios();
|
||||||
}
|
}
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.finishChatlogRange();
|
this.finishChatlogRange();
|
||||||
@@ -100,6 +105,37 @@ export class SettingsModal implements OnInit, OnDestroy {
|
|||||||
this.settingsService.saveBrowserSettings(this.browser);
|
this.settingsService.saveBrowserSettings(this.browser);
|
||||||
this.close.emit();
|
this.close.emit();
|
||||||
}
|
}
|
||||||
|
switchTimestamp(state?: string) {
|
||||||
|
if (!state) this.browser.timestamp = undefined;
|
||||||
|
else if (state === '12') this.browser.timestamp = '12';
|
||||||
|
else if (state === '24') this.browser.timestamp = '24';
|
||||||
|
this.updateTimestampRadios();
|
||||||
|
}
|
||||||
|
turnOffTimestampRadioButtons() {
|
||||||
|
this.off = false;
|
||||||
|
this.twelve = false;
|
||||||
|
this.twentyFour = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTimestampRadios() {
|
||||||
|
this.turnOffTimestampRadioButtons();
|
||||||
|
switch (this.browser.timestamp) {
|
||||||
|
case '12':
|
||||||
|
this.twelve = true;
|
||||||
|
this.timestampText = '12 Hour mode';
|
||||||
|
break;
|
||||||
|
case '24':
|
||||||
|
this.twentyFour = true;
|
||||||
|
this.timestampText = '24 Hour mode';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.off = true;
|
||||||
|
this.timestampText = 'Disabled';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
updateChatlogRange(range: number | undefined) {
|
updateChatlogRange(range: number | undefined) {
|
||||||
document.body.classList.add('translucent-modals');
|
document.body.classList.add('translucent-modals');
|
||||||
updateRangeIndicator(range, this.game);
|
updateRangeIndicator(range, this.game);
|
||||||
|
|||||||
Reference in New Issue
Block a user