Browse Source

Revert "Rename notes to todos"

This reverts commit 52dbc551
master
stingl 5 years ago
parent
commit
4fff3b8d51
  1. 4
      app.css
  2. 42
      app.js
  3. 24
      index.html

4
app.css

@ -106,7 +106,3 @@ img.message-image { @@ -106,7 +106,3 @@ img.message-image {
#addForm {
margin-top: 60px;
}
.fa-check-circle {
color: green;
}

42
app.js

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

24
index.html

@ -11,9 +11,6 @@ @@ -11,9 +11,6 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/bootstrap.min.css"/>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.min.css"/>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.min.css"/>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/semantic.min.css"/>
<link rel="stylesheet" href="css/lightbox.min.css"/>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" name="viewport">
</head>
@ -25,7 +22,7 @@ @@ -25,7 +22,7 @@
<div class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#settingsModal">
<i class="fas fa-sliders-h"></i>
</div>
<div class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#todoModal" v-if="todos.length > 0">
<div class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#noteModal" v-if="notes.length > 0">
<i class="fas fa-clipboard"></i>
</div>
<div class="btn btn-sm btn-secondary" @click="scrollDown()">
@ -76,33 +73,33 @@ @@ -76,33 +73,33 @@
required autofocus>
</div>
<div class="modal fade" id="todoModal" tabindex="-1" role="dialog" aria-labelledby="todoModal" aria-hidden="true">
<div class="modal fade" id="noteModal" tabindex="-1" role="dialog" aria-labelledby="noteModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">To-Do</h5>
<h5 class="modal-title">Notes</h5>
<div class="float-right">
<button class="btn btn-sm btn-secondary" @click="clearTodos">
<button class="btn btn-sm btn-secondary" @click="clearNotes">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<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">
<li class="list-group-item" v-for="note in notes" v-if="!note.checked">
<span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/>
<input type="checkbox" v-model="note.checked" @change="updateStorage()"/>
</span>
{{ todo.body }}
{{ note.body }}
</li>
</ul>
<hr/>
<ul class="list-group">
<li class="list-group-item" v-for="todo in todos" v-if="todo.checked">
<li class="list-group-item" v-for="note in notes" v-if="note.checked">
<span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/>
<input type="checkbox" v-model="note.checked" @change="updateStorage()"/>
</span>
<i class="fas fa-check-circle"></i> <span style="text-decoration: line-through;">{{ todo.body }}</span>
<span style="text-decoration: line-through;">{{ note.body }}</span>
</li>
</ul>
</div>
@ -178,7 +175,6 @@ @@ -178,7 +175,6 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="js/lightbox.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script>

Loading…
Cancel
Save