2017-12-04 18:13:49 +00:00
|
|
|
<template>
|
|
|
|
|
|
|
|
<div id='CONTAINER' class='message'>
|
|
|
|
|
|
|
|
<div v-for='msg in gstore.notif[1].data' :class="msg[0] == gstore.server.session.name ? 'me' : ''">
|
2017-12-05 21:30:03 +00:00
|
|
|
<span class='author' v-text='msg[0]'></span>
|
|
|
|
<span class='content' v-html='bbcode(msg[1])'></span>
|
2017-12-04 18:13:49 +00:00
|
|
|
</div>
|
|
|
|
|
2017-12-05 21:30:03 +00:00
|
|
|
<div class='end-pad'></div> <!-- End Spacing -->
|
|
|
|
|
2017-12-05 17:12:26 +00:00
|
|
|
<form class='msg-input' @submit.prevent='new_message'>
|
2017-12-05 12:32:42 +00:00
|
|
|
<input type='text' placeholder='Nouveau message..' id='msg-new-content' v-model='gstore.new_msg'>
|
|
|
|
<button></button>
|
|
|
|
</form>
|
2017-12-04 18:13:49 +00:00
|
|
|
</div>
|
|
|
|
|
2017-12-05 12:32:42 +00:00
|
|
|
|
2017-12-04 18:13:49 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2017-12-05 07:39:24 +00:00
|
|
|
name: 'CONTAINER_INBOX',
|
2017-12-05 17:41:39 +00:00
|
|
|
data(){ return { gstore: gstore.data }; },
|
2017-12-05 17:12:26 +00:00
|
|
|
methods: {
|
|
|
|
new_message(msg){
|
|
|
|
|
|
|
|
// {1} Send message //
|
|
|
|
this.gstore.func.sendMessage(this.gstore.new_msg);
|
|
|
|
|
|
|
|
// {2} Empty input //
|
|
|
|
this.gstore.new_msg = '';
|
2017-12-05 21:30:03 +00:00
|
|
|
},
|
|
|
|
bbcode: function(msg){
|
|
|
|
|
|
|
|
/* (1) Escape HTML
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
msg = msg.replace(/&/g, '&');
|
|
|
|
msg = msg.replace(/</g, '<');
|
|
|
|
msg = msg.replace(/>/g, '>');
|
|
|
|
|
|
|
|
|
|
|
|
/* (2) Manage text format
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
/* (1) Manage bold */
|
|
|
|
msg = msg.replace(/\*([^\*]+)\*/g, "<b>$1</b>");
|
|
|
|
|
|
|
|
/* (2) italic */
|
|
|
|
msg = msg.replace(/_([^_]+)_/g, "<i>$1</i>");
|
|
|
|
|
|
|
|
/* (3) underline */
|
|
|
|
msg = msg.replace(/\[([^\]]+)\]/g, "<ins>$1</ins>");
|
|
|
|
|
|
|
|
/* (4) Code */
|
|
|
|
msg = msg.replace(/`([^`]+)`/g, "<span>$1</span>");
|
|
|
|
|
|
|
|
|
|
|
|
/* (3) Manage emojis
|
|
|
|
---------------------------------------------------------*/
|
2017-12-05 21:45:55 +00:00
|
|
|
/* (1) Smileys */
|
|
|
|
msg = msg.replace(/:D/g, '😃');
|
|
|
|
msg = msg.replace(/:\)/g, '🙂');
|
|
|
|
msg = msg.replace(/:B/g, '😎');
|
|
|
|
msg = msg.replace(/:3/g, '😗');
|
|
|
|
msg = msg.replace(/;\)/g, '😉');
|
|
|
|
msg = msg.replace(/:P/g, '😋');
|
|
|
|
msg = msg.replace(/;P/g, '😜');
|
|
|
|
msg = msg.replace(/xD/g, '😆');
|
|
|
|
msg = msg.replace(/:O/ig, '😲');
|
|
|
|
msg = msg.replace(/:S/g, '😖');
|
|
|
|
msg = msg.replace(/\^\^/g, '😊');
|
|
|
|
|
|
|
|
/* (2) Emojis */
|
|
|
|
msg = msg.replace(/:poop:/g, '💩');
|
|
|
|
msg = msg.replace(/:fuck:/g, '🖕');
|
|
|
|
msg = msg.replace(/\+1/g, '👍');
|
|
|
|
msg = msg.replace(/-1/g, '👎');
|
2017-12-05 21:30:03 +00:00
|
|
|
|
|
|
|
return msg;
|
2017-12-05 17:12:26 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-04 18:13:49 +00:00
|
|
|
}
|
|
|
|
</script>
|