mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-25 11:22:51 +08:00
Merge pull request #1 from JohnnyCrazy/betterchat_1
New chat implementation based on VueJS
This commit is contained in:
commit
e750bbfac1
@ -3,6 +3,7 @@ window.APP = {
|
|||||||
name: 'app',
|
name: 'app',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
style: CONFIG.style,
|
||||||
showInput: false,
|
showInput: false,
|
||||||
showWindow: false,
|
showWindow: false,
|
||||||
suggestions: [],
|
suggestions: [],
|
||||||
|
@ -5,13 +5,8 @@ Vue.component('message', {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
textEscaped() {
|
textEscaped() {
|
||||||
let s = '';
|
let s = this.template ? this.template : this.templates[this.templateId];
|
||||||
if (this.template) {
|
s = s.replace(/{(\d+)}/g, (match, number) => {
|
||||||
s = this.colorize(this.template);
|
|
||||||
} else {
|
|
||||||
s = this.colorize(this.templates[this.templateId]);
|
|
||||||
}
|
|
||||||
return s.replace(/{(\d+)}/g, (match, number) => {
|
|
||||||
const argEscaped = this.args[number] != undefined ? this.escape(this.args[number]) : match
|
const argEscaped = this.args[number] != undefined ? this.escape(this.args[number]) : match
|
||||||
if (number == 0 && this.color) {
|
if (number == 0 && this.color) {
|
||||||
//color is deprecated, use templates or ^1 etc.
|
//color is deprecated, use templates or ^1 etc.
|
||||||
@ -19,6 +14,7 @@ Vue.component('message', {
|
|||||||
}
|
}
|
||||||
return argEscaped;
|
return argEscaped;
|
||||||
});
|
});
|
||||||
|
return this.colorize(s);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -8,4 +8,9 @@ window.CONFIG = {
|
|||||||
},
|
},
|
||||||
fadeTimeout: 7000,
|
fadeTimeout: 7000,
|
||||||
suggestionLimit: 5,
|
suggestionLimit: 5,
|
||||||
|
style: {
|
||||||
|
background: 'rgba(52, 73, 94, 0.7)',
|
||||||
|
width: '38%',
|
||||||
|
height: '240px',
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<!-- App Template -->
|
<!-- App Template -->
|
||||||
<script type="text/x-template" id="app_template">
|
<script type="text/x-template" id="app_template">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="chat-window" :class="{ 'fadeOut animated': !showWindow }">
|
<div class="chat-window" :style="this.style" :class="{ 'fadeOut animated': !showWindow }">
|
||||||
<div class="chat-messages" ref="messages">
|
<div class="chat-messages" ref="messages">
|
||||||
<message v-for="msg in messages"
|
<message v-for="msg in messages"
|
||||||
:templates="templates"
|
:templates="templates"
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
RegisterServerEvent('chatCommandEntered')
|
|
||||||
RegisterServerEvent('chatMessageEntered')
|
|
||||||
|
|
||||||
RegisterServerEvent('chat:init')
|
RegisterServerEvent('chat:init')
|
||||||
RegisterServerEvent('chat:addTemplate')
|
RegisterServerEvent('chat:addTemplate')
|
||||||
RegisterServerEvent('chat:addMessage')
|
RegisterServerEvent('chat:addMessage')
|
||||||
|
Loading…
Reference in New Issue
Block a user