chat: fix messages like ^35121.0^7 showing as .0

This happens because Quake colors are meant to be only a single character, yet the regular expression uses the `+` operator.
This commit is contained in:
moscovium
2017-06-03 08:35:45 +02:00
parent 4557a6fcd2
commit 8d9458fada

View File

@@ -29,7 +29,7 @@ Vue.component('message', {
return `<span style="color: rgb(${this.color[0]}, ${this.color[1]}, ${this.color[2]})">${str}</span>` return `<span style="color: rgb(${this.color[0]}, ${this.color[1]}, ${this.color[2]})">${str}</span>`
}, },
colorize(str) { colorize(str) {
let s = "<span>" + (str.replace(/\^([0-9]+)/g, (str, color) => `</span><span class="color-${color}">`)) + "</span>"; let s = "<span>" + (str.replace(/\^([0-9])/g, (str, color) => `</span><span class="color-${color}">`)) + "</span>";
const styleDict = { const styleDict = {
'*': 'font-weight: bold;', '*': 'font-weight: bold;',