global badge/class fix

This commit is contained in:
Luxferre
2024-09-20 13:44:13 +03:00
parent b6200db5de
commit 9f298cba52
6 changed files with 18 additions and 21 deletions
+2 -2
View File
@@ -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)
}