notherbase-fs 4.0.21 → 4.0.23

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.
Files changed (54) hide show
  1. package/README.md +6 -6
  2. package/controllers/creation.js +147 -147
  3. package/controllers/spirit-world.js +174 -174
  4. package/controllers/user.js +240 -240
  5. package/controllers/util.js +64 -64
  6. package/models/index.js +33 -33
  7. package/models/send-mail.js +58 -58
  8. package/models/spirit.js +234 -234
  9. package/notherbase-fs.js +112 -111
  10. package/package.json +40 -40
  11. package/public/js/base.js +222 -227
  12. package/public/js/chat-box.js +120 -120
  13. package/test/coast/tall-beach/nono-cove/index.css +17 -17
  14. package/test/coast/tall-beach/nono-cove/index.ejs +29 -29
  15. package/test/coast/tall-beach/nono-cove/nono-og/add-gold.js +15 -15
  16. package/test/coast/tall-beach/nono-cove/nono-og/index.ejs +46 -46
  17. package/test/coast/tall-beach/nono-cove/nono-og/nono.css +88 -88
  18. package/test/coast/tall-beach/nono-cove/nono-og/nono.js +207 -207
  19. package/test/pages/test-page/emailTime.js +8 -8
  20. package/test/pages/test-page/index.ejs +104 -104
  21. package/test/pages/void/index.ejs +35 -35
  22. package/test/pages/void/void.css +2 -2
  23. package/test/public/styles/main.css +792 -792
  24. package/test/the-front/add-gold.js +13 -13
  25. package/test/the-front/check/check.css +2 -2
  26. package/test/the-front/check/emailTime.js +9 -9
  27. package/test/the-front/check/flip.js +9 -9
  28. package/test/the-front/check/index.ejs +54 -54
  29. package/test/the-front/check/save-input.js +7 -7
  30. package/test/the-front/index.ejs +116 -99
  31. package/test/the-front/keeper/clipboards.js +133 -133
  32. package/test/the-front/keeper/index.ejs +80 -80
  33. package/test/the-front/keeper/keeper.css +157 -157
  34. package/test/the-front/keeper/keeper.js +140 -140
  35. package/test-index.js +19 -19
  36. package/test2/pages/test-page/emailTime.js +8 -8
  37. package/test2/pages/test-page/index.ejs +104 -104
  38. package/test2/pages/void/index.ejs +35 -35
  39. package/test2/pages/void/void.css +2 -2
  40. package/test2/public/styles/main.css +792 -792
  41. package/test2/the-front/add-gold.js +13 -13
  42. package/test2/the-front/check/check.css +2 -2
  43. package/test2/the-front/check/emailTime.js +9 -9
  44. package/test2/the-front/check/flip.js +9 -9
  45. package/test2/the-front/check/index.ejs +54 -54
  46. package/test2/the-front/check/save-input.js +7 -7
  47. package/test2/the-front/index.ejs +99 -99
  48. package/test2/the-front/keeper/clipboards.js +133 -133
  49. package/test2/the-front/keeper/index.ejs +80 -80
  50. package/test2/the-front/keeper/keeper.css +157 -157
  51. package/test2/the-front/keeper/keeper.js +140 -140
  52. package/views/explorer.ejs +82 -82
  53. package/views/footer.ejs +9 -9
  54. package/views/head.ejs +17 -17
