From 6a7b8cc3d7ce5ef62de3bd91758343d0e617a507 Mon Sep 17 00:00:00 2001 From: Nero Date: Tue, 22 Sep 2020 14:27:30 +0200 Subject: [PATCH] Apply changes from before revert. --- app.css | 218 +++++++++++++++++++++++++++-------------------------- app.js | 13 ++++ index.html | 10 +-- 3 files changed, 126 insertions(+), 115 deletions(-) diff --git a/app.css b/app.css index 3d5e419..25465bb 100644 --- a/app.css +++ b/app.css @@ -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; } \ No newline at end of file diff --git a/app.js b/app.js index 3d1727a..933c44d 100644 --- a/app.js +++ b/app.js @@ -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({ }, 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({ 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) { diff --git a/index.html b/index.html index a80d710..069ec0a 100644 --- a/index.html +++ b/index.html @@ -87,19 +87,13 @@