32 lines
684 B
TypeScript
32 lines
684 B
TypeScript
import { NameConfigInstance } from './options'
|
|
|
|
export interface ChatMessage {
|
|
username: string
|
|
isMod: boolean
|
|
}
|
|
|
|
export function innermostElement<T extends Element>(elem: T) {
|
|
if (elem.children.length === 0) {
|
|
return elem
|
|
}
|
|
return innermostElement(elem.children[0])
|
|
}
|
|
|
|
export function usernameTemplateSuffix(newChatMessage: NameConfigInstance) {
|
|
if (newChatMessage.nameCount === 0) {
|
|
return ''
|
|
}
|
|
|
|
return `${newChatMessage.nameCount}`
|
|
}
|
|
|
|
export function usernameImageTemplateSuffix(
|
|
newChatMessage: NameConfigInstance
|
|
) {
|
|
if (newChatMessage.nameCount === 0) {
|
|
return ''
|
|
}
|
|
|
|
return `${newChatMessage.nameCount}`
|
|
}
|