Compare commits
32 Commits
9 changed files with 2 additions and 1051 deletions
@ -0,0 +1,2 @@ |
|||||||
|
Kara has been moved to luna-development core repository. |
||||||
|
This repository is only for issues. |
@ -1,93 +0,0 @@ |
|||||||
<!DOCTYPE html> |
|
||||||
<html lang="en"> |
|
||||||
<head> |
|
||||||
<title> |
|
||||||
Kara - Add reponses |
|
||||||
</title> |
|
||||||
<meta charset="utf8"> |
|
||||||
<link rel="icon" href="/favicon.ico"> |
|
||||||
<link rel="manifest" href="manifest/kara.json"> |
|
||||||
<link href="https://bootswatch.com/4/slate/bootstrap.min.css" rel="stylesheet" type="text/css"/> |
|
||||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" |
|
||||||
name="viewport"> |
|
||||||
</head> |
|
||||||
<body> |
|
||||||
<div class="container-fluid" id="kara"> |
|
||||||
<div id="kara-banner" class="bg-dark text-light"> |
|
||||||
<img src="/img/logo/luna/icon.ico" class="header-logo" alt="logo-header"/> |
|
||||||
{{ this.name }} |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="row" id="addForm"> |
|
||||||
<div class="col"> |
|
||||||
<h5>Add Reaction</h5> |
|
||||||
<div class="form-group"> |
|
||||||
<label for="includeAll">Message must include all search-terms</label> |
|
||||||
<input type="checkbox" id="includeALl" v-model="addModal.includeAll"> |
|
||||||
</div> |
|
||||||
<div class="form-group"> |
|
||||||
<label for="keywords">Keywords (separated with comma)</label> |
|
||||||
<input type="text" id="keywords" v-model="addModal.keywords" class="form-control"> |
|
||||||
</div> |
|
||||||
<div class="form-group"> |
|
||||||
<label>Responses</label> |
|
||||||
<small>(Wildcards: $username$, $botname$)</small> |
|
||||||
<template v-for="(key, responseOption) in addModal.responses"> |
|
||||||
<input type="text" v-model="addModal.responses[responseOption]" class="form-control response-input"> |
|
||||||
</template> |
|
||||||
<div class="float-right"> |
|
||||||
<button class="btn-sm btn-success" @click="addResponseToInput">+</button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="row"> |
|
||||||
<div class="col"> |
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> |
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @click="addNewReaction">Add |
|
||||||
</button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<link rel="stylesheet" |
|
||||||
:href="'https://maxcdn.bootstrapcdn.com/bootswatch/4.3.1/' + activeTheme + '/bootstrap.min.css'"> |
|
||||||
<link href="app.css" rel="stylesheet" type="text/css"/> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
<script src="https://kit.fontawesome.com/b54a4cceff.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.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://code.jquery.com/jquery-3.5.1.js"></script> |
|
||||||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> |
|
||||||
<script src="addReponse.js"></script> |
|
||||||
|
|
||||||
<!-- JavaScript --> |
|
||||||
<script src="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script> |
|
||||||
|
|
||||||
<!-- CSS --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.min.css"/> |
|
||||||
<!-- Default theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.min.css"/> |
|
||||||
<!-- Semantic UI theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/semantic.min.css"/> |
|
||||||
<!-- Bootstrap theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/bootstrap.min.css"/> |
|
||||||
|
|
||||||
<!-- |
|
||||||
RTL version |
|
||||||
--> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.rtl.min.css"/> |
|
||||||
<!-- Default theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.rtl.min.css"/> |
|
||||||
<!-- Semantic UI theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/semantic.rtl.min.css"/> |
|
||||||
<!-- Bootstrap theme --> |
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/bootstrap.rtl.min.css"/> |
|
||||||
|
|
||||||
</body> |
|
||||||
</html> |
|
@ -1,85 +0,0 @@ |
|||||||
let responses = new Vue({ |
|
||||||
el: '#kara', |
|
||||||
data: { |
|
||||||
name: 'Kara', |
|
||||||
activeTheme: 'slate', |
|
||||||
addModal: { |
|
||||||
includeAll: false, |
|
||||||
keywords: 'keyword', |
|
||||||
responses: [ |
|
||||||
'Answer #1' |
|
||||||
] |
|
||||||
}, |
|
||||||
defaultAddModal: { |
|
||||||
includeAll: false, |
|
||||||
keywords: 'keyword', |
|
||||||
responses: [ |
|
||||||
'Answer #1' |
|
||||||
] |
|
||||||
} |
|
||||||
}, |
|
||||||
mounted() { |
|
||||||
this.addModal = this.defaultAddModal; |
|
||||||
}, |
|
||||||
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(''); |
|
||||||
}, |
|
||||||
addNewReaction() { |
|
||||||
let includeAll = this.addModal.includeAll; |
|
||||||
let keywords = this.addModal.keywords.split(','); |
|
||||||
let responses = this.addModal.responses; |
|
||||||
|
|
||||||
let newReaction = { |
|
||||||
includeAll: includeAll, |
|
||||||
keywords: keywords, |
|
||||||
responses: responses |
|
||||||
}; |
|
||||||
|
|
||||||
axios.post('/reactions/create', { |
|
||||||
reaction: newReaction |
|
||||||
}).then((response) => { |
|
||||||
alertify.notify('Reaction saved!', 'success'); |
|
||||||
this.addModal = this.defaultAddModal; |
|
||||||
}).catch((error) => { |
|
||||||
console.log(error); |
|
||||||
alertify.notify(error, 'danger'); |
|
||||||
}); |
|
||||||
}, |
|
||||||
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('…', ''); |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
@ -1,100 +0,0 @@ |
|||||||
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%; |
|
||||||
} |
|
||||||
|
|
||||||
.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; |
|
||||||
} |
|
Before Width: | Height: | Size: 27 KiB |
@ -1,182 +0,0 @@ |
|||||||
<!DOCTYPE html> |
|
||||||
<html lang="en"> |
|
||||||
<head> |
|
||||||
<title> |
|
||||||
Kara |
|
||||||
</title> |
|
||||||
<meta charset="utf8"> |
|
||||||
<link rel="icon" href="/favicon.ico"> |
|
||||||
<link rel="manifest" href="manifest/kara.json"> |
|
||||||
<link href="https://bootswatch.com/4/slate/bootstrap.min.css" rel="stylesheet" type="text/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/bootstrap.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> |
|
||||||
<body> |
|
||||||
<div class="container-fluid" id="kara"> |
|
||||||
<div id="kara-banner" class="bg-dark text-light"> |
|
||||||
<img src="/img/logo/luna/icon.ico" class="header-logo" alt="logo-header"/> |
|
||||||
<div class="float-right"> |
|
||||||
<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="#noteModal" v-if="notes.length > 0"> |
|
||||||
<i class="fas fa-clipboard"></i> |
|
||||||
</div> |
|
||||||
<div class="btn btn-sm btn-secondary" @click="scrollDown()"> |
|
||||||
<i class="fas fa-chevron-down"></i> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
{{ this.name }} |
|
||||||
</div> |
|
||||||
|
|
||||||
<div id="chat-box"> |
|
||||||
<template v-for="message in messages"> |
|
||||||
<div class="message bot-message float-left" v-if="message.bot"> |
|
||||||
{{ message.body }} |
|
||||||
<br/> |
|
||||||
</div> |
|
||||||
<div :class="'message user-message float-right' + (message.command ? ' command-message' : '') + (message.me ? ' me-message' : '')" v-else> |
|
||||||
{{ message.body }} |
|
||||||
<br/> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
<div class="message bot-message typing float-left" v-if="isTyping"> |
|
||||||
<div class="spinner-grow text-secondary" role="status"> |
|
||||||
<span class="sr-only"> |
|
||||||
Loading... |
|
||||||
</span> |
|
||||||
</div> |
|
||||||
<div class="spinner-grow text-secondary" role="status"> |
|
||||||
<span class="sr-only"> |
|
||||||
Loading... |
|
||||||
</span> |
|
||||||
</div> |
|
||||||
<div class="spinner-grow text-secondary" role="status"> |
|
||||||
<span class="sr-only"> |
|
||||||
Loading... |
|
||||||
</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div id="chatbox-wrapper" class="bg-dark"> |
|
||||||
<input class="form-control" |
|
||||||
id="chatinput" |
|
||||||
type="text" |
|
||||||
v-model="chatbox" |
|
||||||
v-on:keyup.enter="sendMessage()" |
|
||||||
v-on:keyup.38="chatbox = lastMessage" |
|
||||||
v-on:keyup.40="chatbox = ''" |
|
||||||
required autofocus> |
|
||||||
</div> |
|
||||||
|
|
||||||
<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">Notes</h5> |
|
||||||
<div class="float-right"> |
|
||||||
<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="note in notes" v-if="!note.checked"> |
|
||||||
<span class="float-right"> |
|
||||||
<input type="checkbox" v-model="note.checked" @change="updateStorage()"/> |
|
||||||
</span> |
|
||||||
{{ note.body }} |
|
||||||
</li> |
|
||||||
</ul> |
|
||||||
<hr/> |
|
||||||
<ul class="list-group"> |
|
||||||
<li class="list-group-item" v-for="note in notes" v-if="note.checked"> |
|
||||||
<span class="float-right"> |
|
||||||
<input type="checkbox" v-model="note.checked" @change="updateStorage()"/> |
|
||||||
</span> |
|
||||||
<span style="text-decoration: line-through;">{{ note.body }}</span> |
|
||||||
</li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
<div class="modal-footer"> |
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="modal fade" id="settingsModal" tabindex="-1" role="dialog" aria-labelledby="settingsModal" aria-hidden="true"> |
|
||||||
<div class="modal-dialog" role="document"> |
|
||||||
<div class="modal-content"> |
|
||||||
<div class="modal-header"> |
|
||||||
<h5 class="modal-title">Settings</h5> |
|
||||||
</div> |
|
||||||
<div class="modal-body"> |
|
||||||
<div class="form-group" v-if="features.changeName"> |
|
||||||
<label for="name">What's my name?</label> |
|
||||||
<input type="text" class="form-control" id="name" v-model="settingsModal.name"> |
|
||||||
</div> |
|
||||||
<div class="form-group" v-if="username !== null"> |
|
||||||
<label for="username">What's your name?</label> |
|
||||||
<input type="text" class="form-control" id="username" v-model="settingsModal.username"> |
|
||||||
</div> |
|
||||||
<div class="form-group"> |
|
||||||
<label for="location">What city do you live in? <small class="text-muted">(for weather-reports only)</small> </label> |
|
||||||
<input type="text" class="form-control" id="location" v-model="settingsModal.location"> |
|
||||||
</div> |
|
||||||
<div class="form-group" v-if="features.themes"> |
|
||||||
<label for="theme">Pick a theme</label> |
|
||||||
<select name="theme" class="form-control" id="theme" v-model="activeTheme" @change="updateStorage()"> |
|
||||||
<option v-for="theme in themes" :value="theme.name.toLowerCase()" v-text="theme.name"></option> |
|
||||||
</select> |
|
||||||
</div> |
|
||||||
<div class="form-group"> |
|
||||||
<label>Data</label> |
|
||||||
<div class="row"> |
|
||||||
<div class="col-sm-6"> |
|
||||||
<button @click="clearChat()" class="btn btn-warning form-button" data-dismiss="modal"> |
|
||||||
Delete chat |
|
||||||
</button> |
|
||||||
</div> |
|
||||||
<div class="col-sm-6"> |
|
||||||
<button @click="clearStorage()" class="btn btn-warning form-button"> |
|
||||||
Delete everything |
|
||||||
</button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="form-group"> |
|
||||||
<div class="float-right"> |
|
||||||
<i class="fa fa-code" aria-hidden="true"></i> App by <a href="/">Luna Development</a> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="modal-footer"> |
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @click="saveSettings()">Save</button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<link rel="stylesheet" :href="'https://maxcdn.bootstrapcdn.com/bootswatch/4.3.1/' + activeTheme + '/bootstrap.min.css'"> |
|
||||||
<link href="app.css" rel="stylesheet" type="text/css"/> |
|
||||||
</div> |
|
||||||
|
|
||||||
|
|
||||||
<script src="https://kit.fontawesome.com/b54a4cceff.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script> |
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.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://code.jquery.com/jquery-3.5.1.js"></script> |
|
||||||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> |
|
||||||
<script src="https://cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script> |
|
||||||
<script src="app.js"> |
|
||||||
</script> |
|
||||||
</body> |
|
||||||
</html> |
|
@ -1,16 +0,0 @@ |
|||||||
{ |
|
||||||
"short_name": "Kara", |
|
||||||
"name": "Kara", |
|
||||||
"icons": [ |
|
||||||
{ |
|
||||||
"src": "/img/logo/luna/256.png", |
|
||||||
"type": "image/png", |
|
||||||
"sizes": "256x256" |
|
||||||
} |
|
||||||
], |
|
||||||
"start_url": "/kara/", |
|
||||||
"background_color": "#383838", |
|
||||||
"display": "standalone", |
|
||||||
"scope": "/kara/", |
|
||||||
"theme_color": "#383838" |
|
||||||
} |
|
Loading…
Reference in new issue