Browse Source

Testing database access.

master
Nero Ignis 5 years ago
parent
commit
d91fe5f37e
  1. 2
      .idea/kara.iml
  2. 39
      .idea/workspace.xml
  3. 4
      app.css
  4. 20
      app.js
  5. 1
      index.html

2
.idea/kara.iml

@ -7,5 +7,7 @@
<orderEntry type="library" name="vue" level="application" /> <orderEntry type="library" name="vue" level="application" />
<orderEntry type="library" name="jquery-3.5.1" level="application" /> <orderEntry type="library" name="jquery-3.5.1" level="application" />
<orderEntry type="library" name="bootstrap" level="application" /> <orderEntry type="library" name="bootstrap" level="application" />
<orderEntry type="library" name="axios" level="application" />
<orderEntry type="library" name="b54a4cceff" level="application" />
</component> </component>
</module> </module>

39
.idea/workspace.xml

@ -5,8 +5,11 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e3f098f0-e98c-435a-af04-d153c9525633" name="Default Changelist" comment=""> <list default="true" id="e3f098f0-e98c-435a-af04-d153c9525633" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/kara.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/kara.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.css" beforeDir="false" afterPath="$PROJECT_DIR$/app.css" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app.css" beforeDir="false" afterPath="$PROJECT_DIR$/app.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/index.html" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -31,7 +34,7 @@
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="last.edited.regexp" value="Why, ever, would you? Stupid! pf." /> <property name="last.edited.regexp" value="Why, ever, would you? Stupid! pf." />
<property name="nodejs_package_manager_path" value="npm" /> <property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" /> <property name="settings.editor.selected.configurable" value="preferences.general" />
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
@ -44,7 +47,7 @@
<workItem from="1597264411672" duration="27000" /> <workItem from="1597264411672" duration="27000" />
<workItem from="1597264469454" duration="594000" /> <workItem from="1597264469454" duration="594000" />
<workItem from="1597346228730" duration="1851000" /> <workItem from="1597346228730" duration="1851000" />
<workItem from="1597348092890" duration="4775000" /> <workItem from="1597348092890" duration="6417000" />
</task> </task>
<task id="LOCAL-00001" summary="Adds gitignore."> <task id="LOCAL-00001" summary="Adds gitignore.">
<created>1597348071361</created> <created>1597348071361</created>
@ -95,7 +98,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1597352800309</updated> <updated>1597352800309</updated>
</task> </task>
<option name="localTasksCounter" value="8" /> <task id="LOCAL-00008" summary="Fix not completely visible messages in mobile view with open keyboard.">
<created>1597352905354</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1597352905354</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -109,25 +119,30 @@
<MESSAGE value="Color change;" /> <MESSAGE value="Color change;" />
<MESSAGE value="Fix vh." /> <MESSAGE value="Fix vh." />
<MESSAGE value="Design fixes;&#10;Adds font-awesome;&#10;Adds scroll-down-button;" /> <MESSAGE value="Design fixes;&#10;Adds font-awesome;&#10;Adds scroll-down-button;" />
<option name="LAST_COMMIT_MESSAGE" value="Design fixes;&#10;Adds font-awesome;&#10;Adds scroll-down-button;" /> <MESSAGE value="Fix not completely visible messages in mobile view with open keyboard." />
<option name="LAST_COMMIT_MESSAGE" value="Fix not completely visible messages in mobile view with open keyboard." />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="278" y="2" width="800" height="718" key="#Plugins" timestamp="1597350105557"> <state x="278" y="2" width="800" height="718" key="#Plugins" timestamp="1597350105557">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state x="278" y="2" width="800" height="718" key="#Plugins/0.0.1366.720@0.0.1366.720" timestamp="1597350105557" /> <state x="278" y="2" width="800" height="718" key="#Plugins/0.0.1366.720@0.0.1366.720" timestamp="1597350105557" />
<state x="222" y="0" width="912" height="720" key="CommitChangelistDialog2" timestamp="1597352800262"> <state x="222" y="0" width="912" height="720" key="CommitChangelistDialog2" timestamp="1597352905315">
<screen x="0" y="0" width="1366" height="720" />
</state>
<state x="222" y="0" width="912" height="720" key="CommitChangelistDialog2/0.0.1366.720@0.0.1366.720" timestamp="1597352905315" />
<state x="466" y="118" width="424" height="490" key="FileChooserDialogImpl" timestamp="1597353496276">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state x="222" y="0" width="912" height="720" key="CommitChangelistDialog2/0.0.1366.720@0.0.1366.720" timestamp="1597352800262" /> <state x="466" y="118" width="424" height="490" key="FileChooserDialogImpl/0.0.1366.720@0.0.1366.720" timestamp="1597353496276" />
<state x="172" y="0" key="SettingsEditor" timestamp="1597347922296"> <state x="172" y="0" key="SettingsEditor" timestamp="1597353501740">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state x="172" y="0" key="SettingsEditor/0.0.1366.720@0.0.1366.720" timestamp="1597347922296" /> <state x="172" y="0" key="SettingsEditor/0.0.1366.720@0.0.1366.720" timestamp="1597353501740" />
<state x="278" y="92" width="800" height="542" key="Vcs.Push.Dialog.v2" timestamp="1597352801406"> <state x="278" y="92" width="800" height="542" key="Vcs.Push.Dialog.v2" timestamp="1597352906498">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state x="278" y="92" width="800" height="542" key="Vcs.Push.Dialog.v2/0.0.1366.720@0.0.1366.720" timestamp="1597352801406" /> <state x="278" y="92" width="800" height="542" key="Vcs.Push.Dialog.v2/0.0.1366.720@0.0.1366.720" timestamp="1597352906498" />
<state x="0" y="0" width="616" height="720" key="find.popup" timestamp="1597346688624"> <state x="0" y="0" width="616" height="720" key="find.popup" timestamp="1597346688624">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
@ -136,9 +151,9 @@
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state width="533" height="302" key="javadoc.popup.new/0.0.1366.720@0.0.1366.720" timestamp="1597349276436" /> <state width="533" height="302" key="javadoc.popup.new/0.0.1366.720@0.0.1366.720" timestamp="1597349276436" />
<state x="346" y="41" width="672" height="678" key="search.everywhere.popup" timestamp="1597350068560"> <state x="346" y="41" width="672" height="678" key="search.everywhere.popup" timestamp="1597353510315">
<screen x="0" y="0" width="1366" height="720" /> <screen x="0" y="0" width="1366" height="720" />
</state> </state>
<state x="346" y="41" width="672" height="678" key="search.everywhere.popup/0.0.1366.720@0.0.1366.720" timestamp="1597350068560" /> <state x="346" y="41" width="672" height="678" key="search.everywhere.popup/0.0.1366.720@0.0.1366.720" timestamp="1597353510315" />
</component> </component>
</project> </project>

