mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
Betterchat v1
This commit is contained in:
43
resources/[system]/chat/html/Message.js
Normal file
43
resources/[system]/chat/html/Message.js
Normal file
@@ -0,0 +1,43 @@
|
||||
window.MESSAGE = {
|
||||
template: '#message_template',
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
textEscaped() {
|
||||
return this.template.replace(/{(\d+)}/g, (match, number) => {
|
||||
return this.args[number] != undefined ? this.escapeHtml(this.args[number]) : match
|
||||
});
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
},
|
||||
},
|
||||
props: {
|
||||
args: {
|
||||
|
||||
},
|
||||
template: {
|
||||
type: String,
|
||||
default: window.CONFIG.defaultTemplate,
|
||||
},
|
||||
multiline: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user