diff --git a/addReactions.html b/addReactions.html new file mode 100644 index 0000000..17fb7ed --- /dev/null +++ b/addReactions.html @@ -0,0 +1,69 @@ + + + + + Kara - Add reponses + + + + + + + + +
+
+ + {{ this.name }} +
+ +
+
+
Add Reaction
+
+ + +
+
+ + +
+
+ + (Wildcards: $username$, $botname$) + +
+ +
+
+
+
+
+
+ + +
+
+ + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/addReponse.js b/addReponse.js new file mode 100644 index 0000000..84f1e47 --- /dev/null +++ b/addReponse.js @@ -0,0 +1,77 @@ +let responses = new Vue({ + el: '#kara', + data: { + name: 'Kara', + activeTheme: 'slate', + addModal: { + includeAll: false, + keywords: '', + responses: [ + 'Answer #1' + ] + } + }, + methods: { + addMessage(body, bot, me = false) { + this.messages.push({ + body: body, + bot: bot, + command: body.search('/') === 0, + me: me, + time: Date.now() + }) + }, + addResponseToInput() { + this.addModal.responses.push(''); + }, + addNewResponseContainer() { + let includeAll = this.addModal.includeAll; + let keywords = this.cleanupMessage(this.addModal.keywords).split(','); + let responses = this.addModal.responses; + + let newResponse = { + includeAll: includeAll, + keywords: keywords, + responses: responses + }; + + axios.post('/responses/create', newResponse) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.log(error); + }) + + // this.addModal.includeAll = false; + // this.addModal.keywords = ''; + // this.addModal.responses = ['']; + }, + cleanupMessage(message) { + message = message.toLowerCase(); + return message.replace('?', '') + .replace('!', '') + .replace('.', '') + .replace(',', '') + .replace('-', '') + .replace('_', '') + .replace('#', '') + .replace('\'', '') + .replace('"', '') + .replace('+', '') + .replace('*', '') + .replace('§', '') + .replace('$', '') + .replace('%', '') + .replace('&', '') + .replace('/', '') + .replace('(', '') + .replace(')', '') + .replace('=', '') + .replace('\\', '') + .replace('@', '') + .replace('~', '') + .replace('…', ''); + } + } +}); diff --git a/app.css b/app.css index facb63c..3196cb9 100644 --- a/app.css +++ b/app.css @@ -9,6 +9,17 @@ body { 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; @@ -82,4 +93,8 @@ body { .me-message { background-color: orange; +} + +#addForm { + margin-top: 60px; } \ No newline at end of file diff --git a/app.js b/app.js index f22928d..0daea58 100644 --- a/app.js +++ b/app.js @@ -98,8 +98,6 @@ let kara = new Vue({ ] ) ); - - this.updateStorage(); }, welcomeBack() { this.botMessage( @@ -130,7 +128,6 @@ let kara = new Vue({ this.username = message.trim(); this.settingsModal.username = this.username; this.askedForName = false; - this.updateStorage(); this.botMessage( this.oneOf([ @@ -298,23 +295,6 @@ let kara = new Vue({ return 'I don\'t know what to say..'; }, - addNewResponseContainer() { - let includeAll = this.addModal.includeAll; - let keywords = this.cleanupMessage(this.addModal.keywords).split(','); - let responses = this.addModal.responses; - - this.answers.push({ - includeAll: includeAll, - keywords: keywords, - responses: responses - }); - - this.addModal.includeAll = false; - this.addModal.keywords = ''; - this.addModal.responses = ['']; - - this.updateStorage(); - }, // Forms saveSettings() { @@ -326,9 +306,6 @@ let kara = new Vue({ // this.botMessage('Settings saved! :)'); this.scrollDown(); }, - addResponseToInput() { - this.addModal.responses.push(''); - }, // Commands processCommands(message) { diff --git a/index.html b/index.html index ad5d67b..2b582c9 100644 --- a/index.html +++ b/index.html @@ -18,9 +18,6 @@
-
- -
@@ -72,41 +69,6 @@ required autofocus> - - -