global badge/class fix
This commit is contained in:
+2
-2
@@ -119,14 +119,14 @@ func kk_process_message(rawmsg map[string]interface{}) {
|
||||
|
||||
/* process username color preference */
|
||||
if _, ok := metadata["color"]; ok && len(metadata["color"].(string)) > 0 {
|
||||
out_message.Type += "-color" + metadata["color"].(string)
|
||||
out_message.Type += "^color" + metadata["color"].(string)
|
||||
}
|
||||
|
||||
/* process username badges */
|
||||
if _, ok := metadata["badges"]; ok && len(metadata["badges"].([]interface{})) > 0 {
|
||||
for _, badge := range metadata["badges"].([]interface{}) {
|
||||
if badge.(map[string]interface{})["active"].(bool) {
|
||||
out_message.Type += "-" + strings.ToLower(badge.(map[string]interface{})["text"].(string))
|
||||
out_message.Type += "^" + strings.ToLower(badge.(map[string]interface{})["text"].(string))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -74,7 +74,6 @@ func oc_process_message(rawmsg map[string]interface{}) {
|
||||
author["displayName"] = "System"
|
||||
}
|
||||
|
||||
|
||||
/* convert the timestamp */
|
||||
sent_dt, _ := time.Parse("2006-01-02T15:04:05.000000000Z", rawmsg["timestamp"].(string))
|
||||
|
||||
@@ -93,19 +92,19 @@ func oc_process_message(rawmsg map[string]interface{}) {
|
||||
|
||||
/* check for authenticated role */
|
||||
if _, ok := author["authenticated"]; ok && author["authenticated"].(bool) == true {
|
||||
out_message.Type += "-authenticated"
|
||||
out_message.Type += "^authenticated"
|
||||
}
|
||||
|
||||
/* check for bot role */
|
||||
if _, ok := author["isBot"]; ok && author["isBot"].(bool) == true {
|
||||
out_message.Type += "-bot"
|
||||
out_message.Type += "^bot"
|
||||
}
|
||||
|
||||
/* add display color hint */
|
||||
if _, ok := author["displayColor"]; ok {
|
||||
dcolor := int(author["displayColor"].(float64))
|
||||
if dcolor > 0 {
|
||||
out_message.Type += fmt.Sprintf("-occolor%d", dcolor)
|
||||
out_message.Type += fmt.Sprintf("^occolor%d", dcolor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -197,19 +197,21 @@ func tw_process_message(rawmsg string) {
|
||||
if len(badges) > 0 { /* process badge names */
|
||||
for _, badge := range badges { /* extract the badge name and version */
|
||||
bname, bver, _ := strings.Cut(badge, "/")
|
||||
out_message.Type += "-" + bname + "-badgetw" + bname + "_" + bver
|
||||
if len(bname) > 0 {
|
||||
out_message.Type += "^" + bname + "^badgetw" + bname + "_" + bver
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* process username color preference */
|
||||
if _, ok := metadata["color"]; ok && len(metadata["color"]) > 0 {
|
||||
out_message.Type += "-color" + metadata["color"]
|
||||
out_message.Type += "^color" + metadata["color"]
|
||||
}
|
||||
|
||||
/* process third-party action */
|
||||
if strings.HasPrefix(out_message.Text, "/me") {
|
||||
out_message.Type += "-me"
|
||||
out_message.Type += "^me"
|
||||
out_message.Text = strings.TrimSpace(out_message.Text[4:])
|
||||
}
|
||||
|
||||
|
||||
@@ -137,20 +137,20 @@ func yt_inner_action_to_chatitem(action map[string]interface{}) ChatMessage {
|
||||
if _, ok := badge["customThumbnail"]; !ok { /* custom badges not supported yet */
|
||||
switch badge["icon"].(map[string]interface{})["iconType"].(string) {
|
||||
case "OWNER":
|
||||
out_message.Type += "-broadcaster"
|
||||
out_message.Type += "^broadcaster"
|
||||
break
|
||||
case "MODERATOR":
|
||||
out_message.Type += "-moderator"
|
||||
out_message.Type += "^moderator"
|
||||
break
|
||||
case "VERIFIED":
|
||||
out_message.Type += "-verified"
|
||||
out_message.Type += "^verified"
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, ok := renderer["purchaseAmountText"]; ok {
|
||||
out_message.Type += "-sponsor"
|
||||
out_message.Type += "^sponsor"
|
||||
}
|
||||
|
||||
return out_message
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ function overrideStyles(text) {
|
||||
function gooseAppendMessage(id, type, timestamp, username, text, icon) {
|
||||
var html = ""
|
||||
if(parseInt(id) > 0 && type.length > 0) {
|
||||
var classes = type.split('-'), cl = classes.length, j,
|
||||
var classes = type.split('^'), cl = classes.length, j,
|
||||
colorpref = null, badges = [], platform, bname
|
||||
for(j=0;j<cl;j++) { /* detect color preference */
|
||||
if(classes[j].startsWith('color'))
|
||||
@@ -57,7 +57,7 @@ function gooseAppendMessage(id, type, timestamp, username, text, icon) {
|
||||
html += '<span class=icon>'
|
||||
for(j=0,cl=badges.length;j<cl;j++) { /* iterate over badges */
|
||||
platform = badges[j].slice(0,2) /* first 2 characters denote the platform */
|
||||
bname = badges[j].slice(2) /* thre rest is the badge name itself */
|
||||
bname = badges[j].slice(2) /* the rest is the badge name itself */
|
||||
html += '<img class=badge src="/badge/{platform}/{badgename}">'
|
||||
.replace('{platform}', platform).replace('{badgename}', bname)
|
||||
}
|
||||
|
||||
+2
-6
@@ -36,7 +36,7 @@ html, body {
|
||||
|
||||
#msglist > div .icon img { /* userpic */
|
||||
max-height: 16px;
|
||||
padding: 0 3px;
|
||||
padding: 0 1px;
|
||||
margin-top: -20px;
|
||||
position: relative;
|
||||
top: 3px;
|
||||
@@ -45,11 +45,7 @@ html, body {
|
||||
.username {
|
||||
display: inline;
|
||||
font-weight: 600;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.icon ~ .username { /* don't apply margin if there's an icon */
|
||||
margin-left: 0;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
#msglist > div:not(.me) .username:after{content:":"}
|
||||
|
||||
Reference in New Issue
Block a user