|
|
@ -15,7 +15,7 @@ let kara = new Vue({ |
|
|
|
chatbox: null, |
|
|
|
chatbox: null, |
|
|
|
isTyping: false, |
|
|
|
isTyping: false, |
|
|
|
askedForName: false, |
|
|
|
askedForName: false, |
|
|
|
takeNote: false, |
|
|
|
takeTodo: false, |
|
|
|
username: '', |
|
|
|
username: '', |
|
|
|
themes: null, |
|
|
|
themes: null, |
|
|
|
activeTheme: 'slate', |
|
|
|
activeTheme: 'slate', |
|
|
@ -32,7 +32,7 @@ let kara = new Vue({ |
|
|
|
username: null, |
|
|
|
username: null, |
|
|
|
location: '' |
|
|
|
location: '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
notes: [], |
|
|
|
todos: [], |
|
|
|
answers: [ |
|
|
|
answers: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
includeAll: false, |
|
|
|
includeAll: false, |
|
|
@ -170,8 +170,8 @@ let kara = new Vue({ |
|
|
|
// Check commands
|
|
|
|
// Check commands
|
|
|
|
if (this.askedForName === true) { |
|
|
|
if (this.askedForName === true) { |
|
|
|
this.setName(message); |
|
|
|
this.setName(message); |
|
|
|
} else if (this.takeNote === true) { |
|
|
|
} else if (this.takeTodo === true) { |
|
|
|
this.saveNote(message); |
|
|
|
this.saveTodo(message); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let answer = this.getAnswer(message); |
|
|
|
let answer = this.getAnswer(message); |
|
|
|
if (answer) { |
|
|
|
if (answer) { |
|
|
@ -187,9 +187,9 @@ let kara = new Vue({ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
processCommands(message) { |
|
|
|
processCommands(message) { |
|
|
|
if (this.checkForCommands(message, 'note')) { |
|
|
|
if (this.checkForCommands(message, 'todo')) { |
|
|
|
let noteToSave = this.checkForCommands(message, 'note'); |
|
|
|
let todoToSave = this.checkForCommands(message, 'todo'); |
|
|
|
this.saveNote(noteToSave); |
|
|
|
this.saveTodo(todoToSave); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'clear')) { |
|
|
|
if (this.checkForCommands(message, 'clear')) { |
|
|
@ -214,7 +214,7 @@ let kara = new Vue({ |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'talk')) { |
|
|
|
if (this.checkForCommands(message, 'talk')) { |
|
|
|
this.talk = !this.talk; |
|
|
|
this.talk = !this.talk; |
|
|
|
alert(this.talk); |
|
|
|
alertify.notify('Speech ' + this.talk ? 'enabled' : 'disabled'); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
checkForCommands(message, commands) { |
|
|
|
checkForCommands(message, commands) { |
|
|
@ -319,12 +319,12 @@ let kara = new Vue({ |
|
|
|
return "Please tell me how i should call you."; |
|
|
|
return "Please tell me how i should call you."; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.includesAllOf(phrases, ['new', 'note']) || |
|
|
|
if (this.includesAllOf(phrases, ['new', 'todo']) || |
|
|
|
this.includesAllOf(phrases, ['new', 'task']) || |
|
|
|
this.includesAllOf(phrases, ['new', 'task']) || |
|
|
|
this.includesAllOf(phrases, ['take', 'note']) || |
|
|
|
this.includesAllOf(phrases, ['take', 'todo']) || |
|
|
|
this.includesAllOf(phrases, ['save', 'to', 'clipboard']) |
|
|
|
this.includesAllOf(phrases, ['save', 'to', 'clipboard']) |
|
|
|
) { |
|
|
|
) { |
|
|
|
this.takeNote = true; |
|
|
|
this.takeTodo = true; |
|
|
|
return this.oneOf([ |
|
|
|
return this.oneOf([ |
|
|
|
"What do you wan't me to save for you?", |
|
|
|
"What do you wan't me to save for you?", |
|
|
|
"Tell me what you wan't to save.", |
|
|
|
"Tell me what you wan't to save.", |
|
|
@ -418,7 +418,7 @@ let kara = new Vue({ |
|
|
|
localStorage.setItem('activeTheme', this.activeTheme); |
|
|
|
localStorage.setItem('activeTheme', this.activeTheme); |
|
|
|
localStorage.setItem('messages', JSON.stringify(this.messages)); |
|
|
|
localStorage.setItem('messages', JSON.stringify(this.messages)); |
|
|
|
localStorage.setItem('answers', JSON.stringify(this.answers)); |
|
|
|
localStorage.setItem('answers', JSON.stringify(this.answers)); |
|
|
|
localStorage.setItem('notes', JSON.stringify(this.notes)); |
|
|
|
localStorage.setItem('todos', JSON.stringify(this.todos)); |
|
|
|
localStorage.setItem('lastMessage', JSON.stringify(this.lastMessage)); |
|
|
|
localStorage.setItem('lastMessage', JSON.stringify(this.lastMessage)); |
|
|
|
localStorage.setItem('location', JSON.stringify(this.location)); |
|
|
|
localStorage.setItem('location', JSON.stringify(this.location)); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -439,8 +439,8 @@ let kara = new Vue({ |
|
|
|
let savedAnswers = JSON.parse(localStorage.getItem('answers')); |
|
|
|
let savedAnswers = JSON.parse(localStorage.getItem('answers')); |
|
|
|
this.answers = savedAnswers ? savedAnswers : []; |
|
|
|
this.answers = savedAnswers ? savedAnswers : []; |
|
|
|
|
|
|
|
|
|
|
|
let savedNotes = JSON.parse(localStorage.getItem('notes')); |
|
|
|
let savedTodos = JSON.parse(localStorage.getItem('todos')); |
|
|
|
this.notes = savedNotes ? savedNotes : []; |
|
|
|
this.todos = savedTodos ? savedTodos : []; |
|
|
|
|
|
|
|
|
|
|
|
let savedLastMessage = JSON.parse(localStorage.getItem('lastMessage')); |
|
|
|
let savedLastMessage = JSON.parse(localStorage.getItem('lastMessage')); |
|
|
|
this.lastMessage = savedLastMessage ? savedLastMessage : null; |
|
|
|
this.lastMessage = savedLastMessage ? savedLastMessage : null; |
|
|
@ -476,10 +476,10 @@ let kara = new Vue({ |
|
|
|
]) |
|
|
|
]) |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
saveNote(message) { |
|
|
|
saveTodo(message) { |
|
|
|
this.takeNote = false; |
|
|
|
this.takeTodo = false; |
|
|
|
|
|
|
|
|
|
|
|
this.notes.push({ |
|
|
|
this.todos.push({ |
|
|
|
time: moment(), |
|
|
|
time: moment(), |
|
|
|
body: message, |
|
|
|
body: message, |
|
|
|
checked: false |
|
|
|
checked: false |
|
|
@ -490,16 +490,16 @@ let kara = new Vue({ |
|
|
|
this.botMessage( |
|
|
|
this.botMessage( |
|
|
|
this.oneOf([ |
|
|
|
this.oneOf([ |
|
|
|
"Saved! :)", |
|
|
|
"Saved! :)", |
|
|
|
"You can read and check your notes in the clipboard-section. :)" |
|
|
|
"You can read and check your todos in the clipboard-section. :)" |
|
|
|
]) |
|
|
|
]) |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
clearNotes() { |
|
|
|
clearTodos() { |
|
|
|
this.notes = []; |
|
|
|
this.todos = []; |
|
|
|
|
|
|
|
|
|
|
|
this.botMessage( |
|
|
|
this.botMessage( |
|
|
|
this.oneOf([ |
|
|
|
this.oneOf([ |
|
|
|
"Notes cleared. 🚮" |
|
|
|
"Todos cleared. 🚮" |
|
|
|
]) |
|
|
|
]) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|