Continued work on 'The Network' theme, fixed username colors for buffered chats from offline users.
This commit is contained in:
parent
3ea702b96d
commit
90e3589591
3 changed files with 100 additions and 40 deletions
|
|
@ -87,14 +87,29 @@ class chatPostprocessor{
|
|||
}
|
||||
|
||||
buildEntry(pm){
|
||||
//Define username color as syntatic sugar, assigning colors to usernames that don't already have one
|
||||
let color = this.client.userList.assignColor(this.rawData.user);
|
||||
|
||||
//Set flair to username color
|
||||
let flair = color;
|
||||
|
||||
//Set class suffix based on chat location
|
||||
const classSuffix = pm ? 'pm-panel-sesh' : 'chat';
|
||||
const classSuffixAlt = pm ? classSuffix : 'chat-panel';
|
||||
|
||||
//Create chat-entry span
|
||||
this.chatEntry = document.createElement('span');
|
||||
this.chatEntry.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry`,`${classSuffix}-entry-${this.rawData.user}`);
|
||||
|
||||
//Add classes to classlist
|
||||
this.chatEntry.classList.add(
|
||||
`${classSuffixAlt}-buffer`,
|
||||
`${classSuffix}-entry`,
|
||||
`${classSuffix}-entry-${this.rawData.user}`,
|
||||
`${classSuffix}-${color}`
|
||||
);
|
||||
|
||||
//Create high-level label
|
||||
var highLevel = document.createElement('p');
|
||||
let highLevel = document.createElement('p');
|
||||
highLevel.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry-high-level`,"high-level");
|
||||
highLevel.textContent = utils.unescapeEntities(`${this.rawData.highLevel}`);
|
||||
this.chatEntry.appendChild(highLevel);
|
||||
|
|
@ -102,19 +117,15 @@ class chatPostprocessor{
|
|||
//If we're not using classic flair
|
||||
if(this.rawData.flair != "classic"){
|
||||
//Use flair
|
||||
var flair = `flair-${this.rawData.flair}`;
|
||||
//Otherwise
|
||||
}else{
|
||||
//Pull user's assigned color from the color map
|
||||
var flair = this.client.userList.colorMap.get(this.rawData.user);
|
||||
flair = `flair-${this.rawData.flair}`;
|
||||
}
|
||||
|
||||
//Create username label
|
||||
var userLabel = document.createElement('p');
|
||||
let userLabel = document.createElement('p');
|
||||
userLabel.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-username`, );
|
||||
|
||||
//Create color span
|
||||
var flairSpan = document.createElement('span');
|
||||
let flairSpan = document.createElement('span');
|
||||
flairSpan.classList.add(`${classSuffix}-entry-flair-span`, flair);
|
||||
flairSpan.innerHTML = this.rawData.user;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue