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 {
#addForm { #addForm {
margin-top: 60px; margin-top: 60px;
} }
.fa-check-circle {
color: green;
}

42
app.js

@ -15,7 +15,7 @@ let kara = new Vue({
chatbox: null, chatbox: null,
isTyping: false, isTyping: false,
askedForName: false, askedForName: false,
takeTodo: false, takeNote: 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: ''
}, },
todos: [], notes: [],
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.takeTodo === true) { } else if (this.takeNote === true) {
this.saveTodo(message); this.saveNote(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, 'todo')) { if (this.checkForCommands(message, 'note')) {
let todoToSave = this.checkForCommands(message, 'todo'); let noteToSave = this.checkForCommands(message, 'note');
this.saveTodo(todoToSave); this.saveNote(noteToSave);
} }
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;
alertify.notify('Speech ' + this.talk ? 'enabled' : 'disabled'); alert(this.talk);
} }
}, },
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', 'todo']) || if (this.includesAllOf(phrases, ['new', 'note']) ||
this.includesAllOf(phrases, ['new', 'task']) || this.includesAllOf(phrases, ['new', 'task']) ||
this.includesAllOf(phrases, ['take', 'todo']) || this.includesAllOf(phrases, ['take', 'note']) ||
this.includesAllOf(phrases, ['save', 'to', 'clipboard']) this.includesAllOf(phrases, ['save', 'to', 'clipboard'])
) { ) {
this.takeTodo = true; this.takeNote = 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('todos', JSON.stringify(this.todos)); localStorage.setItem('notes', JSON.stringify(this.notes));
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 savedTodos = JSON.parse(localStorage.getItem('todos')); let savedNotes = JSON.parse(localStorage.getItem('notes'));
this.todos = savedTodos ? savedTodos : []; this.notes = savedNotes ? savedNotes : [];
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({
]) ])
) )
}, },
saveTodo(message) { saveNote(message) {
this.takeTodo = false; this.takeNote = false;
this.todos.push({ this.notes.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 todos in the clipboard-section. :)" "You can read and check your notes in the clipboard-section. :)"
]) ])
) )
}, },
clearTodos() { clearNotes() {
this.todos = []; this.notes = [];
this.botMessage( this.botMessage(
this.oneOf([ this.oneOf([
"Todos cleared. 🚮" "Notes cleared. 🚮"
]) ])
); );

24
index.html

@ -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/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/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="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"/> <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"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" name="viewport">
</head> </head>
@ -25,7 +22,7 @@
<div class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#settingsModal"> <div class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#settingsModal">
<i class="fas fa-sliders-h"></i> <i class="fas fa-sliders-h"></i>
</div> </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> <i class="fas fa-clipboard"></i>
</div> </div>
<div class="btn btn-sm btn-secondary" @click="scrollDown()"> <div class="btn btn-sm btn-secondary" @click="scrollDown()">
@ -76,33 +73,33 @@
required autofocus> required autofocus>
</div> </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-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">To-Do</h5> <h5 class="modal-title">Notes</h5>
<div class="float-right"> <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> <i class="fas fa-trash"></i>
</button> </button>
</div> </div>
</div> </div>
<div class="modal-body" style="max-height: 800px; overflow-y: scroll"> <div class="modal-body" style="max-height: 800px; overflow-y: scroll">
<ul class="list-group"> <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"> <span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/> <input type="checkbox" v-model="note.checked" @change="updateStorage()"/>
</span> </span>
{{ todo.body }} {{ note.body }}
</li> </li>
</ul> </ul>
<hr/> <hr/>
<ul class="list-group"> <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"> <span class="float-right">
<input type="checkbox" v-model="todo.checked" @change="updateStorage()"/> <input type="checkbox" v-model="note.checked" @change="updateStorage()"/>
</span> </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> </li>
</ul> </ul>
</div> </div>
@ -178,7 +175,6 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" crossorigin="anonymous"></script> <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://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.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="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="js/lightbox.min.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> <script src="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script>

Loading…
Cancel
Save