mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-11 00:03:18 +08:00
44 lines
780 B
JavaScript
44 lines
780 B
JavaScript
|
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,
|
||
|
},
|
||
|
},
|
||
|
};
|