notherbase-fs 3.3.1 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/user.js +0 -8
- package/models/spirit.js +1 -1
- package/models/user.js +8 -0
- package/package.json +1 -1
- package/test/the-front/check/index.ejs +7 -3
- package/test/pages/check/index-old.ejs +0 -105
package/controllers/user.js
CHANGED
|
@@ -124,14 +124,6 @@ export default class User {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/**
|
|
128
|
-
* Checks if a user is logged in.
|
|
129
|
-
*/
|
|
130
|
-
loggedIn = () => {
|
|
131
|
-
if (this.id) return true;
|
|
132
|
-
else return false;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
127
|
/**
|
|
136
128
|
* Changes a user's email address on file.
|
|
137
129
|
* @param {Object} req An Express.js request.
|
package/models/spirit.js
CHANGED
|
@@ -88,7 +88,7 @@ export default class Spirit {
|
|
|
88
88
|
static recallAny = async (service) => {
|
|
89
89
|
let spirit = new Spirit();
|
|
90
90
|
|
|
91
|
-
let found = await Spirit.db.
|
|
91
|
+
let found = await Spirit.db.find({ service: service });
|
|
92
92
|
|
|
93
93
|
if (found) {
|
|
94
94
|
spirit.memory = found;
|
package/models/user.js
CHANGED
package/package.json
CHANGED
|
@@ -22,15 +22,19 @@
|
|
|
22
22
|
<script>
|
|
23
23
|
const $inp = $("input#test");
|
|
24
24
|
|
|
25
|
-
base.
|
|
26
|
-
|
|
25
|
+
base.loadAll("test-save3").then((res) => {
|
|
26
|
+
console.log(res);
|
|
27
|
+
if (res[0].data.text) $inp.attr("placeholder", res[0].data.text);
|
|
27
28
|
else $inp.attr("placeholder", "No Input Saved");
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
const saveInput = function saveInput() {
|
|
31
32
|
let inp = $inp.val();
|
|
32
33
|
|
|
33
|
-
base.do("save-input", {
|
|
34
|
+
base.do("save-input", {
|
|
35
|
+
text: inp,
|
|
36
|
+
route: "/the-front/check"
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
let switchSocket = io({
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Test</title>
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
8
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
-
<!-- font-family: 'Roboto' or 'Roboto Condensed', sans-serif; -->
|
|
11
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Condensed:wght@700&display=swap" rel="stylesheet">
|
|
12
|
-
<!-- 'Redacted Script', cursive; -->
|
|
13
|
-
<link href="https://fonts.googleapis.com/css2?family=Redacted+Script:wght@300&display=swap" rel="stylesheet">
|
|
14
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
|
15
|
-
<link rel="stylesheet" href="/styles/main.css">
|
|
16
|
-
<link rel="stylesheet" href="/styles/menu.css">
|
|
17
|
-
<link rel="stylesheet" href="/styles/inventory.css">
|
|
18
|
-
<link rel="stylesheet" href="/styles/player.css">
|
|
19
|
-
<link rel="stylesheet" href="/styles/account.css">
|
|
20
|
-
<link rel="stylesheet" href="/styles/more.css">
|
|
21
|
-
<link rel="stylesheet" href="/styles/chat.css">
|
|
22
|
-
<script src="/js/base.js"></script>
|
|
23
|
-
</head>
|
|
24
|
-
<script>
|
|
25
|
-
const currentRoute = "<%- route %>";
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<body>
|
|
29
|
-
<main>
|
|
30
|
-
<div class="chatter" id="adam"></div>
|
|
31
|
-
<input type="text" id="adam">
|
|
32
|
-
<button id="adam">Chat</button>
|
|
33
|
-
</main>
|
|
34
|
-
</body>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
class Spirit {
|
|
38
|
-
constructor(name) {
|
|
39
|
-
this.name = name;
|
|
40
|
-
this.children = {};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
addChild(child, parent) {
|
|
44
|
-
if (!this.children[child.name]) {
|
|
45
|
-
this.children[child.name] = 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
this.children[child.name]++;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
class Chatter {
|
|
53
|
-
constructor(id) {
|
|
54
|
-
this.name = id;
|
|
55
|
-
this.brain = new Spirit("i");
|
|
56
|
-
this.$div = $(`.chatter#${id}`);
|
|
57
|
-
this.$input = $(`input#${id}`);
|
|
58
|
-
this.$submit = $(`button#${id}`);
|
|
59
|
-
|
|
60
|
-
this.$submit.click(() => {
|
|
61
|
-
this.listen(this.$input.val());
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
register = (word) => {
|
|
66
|
-
if (!this.brain[word]) {
|
|
67
|
-
this.brain[word] = new Spirit(word);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return this.brain[word];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
think = () => {
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
listen = (message) => {
|
|
78
|
-
message = message.toLowerCase();
|
|
79
|
-
let words = message.split(" ");
|
|
80
|
-
|
|
81
|
-
//add words to the dialogue tree
|
|
82
|
-
this.register(words[0]);
|
|
83
|
-
for (let i = 0; i < words.length; i++) {
|
|
84
|
-
if (i < words.length - 1) {
|
|
85
|
-
let child = this.register(words[i + 1]);
|
|
86
|
-
if (i > 0) this.brain[words[i]].addChild(child, this.brain[words[i - 1]]);
|
|
87
|
-
else this.brain[words[i]].addChild(child, null);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
//think
|
|
92
|
-
|
|
93
|
-
this.respond(message);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
respond(message) {
|
|
97
|
-
this.$div.append(`<p>${this.name}: ${message}</p>`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const adam = new Chatter("adam");
|
|
102
|
-
adam.listen(`In the beginning God created the heavens and the earth`);
|
|
103
|
-
adam.listen("if i have the first two words in a three word relationship can the third word be guessed")
|
|
104
|
-
</script>
|
|
105
|
-
</html>
|