4
app.css

@ -53,4 +53,8 @@ body {
text-align: center; text-align: center;
padding: 0.7em; padding: 0.7em;
background-color: #515960; background-color: #515960;
}
#kara-banner .btn {
margin-top: -0.3em;
} }

20
app.js

@ -50,7 +50,8 @@ let kara = new Vue({
setTimeout(() => { setTimeout(() => {
this.aiMessage( this.aiMessage(
this.getAnswer(message) // this.getAnswer(message)
this.getAnswerFromDB(message)
); );
this.scrollDown(); this.scrollDown();
}, 3000); }, 3000);
@ -117,8 +118,6 @@ let kara = new Vue({
.replace('…', ''); .replace('…', '');
}, },
getAnswer(message) { getAnswer(message) {
let isQuestion = (message.indexOf('?') > 0);
message = message.toLowerCase(); message = message.toLowerCase();
message = this.clearMessage(message); message = this.clearMessage(message);
let phrases = message.split(' '); let phrases = message.split(' ');
@ -144,6 +143,21 @@ let kara = new Vue({
} }
return 'I don\'t know what to say..'; return 'I don\'t know what to say..';
},
getAnswerFromDB(message) {
let answer = null;
axios.get('https://luna-development.net/kara', {
params: {
message: message
}
})
.then(function (response) {
answer = response.toString();
})
.catch(function (error) {
answer = error;
})
} }
} }
}) })

1
index.html

@ -62,6 +62,7 @@
</div> </div>
</div> </div>
<script src="https://kit.fontawesome.com/b54a4cceff.js" crossorigin="anonymous"></script> <script src="https://kit.fontawesome.com/b54a4cceff.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 src="https://code.jquery.com/jquery-3.5.1.js">
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js">

Loading…
Cancel
Save