mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-25 19:42:51 +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,
|
|
},
|
|
},
|
|
};
|