1
0
mirror of https://github.com/citizenfx/cfx-server-data.git synced 2025-01-11 00:03:18 +08:00
cfx-server-data/resources/[system]/chat/html/Message.js

44 lines
780 B
JavaScript
Raw Normal View History

2017-05-18 01:22:20 +08:00
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, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
},
},
props: {
args: {
},
template: {
type: String,
default: window.CONFIG.defaultTemplate,
},
multiline: {
type: Boolean,
default: false,
},
color: {
type: String,
},
},
};