Browse Source

Apply changes from before revert.

master
Nero 5 years ago
parent
commit
6a7b8cc3d7
  1. 218
      app.css
  2. 13
      app.js
  3. 10
      index.html

218
app.css

@ -1,108 +1,112 @@ @@ -1,108 +1,112 @@
body {
margin: 15px;
padding: 0;
}
#kara {
margin: 0;
padding: 0;
width: auto;
}
@media (min-width: 40em) {
#kara,
#kara-banner,
#chatbox-wrapper {
margin-left: auto;
margin-right: auto;
padding: 0;
width: 40em;
}
}
.message {
color: black;
padding: 10px;
margin-bottom: 5px;
min-width: 55%;
max-width: 80%;
}
img.message-image {
max-width: 60%;
border-radius: 0 15px 15px 15px;
margin-bottom: 5px;
clear: top;
}
.bot-message {
border-radius: 0 15px 15px 15px;
background-color: lightgreen;
}
.user-message {
border-radius: 15px 0 15px 15px;
background-color: lightblue;
}
#chat-box {
margin-top: 4em;
overflow-y: scroll;
height: 65vh;
padding-bottom: 2em;
}
#chatbox-wrapper {
position: fixed;
padding: 1em;
bottom: 0;
left: 0;
right: 0;
}
#kara-banner {
position: fixed;
height: 3.2em;
top: 0;
left: 0;
right: 0;
text-align: center;
padding: 0.7em;
}
#kara-banner .btn, .add-response-input-button {
margin-top: -0.3em;
}
.response-input {
margin-bottom: 3px;
}
.form-button {
width: 100%;
}
.command-message {
color: grey;
}
.command-message::before {
content: '$: ';
}
.header-logo {
max-height: 32px;
max-width: 32px;
width: 32px;
height: 32px;
margin-right: 5px;
}
.me-message {
background-color: orange;
}
#addForm {
margin-top: 60px;
body {
margin: 15px;
padding: 0;
}
#kara {
margin: 0;
padding: 0;
width: auto;
}
@media (min-width: 40em) {
#kara,
#kara-banner,
#chatbox-wrapper {
margin-left: auto;
margin-right: auto;
padding: 0;
width: 40em;
}
}
.message {
color: black;
padding: 10px;
margin-bottom: 5px;
min-width: 55%;
max-width: 80%;
}
img.message-image {
max-width: 60%;
border-radius: 0 15px 15px 15px;
margin-bottom: 5px;
clear: top;
}
.bot-message {
border-radius: 0 15px 15px 15px;
background-color: lightgreen;
}
.user-message {
border-radius: 15px 0 15px 15px;
background-color: lightblue;
}
#chat-box {
margin-top: 4em;
overflow-y: scroll;
height: 65vh;
padding-bottom: 2em;
}
#chatbox-wrapper {
position: fixed;
padding: 1em;
bottom: 0;
left: 0;
right: 0;
}
#kara-banner {
position: fixed;
height: 3.2em;
top: 0;
left: 0;
right: 0;
text-align: center;
padding: 0.7em;
}
#kara-banner .btn, .add-response-input-button {
margin-top: -0.3em;
}
.response-input {
margin-bottom: 3px;
}
.form-button {
width: 100%;
}
.command-message {
color: grey;
}
.command-message::before {
content: '$: ';
}
.header-logo {
max-height: 32px;
max-width: 32px;
width: 32px;
height: 32px;
margin-right: 5px;
}
.me-message {
background-color: orange;
}
#addForm {
margin-top: 60px;
}
.fa-check-circle {
color: green;
}

13
app.js

@ -7,6 +7,7 @@ let kara = new Vue({ @@ -7,6 +7,7 @@ let kara = new Vue({
setNameAtStart: true
},
messages: [],
talk: false,
lastMessage: null,
lastMessageData: {},
name: 'Kara',
@ -140,6 +141,10 @@ let kara = new Vue({ @@ -140,6 +141,10 @@ let kara = new Vue({
},
botMessage(message) {
this.addMessage(message, true);
if (this.talk) {
this.say(message);
}
},
userMessage(body) {
this.addMessage(body, false);
@ -456,6 +461,14 @@ let kara = new Vue({ @@ -456,6 +461,14 @@ let kara = new Vue({
this.rollDice();
}
if (this.checkForCommands(message, 'talk')) {
this.talk = !this.talk;
}
if (this.checkForCommands(message, 'say')) {
this.botMessage(this.checkForCommands(message, 'say'))
}
this.lastMessage = message;
},
checkForCommands(message, commands) {

10
index.html

@ -87,19 +87,13 @@ @@ -87,19 +87,13 @@
<div class="modal-body" style="max-height: 800px; overflow-y: scroll">
<ul class="list-group">
<li class="list-group-item" v-for="todo in todos" v-if="!todo.checked">
<span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/>
</span>
{{ todo.body }}
<i class="far fa-circle" @click="todo.checked = !todo.checked"></i> {{ todo.body }}
</li>
</ul>
<hr/>
<ul class="list-group">
<li class="list-group-item" v-for="todo in todos" v-if="todo.checked">
<span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/>
</span>
<span style="text-decoration: line-through;">{{ todo.body }}</span>
<i class="fas fa-check-circle" @click="todo.checked = !todo.checked"></i> <span style="text-decoration: line-through;">{{ todo.body }}</span>
</li>
</ul>
</div>

Loading…
Cancel
Save