updated logging
This commit is contained in:
Vendored
+9
-4
@@ -10,6 +10,7 @@
|
||||
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
|
||||
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
|
||||
// ==/UserScript==
|
||||
var DEBUG = true
|
||||
var ignoreMod = false
|
||||
var nameImages = {
|
||||
personimage1:
|
||||
@@ -141,7 +142,9 @@ function obfuscator(chatMessage) {
|
||||
if (ignoreMod && chatMessage.isMod) {
|
||||
return null
|
||||
}
|
||||
console.log(`[OBFUSCATOR] Updating Username: ${chatMessage.username}`)
|
||||
if (DEBUG) {
|
||||
console.info(`[OBFUSCATOR] Updating Username: ${chatMessage.username}`)
|
||||
}
|
||||
chatMessage.username = chatMessage.username.toLowerCase()
|
||||
const userData = getStoredUser(chatMessage.username)
|
||||
if (userData !== null) {
|
||||
@@ -181,7 +184,7 @@ function loadChatMessage(chatboxMessage) {
|
||||
)
|
||||
const chatboxUser = chatboxMessage.querySelector('.chat-line__username')
|
||||
if (!chatboxUser) {
|
||||
console.error("found message, couldn't find user")
|
||||
console.error("[OBFUSCATOR] found message, couldn't find user")
|
||||
return
|
||||
}
|
||||
if (chatboxUser.querySelector('.obf-name')) {
|
||||
@@ -191,7 +194,7 @@ function loadChatMessage(chatboxMessage) {
|
||||
'.chat-author__display-name'
|
||||
)
|
||||
if (!chatboxUserInner) {
|
||||
console.error("found message, couldn't find userInner")
|
||||
console.error("[OBFUSCATOR] found message, couldn't find userInner")
|
||||
return
|
||||
}
|
||||
let isMod = false
|
||||
@@ -329,7 +332,9 @@ function eachMutationTarget(record, target) {
|
||||
) || false
|
||||
)
|
||||
if (chatboxMessage) {
|
||||
console.warn('[OBFUSCATOR] mutated message', chatboxMessage, record)
|
||||
if (DEBUG) {
|
||||
console.info('[OBFUSCATOR] mutated message', chatboxMessage, record)
|
||||
}
|
||||
loadChatMessage(chatboxMessage)
|
||||
loadAdditionalUserNames(chatboxMessage)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { obfuscator } from './obfuscator'
|
||||
import { NameConfigInstance, nameImages, usernameExtraSuffix } from './options'
|
||||
import {
|
||||
DEBUG,
|
||||
NameConfigInstance,
|
||||
nameImages,
|
||||
usernameExtraSuffix,
|
||||
} from './options'
|
||||
import { ChatMessage, elementTreeFind, innermostElement } from './util'
|
||||
|
||||
function loadChatMessage(chatboxMessage: Element) {
|
||||
@@ -20,7 +25,7 @@ function loadChatMessage(chatboxMessage: Element) {
|
||||
'.chat-line__username'
|
||||
)
|
||||
if (!chatboxUser) {
|
||||
console.error("found message, couldn't find user")
|
||||
console.error("[OBFUSCATOR] found message, couldn't find user")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -33,7 +38,7 @@ function loadChatMessage(chatboxMessage: Element) {
|
||||
'.chat-author__display-name'
|
||||
)
|
||||
if (!chatboxUserInner) {
|
||||
console.error("found message, couldn't find userInner")
|
||||
console.error("[OBFUSCATOR] found message, couldn't find userInner")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -224,7 +229,9 @@ function eachMutationTarget(record: MutationRecord, target: HTMLElement) {
|
||||
) || false
|
||||
)
|
||||
if (chatboxMessage) {
|
||||
console.warn('[OBFUSCATOR] mutated message', chatboxMessage, record)
|
||||
if (DEBUG) {
|
||||
console.info('[OBFUSCATOR] mutated message', chatboxMessage, record)
|
||||
}
|
||||
loadChatMessage(chatboxMessage)
|
||||
loadAdditionalUserNames(chatboxMessage)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NameConfigInstance, ignoreMod } from './options'
|
||||
import { DEBUG, NameConfigInstance, ignoreMod } from './options'
|
||||
import { getRandomName, getStoredUser, setStoredUser } from './storage'
|
||||
import { ChatMessage } from './util'
|
||||
|
||||
@@ -9,7 +9,9 @@ export function obfuscator(
|
||||
return null
|
||||
}
|
||||
|
||||
console.log(`[OBFUSCATOR] Updating Username: ${chatMessage.username}`)
|
||||
if (DEBUG) {
|
||||
console.info(`[OBFUSCATOR] Updating Username: ${chatMessage.username}`)
|
||||
}
|
||||
|
||||
chatMessage.username = chatMessage.username.toLowerCase()
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// types
|
||||
|
||||
/**
|
||||
* @property color specific color, random color option, or random color option from global list
|
||||
*/
|
||||
@@ -16,6 +18,10 @@ export interface NameConfigInstance {
|
||||
|
||||
export type UsernameExtraSuffix = (nameConfig: NameConfigInstance) => string
|
||||
|
||||
// options
|
||||
|
||||
export const DEBUG = true
|
||||
|
||||
export const ignoreMod: boolean = false
|
||||
|
||||
export const nameImages = {
|
||||
|
||||
Reference in New Issue
Block a user