From 1c0ca5fc338c2845ad7020b68e3d26894143157d Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 11 Dec 2018 01:38:25 +0100 Subject: [PATCH] Updated comments code to use colour functions. --- assets/typescript/Colour.ts | 2 +- assets/typescript/Comments.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/typescript/Colour.ts b/assets/typescript/Colour.ts index dafe7398..b3f1d9e2 100644 --- a/assets/typescript/Colour.ts +++ b/assets/typescript/Colour.ts @@ -23,7 +23,7 @@ function colourSetInherit(colour: number, enabled: boolean): number { } function colourGetInherit(colour: number): boolean { - return (colour & MSZ_COLOUR_INHERIT) > 0; + return colour === null || (colour & MSZ_COLOUR_INHERIT) > 0; } function colourGetRed(colour: number): number { diff --git a/assets/typescript/Comments.ts b/assets/typescript/Comments.ts index 83114de8..b002fb95 100644 --- a/assets/typescript/Comments.ts +++ b/assets/typescript/Comments.ts @@ -312,9 +312,7 @@ function commentConstruct(comment: CommentPostInfo, layer: number = 0): HTMLElem const replyUser: HTMLDivElement = document.createElement('div'); replyUser.className = 'comment__user'; replyUser.textContent = comment.username; - replyUser.style.color = comment.user_colour == null || (comment.user_colour & 0x40000000) > 0 - ? 'inherit' - : '#' + (comment.user_colour & 0xFFFFFF).toString(16); + replyUser.style.color = colourGetCSS(comment.user_colour); replyInfo.appendChild(replyUser); const replyText: HTMLTextAreaElement = replyContent.appendChild(document.createElement('textarea'));