@@ -1,120 +1,120 @@
1
- /**
2
- * Creates a chat box from a div.chat-box.
3
- */
4
- class ChatBox {
5
- constructor(username, room) {
6
- ChatBox.attemptStyle();
7
- this.socket = null;
8
- this.username = username;
9
- this.room = room;
10
- this.$div = $(`.chat-box#${room}`);
11
- this.$chatLog = null;
12
- this.$entry = null;
13
- this.maxMessages = 100;
14
-
15
- this.socket = io({
16
- query: {
17
- room: this.room,
18
- name: this.username
19
- }
20
- });
21
-
22
- this.socket.on('chat message', this.newMessage);
23
- this.socket.on('chat info', this.updateInfo);
24
- this.render();
25
- }
26
-
27
- static styled = false;
28
-
29
- /**
30
- * Adds the chat box styles if needed.
31
- */
32
- static attemptStyle() {
33
- if (!ChatBox.styled) {
34
- $("head").append(`<link href='/styles/chat.css' rel='stylesheet' />`);
35
- ChatBox.styled = true;
36
- }
37
- }
38
-
39
- /**
40
- * Renders a new message in the chat.
41
- * @param {Object} msg An object including the text to render.
42
- */
43
- newMessage = (msg) => {
44
- let time = new Date(msg.time);
45
- let times = time.toLocaleTimeString('en-US').split(":");
46
- this.$chatLog.append(`<p>(${times[0]}:${times[1]}) ${msg.name}: ${msg.text}</p>`);
47
- this.$chatLog.scrollTop(this.$chatLog.prop("scrollHeight"));
48
- let msgs = this.$chatLog.find("p");
49
- if (msgs.length > this.maxMessages) {
50
- for (let i = 0; i < msgs.length - this.maxMessages; i++) {
51
- msgs[i].remove();
52
- }
53
- }
54
- }
55
-
56
- /**
57
- * Updates info about the chat room in the chat box.
58
- * @param {Object} msg An object including the users in the room.
59
- */
60
- updateInfo = (msg) => {
61
- this.$usersChatting.text(`${msg.data.users.length} User${msg.data.users.length !== 1 ? "s" : ""} Chatting`);
62
-
63
- this.$users.empty();
64
- this.$header = $(`<h4>You are ${this.username}</h4>`).appendTo(this.$users);
65
-
66
- for (let i = 0; i < msg.data.users.length; i++) {
67
- this.$users.append(`<li>${msg.data.users[i]}</li>`);
68
- }
69
- }
70
-
71
- /**
72
- * Sends a new chat message to the server.
73
- */
74
- sendMessage = (override = null) => {
75
- if (override !== null) {
76
- this.socket.emit('chat message', {
77
- name: this.username,
78
- time: Date.now(),
79
- text: override
80
- });
81
- }
82
- else if (this.$entry.val() !== ""){
83
- let val = this.$entry.val();
84
- this.$entry.val("");
85
-
86
- this.socket.emit('chat message', {
87
- name: this.username,
88
- time: Date.now(),
89
- text: val
90
- });
91
- }
92
- }
93
-
94
- /**
95
- * Renders necessary child elements.
96
- */
97
- render() {
98
- this.$div.empty();
99
-
100
- this.$usersChatting = $(`<button id="chatting">0 Users Chatting</button>`).appendTo(this.$div);
101
- this.$usersChatting.click(this.toggleUsers);
102
- this.$chatLog = $(`<div class="chat-log"></div>`).appendTo(this.$div);
103
- this.$users = $(`<ul class="users"></ul>`).appendTo(this.$div);
104
- this.$header = $(`<h4>You are ${this.username}</h4>`).appendTo(this.$users);
105
- this.$entry = $(`<input autocomplete="off" type="text" class="chat-entry">`).appendTo(this.$div);
106
- this.$send = $(`<button class="chat-send">Send</button>`).appendTo(this.$div);
107
-
108
- this.$send.on("click", (e) => {
109
- this.sendMessage(null);
110
- });
111
- this.$entry.on("keyup", (e) => {
112
- if (e.keyCode == 13) this.sendMessage(null);
113
- });
114
- }
115
-
116
- toggleUsers = () => {
117
- this.$users.toggleClass("shown");
118
- }
119
- }
120
-
1
+ /**
2
+ * Creates a chat box from a div.chat-box.
3
+ */
4
+ class ChatBox {
5
+ constructor(username, room) {
6
+ ChatBox.attemptStyle();
7
+ this.socket = null;
8
+ this.username = username;
9
+ this.room = room;
10
+ this.$div = $(`.chat-box#${room}`);
11
+ this.$chatLog = null;
12
+ this.$entry = null;
13
+ this.maxMessages = 100;
14
+
15
+ this.socket = io({
16
+ query: {
17
+ room: this.room,
18
+ name: this.username
19
+ }
20
+ });
21
+
22
+ this.socket.on('chat message', this.newMessage);
23
+ this.socket.on('chat info', this.updateInfo);
24
+ this.render();
25
+ }
26
+
27
+ static styled = false;
28
+
29
+ /**
30
+ * Adds the chat box styles if needed.
31
+ */
32
+ static attemptStyle() {
33
+ if (!ChatBox.styled) {
34
+ $("head").append(`<link href='/styles/chat.css' rel='stylesheet' />`);
35
+ ChatBox.styled = true;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Renders a new message in the chat.
41
+ * @param {Object} msg An object including the text to render.
42
+ */
43
+ newMessage = (msg) => {
44
+ let time = new Date(msg.time);
45
+ let times = time.toLocaleTimeString('en-US').split(":");
46
+ this.$chatLog.append(`<p>(${times[0]}:${times[1]}) ${msg.name}: ${msg.text}</p>`);
47
+ this.$chatLog.scrollTop(this.$chatLog.prop("scrollHeight"));
48
+ let msgs = this.$chatLog.find("p");
49
+ if (msgs.length > this.maxMessages) {
50
+ for (let i = 0; i < msgs.length - this.maxMessages; i++) {
51
+ msgs[i].remove();
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Updates info about the chat room in the chat box.
58
+ * @param {Object} msg An object including the users in the room.
59
+ */
60
+ updateInfo = (msg) => {
61
+ this.$usersChatting.text(`${msg.data.users.length} User${msg.data.users.length !== 1 ? "s" : ""} Chatting`);
62
+
63
+ this.$users.empty();
64
+ this.$header = $(`<h4>You are ${this.username}</h4>`).appendTo(this.$users);
65
+
66
+ for (let i = 0; i < msg.data.users.length; i++) {
67
+ this.$users.append(`<li>${msg.data.users[i]}</li>`);
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Sends a new chat message to the server.
73
+ */
74
+ sendMessage = (override = null) => {
75
+ if (override !== null) {
76
+ this.socket.emit('chat message', {
77
+ name: this.username,
78
+ time: Date.now(),
79
+ text: override
80
+ });
81
+ }
82
+ else if (this.$entry.val() !== ""){
83
+ let val = this.$entry.val();
84
+ this.$entry.val("");
85
+
86
+ this.socket.emit('chat message', {
87
+ name: this.username,
88
+ time: Date.now(),
89
+ text: val
90
+ });
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Renders necessary child elements.
96
+ */
97
+ render() {
98
+ this.$div.empty();
99
+
100
+ this.$usersChatting = $(`<button id="chatting">0 Users Chatting</button>`).appendTo(this.$div);
101
+ this.$usersChatting.click(this.toggleUsers);
102
+ this.$chatLog = $(`<div class="chat-log"></div>`).appendTo(this.$div);
103
+ this.$users = $(`<ul class="users"></ul>`).appendTo(this.$div);
104
+ this.$header = $(`<h4>You are ${this.username}</h4>`).appendTo(this.$users);
105
+ this.$entry = $(`<input autocomplete="off" type="text" class="chat-entry">`).appendTo(this.$div);
106
+ this.$send = $(`<button class="chat-send">Send</button>`).appendTo(this.$div);
107
+
108
+ this.$send.on("click", (e) => {
109
+ this.sendMessage(null);
110
+ });
111
+ this.$entry.on("keyup", (e) => {
112
+ if (e.keyCode == 13) this.sendMessage(null);
113
+ });
114
+ }
115
+
116
+ toggleUsers = () => {
117
+ this.$users.toggleClass("shown");
118
+ }
119
+ }
120
+
@@ -1,18 +1,18 @@
1
- :root {
2
- }
3
-
4
- .nono-spirit {
5
- width: 100%;
6
- height: 200px;
7
- margin: 10px;
8
- position: relative;
9
- }
10
-
11
- .nono-spirit img {
12
- width: 100px;
13
- height: 100px;
14
- top: 50%;
15
- left: 50%;
16
- position: absolute;
17
- image-rendering: pixelated;
1
+ :root {
2
+ }
3
+
4
+ .nono-spirit {
5
+ width: 100%;
6
+ height: 200px;
7
+ margin: 10px;
8
+ position: relative;
9
+ }
10
+
11
+ .nono-spirit img {
12
+ width: 100px;
13
+ height: 100px;
14
+ top: 50%;
15
+ left: 50%;
16
+ position: absolute;
17
+ image-rendering: pixelated;
18
18
  }
@@ -1,30 +1,30 @@
1
- <p>
2
- nono
3
- </p>
4
-
5
- <hr>
6
-
7
- <h3>chat</h3>
8
-
9
- <div class="chat-box" id="test-chat"></div>
10
- <div class="chat-box" id="test-chat-2"></div>
11
- <div class="chat-box" id="test-chat-3"></div>
12
-
13
- <hr>
14
-
15
- <a href="/the-front" class="to">
16
- Go to The Front
17
- </a>
18
-
19
- <a href="/coast/tall-beach/nono-cove/nono-og" class="to">
20
- Go to Nono Cove
21
- </a>
22
-
23
- <script src="/js/chat-box.js"></script>
24
- <script>
25
- let chatTest = new ChatBox("<%= user.memory.data.username %>", "test-chat");
26
- let chatTest2 = new ChatBox("<%= user.memory.data.username %>", "test-chat-2");
27
- let chatTest3 = new ChatBox("<%= user.memory.data.username %>", "test-chat-3");
28
-
29
- chatTest.sendMessage("Hello, world!");
1
+ <p>
2
+ nono
3
+ </p>
4
+
5
+ <hr>
6
+
7
+ <h3>chat</h3>
8
+
9
+ <div class="chat-box" id="test-chat"></div>
10
+ <div class="chat-box" id="test-chat-2"></div>
11
+ <div class="chat-box" id="test-chat-3"></div>
12
+
13
+ <hr>
14
+
15
+ <a href="/the-front" class="to">
16
+ Go to The Front
17
+ </a>
18
+
19
+ <a href="/coast/tall-beach/nono-cove/nono-og" class="to">
20
+ Go to Nono Cove
21
+ </a>
22
+
23
+ <script src="/js/chat-box.js"></script>
24
+ <script>
25
+ let chatTest = new ChatBox("<%= user.memory.data.username %>", "test-chat");
26
+ let chatTest2 = new ChatBox("<%= user.memory.data.username %>", "test-chat-2");
27
+ let chatTest3 = new ChatBox("<%= user.memory.data.username %>", "test-chat-3");
28
+
29
+ chatTest.sendMessage("Hello, world!");
30
30
  </script>
@@ -1,16 +1,16 @@
1
- export default async (req, user) => {
2
- await user.offsetItem("Gold Coin", 3);
3
-
4
- let spirit = await req.db.Spirit.recallOne("test");
5
- if (!spirit.memory.data.amount) spirit.memory.data.amount = 0;
6
- spirit.memory.data.amount += 3;
7
- await spirit.commit();
8
-
9
- let stats = await req.db.Spirit.recallOne("stats");
10
- let render = [];
11
- let keys = Object.keys(stats.memory.data);
12
- for (let i = 0; i < keys.length; i++) {
13
- render.push(`${keys[i]} - ${stats.memory.data[keys[i]].visits}`)
14
- }
15
- console.log(render);
1
+ export default async (req, user) => {
2
+ await user.offsetItem("Gold Coin", 3);
3
+
4
+ let spirit = await req.db.Spirit.recallOne("test");
5
+ if (!spirit.memory.data.amount) spirit.memory.data.amount = 0;
6
+ spirit.memory.data.amount += 3;
7
+ await spirit.commit();
8
+
9
+ let stats = await req.db.Spirit.recallOne("stats");
10
+ let render = [];
11
+ let keys = Object.keys(stats.memory.data);
12
+ for (let i = 0; i < keys.length; i++) {
13
+ render.push(`${keys[i]} - ${stats.memory.data[keys[i]].visits}`)
14
+ }
15
+ console.log(render);
16
16
  }
@@ -1,47 +1,47 @@
1
- <style>
2
- <%- include("./nono.css"); %>
3
- </style>
4
-
5
- <p>
6
- A random nono washes up on shore. Will you solve it?
7
- </p>
8
-
9
- <hr>
10
-
11
- <div class="nono-spirit">
12
- <img id="move-nono-spirit" src="/img/logo.png" alt="Nono Spirit">
13
- </div>
14
-
15
- <div id="nono-board"></div>
16
-
17
- <hr>
18
-
19
- <a href="/the-front">
20
- Go to The Front
21
- </a>
22
-
23
- <script>
24
- let lastPos = [0, 0];
25
-
26
- let moveNono = function moveNono() {
27
- let focus = $("#move-nono-spirit");
28
- let newPos = [Math.floor(Math.random() * 200), Math.floor(Math.random() * 100)];
29
-
30
- focus.animate({
31
- left: newPos[0],
32
- top: newPos[1],
33
- }, 2000);
34
-
35
- lastPos = newPos;
36
- };
37
-
38
- moveNono();
39
-
40
- setInterval(moveNono, 2000);
41
-
42
- <%- include("./nono.js"); %>
43
-
44
- base.load("test", "global").then((res) => {
45
- console.log(res);
46
- });
1
+ <style>
2
+ <%- include("./nono.css"); %>
3
+ </style>
4
+
5
+ <p>
6
+ A random nono washes up on shore. Will you solve it?
7
+ </p>
8
+
9
+ <hr>
10
+
11
+ <div class="nono-spirit">
12
+ <img id="move-nono-spirit" src="/img/logo.png" alt="Nono Spirit">
13
+ </div>
14
+
15
+ <div id="nono-board"></div>
16
+
17
+ <hr>
18
+
19
+ <a href="/the-front">
20
+ Go to The Front
21
+ </a>
22
+
23
+ <script>
24
+ let lastPos = [0, 0];
25
+
26
+ let moveNono = function moveNono() {
27
+ let focus = $("#move-nono-spirit");
28
+ let newPos = [Math.floor(Math.random() * 200), Math.floor(Math.random() * 100)];
29
+
30
+ focus.animate({
31
+ left: newPos[0],
32
+ top: newPos[1],
33
+ }, 2000);
34
+
35
+ lastPos = newPos;
36
+ };
37
+
38
+ moveNono();
39
+
40
+ setInterval(moveNono, 2000);
41
+
42
+ <%- include("./nono.js"); %>
43
+
44
+ base.load("test", "global").then((res) => {
45
+ console.log(res);
46
+ });
47
47
  </script>
@@ -1,89 +1,89 @@
1
- :root {
2
- --nonoColor: rgb(87, 61, 53);
3
- --nonoColorBright: rgb(187, 130, 113);
4
- --nonoBG: rgb(61, 61, 61);
5
- }
6
-
7
- #nono-board {
8
- border: 2px solid black;
9
- display: flex;
10
- flex-wrap: wrap;
11
- align-items: flex-start;
12
- }
13
-
14
- .nono {
15
- background-color: var(--nonoBG);
16
- user-select: none;
17
- image-rendering: pixelated;
18
- }
19
-
20
- .hints {
21
- background-color: var(--nonoBG);
22
- display: flex;
23
- flex-wrap: wrap;
24
- align-items: flex-start;
25
- user-select: none;
26
- }
27
-
28
- .column {
29
- border: 1px solid var(--nonoColor);
30
- height: 100%;
31
- display: flex;
32
- flex-direction: column;
33
- justify-content: flex-end;
34
- user-select: none;
35
- }
36
-
37
- .row {
38
- border: 1px solid var(--nonoColor);
39
- width: 100%;
40
- display: flex;
41
- flex-direction: row;
42
- justify-content: flex-end;
43
- user-select: none;
44
- }
45
-
46
- .hint {
47
- width: 25px;
48
- height: 25px;
49
- margin: 0;
50
- display: flex;
51
- justify-content: center;
52
- align-items: center;
53
- user-select: none;
54
- }
55
-
56
- .nono-field {
57
- display: flex;
58
- flex-wrap: wrap;
59
- align-items: flex-start;
60
- }
61
-
62
- .nono-tile {
63
- border: 1px solid var(--nonoColor);
64
- cursor: pointer;
65
- }
66
-
67
- .borderless {
68
- border: none !important;
69
- cursor: initial !important;
70
- }
71
-
72
- .nono-tile:hover {
73
- border: 1px solid var(--nonoColorBright);
74
- }
75
-
76
- .blank {
77
- background-color: white;
78
- transition: all .1s ease;
79
- }
80
-
81
- .marked {
82
- background-color: rgb(73, 80, 182);
83
- transition: all .1s ease;
84
- }
85
-
86
- .punched {
87
- background-color: rgb(0, 0, 0);
88
- transition: all .1s ease;
1
+ :root {
2
+ --nonoColor: rgb(87, 61, 53);
3
+ --nonoColorBright: rgb(187, 130, 113);
4
+ --nonoBG: rgb(61, 61, 61);
5
+ }
6
+
7
+ #nono-board {
8
+ border: 2px solid black;
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ align-items: flex-start;
12
+ }
13
+
14
+ .nono {
15
+ background-color: var(--nonoBG);
16
+ user-select: none;
17
+ image-rendering: pixelated;
18
+ }
19
+
20
+ .hints {
21
+ background-color: var(--nonoBG);
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ align-items: flex-start;
25
+ user-select: none;
26
+ }
27
+
28
+ .column {
29
+ border: 1px solid var(--nonoColor);
30
+ height: 100%;
31
+ display: flex;
32
+ flex-direction: column;
33
+ justify-content: flex-end;
34
+ user-select: none;
35
+ }
36
+
37
+ .row {
38
+ border: 1px solid var(--nonoColor);
39
+ width: 100%;
40
+ display: flex;
41
+ flex-direction: row;
42
+ justify-content: flex-end;
43
+ user-select: none;
44
+ }
45
+
46
+ .hint {
47
+ width: 25px;
48
+ height: 25px;
49
+ margin: 0;
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ user-select: none;
54
+ }
55
+
56
+ .nono-field {
57
+ display: flex;
58
+ flex-wrap: wrap;
59
+ align-items: flex-start;
60
+ }
61
+
62
+ .nono-tile {
63
+ border: 1px solid var(--nonoColor);
64
+ cursor: pointer;
65
+ }
66
+
67
+ .borderless {
68
+ border: none !important;
69
+ cursor: initial !important;
70
+ }
71
+
72
+ .nono-tile:hover {
73
+ border: 1px solid var(--nonoColorBright);
74
+ }
75
+
76
+ .blank {
77
+ background-color: white;
78
+ transition: all .1s ease;
79
+ }
80
+
81
+ .marked {
82
+ background-color: rgb(73, 80, 182);
83
+ transition: all .1s ease;
84
+ }
85
+
86
+ .punched {
87
+ background-color: rgb(0, 0, 0);
88
+ transition: all .1s ease;
89
89
  }