Updated comments code to use colour functions.

This commit is contained in:
flash 2018-12-11 01:38:25 +01:00
parent d488902bd3
commit 1c0ca5fc33
2 changed files with 2 additions and 4 deletions

View file

@ -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 {

View file

@ -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'));