mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-02-14 10:22:55 +08:00
Finished up some chat stuff
This commit is contained in:
parent
f3a2ddc076
commit
d5864415c3
@ -139,7 +139,6 @@ window.APP = {
|
|||||||
message: this.message,
|
message: this.message,
|
||||||
}));
|
}));
|
||||||
this.oldMessages.unshift(this.message);
|
this.oldMessages.unshift(this.message);
|
||||||
this.message = '';
|
|
||||||
this.oldMessagesIndex = -1;
|
this.oldMessagesIndex = -1;
|
||||||
this.hideInput();
|
this.hideInput();
|
||||||
} else {
|
} else {
|
||||||
@ -151,6 +150,7 @@ window.APP = {
|
|||||||
if (canceled) {
|
if (canceled) {
|
||||||
post('http://chat/chatResult', JSON.stringify({ canceled }));
|
post('http://chat/chatResult', JSON.stringify({ canceled }));
|
||||||
}
|
}
|
||||||
|
this.message = '';
|
||||||
this.showInput = false;
|
this.showInput = false;
|
||||||
clearInterval(this.focusTimer);
|
clearInterval(this.focusTimer);
|
||||||
this.resetShowWindowTimer();
|
this.resetShowWindowTimer();
|
||||||
|
@ -29,13 +29,23 @@ 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) {
|
||||||
const s = "<span>" + (str.replace(/\^([0-9]+)([\*\_\~r])|\^([0-9]+)|\^([\*\_\~r])/g,
|
let s = "<span>" + (str.replace(/\^([0-9]+)/g, (str, color) => `</span><span class="color-${color}">`)) + "</span>";
|
||||||
(match, color1, style1, color2, style2) => {
|
|
||||||
const color = (color1 || color2) ? `color-${color1 || color2} ` : '';
|
const styleDict = {
|
||||||
const style = (style1 || style2) ? `style-${style1 || style2} ` : '';
|
'*': 'font-weight: bold;',
|
||||||
return `</span><span class="${color}${style}">`;
|
'_': 'text-decoration: underline;',
|
||||||
}
|
'~': 'text-decoration: line-through;',
|
||||||
)) + "</span>";
|
'=': 'text-decoration: underline line-through;',
|
||||||
|
'r': 'text-decoration: none;font-weight: normal;',
|
||||||
|
};
|
||||||
|
|
||||||
|
const styleRegex = /\^(\_|\*|\=|\~|\/|r)(.*?)(?=$|\^r|<\/em>)/;
|
||||||
|
while (s.match(styleRegex)) { //Any better solution would be appreciated :P
|
||||||
|
s = s.replace(styleRegex, (str, style, inner) => `<em style="${styleDict[style]}">${inner}</em>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(s);
|
||||||
|
|
||||||
return s.replace(/<span[^>]*><\/span[^>]*>/g, '');
|
return s.replace(/<span[^>]*><\/span[^>]*>/g, '');
|
||||||
},
|
},
|
||||||
escape(unsafe) {
|
escape(unsafe) {
|
||||||
|
@ -8,14 +8,6 @@
|
|||||||
.color-8{color: #cc0000;}
|
.color-8{color: #cc0000;}
|
||||||
.color-9{color: #cc0068;}
|
.color-9{color: #cc0068;}
|
||||||
|
|
||||||
.style-\*{font-weight: bold;}
|
|
||||||
.style-\_{text-decoration: underline;}
|
|
||||||
.style-\~{text-decoration: line-through;}
|
|
||||||
.style-r {
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: 'Lato', sans-serif;
|
font-family: 'Lato', sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -26,6 +18,10 @@
|
|||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
em {
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
font-family: 'Lato', Helvetica, Arial, sans-serif;
|
font-family: 'Lato', Helvetica, Arial, sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
Loading…
Reference in New Issue
Block a user