mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-09 23:02:56 +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',
|
||||
data() {
|
||||
return {
|
||||
style: CONFIG.style,
|
||||
showInput: false,
|
||||
showWindow: false,
|
||||
suggestions: [],
|
||||
|
@ -5,13 +5,8 @@ Vue.component('message', {
|
||||
},
|
||||
computed: {
|
||||
textEscaped() {
|
||||
let s = '';
|
||||
if (this.template) {
|
||||
s = this.colorize(this.template);
|
||||
} else {
|
||||
s = this.colorize(this.templates[this.templateId]);
|
||||
}
|
||||
return s.replace(/{(\d+)}/g, (match, number) => {
|
||||
let s = this.template ? this.template : this.templates[this.templateId];
|
||||
s = s.replace(/{(\d+)}/g, (match, number) => {
|
||||
const argEscaped = this.args[number] != undefined ? this.escape(this.args[number]) : match
|
||||
if (number == 0 && this.color) {
|
||||
//color is deprecated, use templates or ^1 etc.
|
||||
@ -19,6 +14,7 @@ Vue.component('message', {
|
||||
}
|
||||
return argEscaped;
|
||||
});
|
||||
return this.colorize(s);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
@ -8,4 +8,9 @@ window.CONFIG = {
|
||||
},
|
||||
fadeTimeout: 7000,
|
||||
suggestionLimit: 5,
|
||||
style: {
|
||||
background: 'rgba(52, 73, 94, 0.7)',
|
||||
width: '38%',
|
||||
height: '240px',
|
||||
}
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
<!-- App Template -->
|
||||
<script type="text/x-template" id="app_template">
|
||||
<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">
|
||||
<message v-for="msg in messages"
|
||||
:templates="templates"
|
||||
|
@ -1,6 +1,3 @@
|
||||
RegisterServerEvent('chatCommandEntered')
|
||||
RegisterServerEvent('chatMessageEntered')
|
||||
|
||||
RegisterServerEvent('chat:init')
|
||||
RegisterServerEvent('chat:addTemplate')
|
||||
RegisterServerEvent('chat:addMessage')
|
||||
|
Loading…
Reference in New Issue
Block a user