notherbase-fs 3.4.5 → 3.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {
package/public/js/base.js CHANGED
@@ -18,6 +18,9 @@ class Base {
18
18
  username: null,
19
19
  email: null
20
20
  };
21
+
22
+ this.$viewToggle = null;
23
+ this.viewState = "compact";
21
24
  }
22
25
 
23
26
  /**
@@ -142,14 +145,14 @@ class Base {
142
145
  * Creates the toggle view button.
143
146
  */
144
147
  createToggleViewButton = async () => {
145
- Base.commune("getView").then((res) => {
146
- // add a button to the footer for toggling between compact and full view
147
- this.$viewToggle = $("<button>").addClass("view-toggle").text(">");
148
- this.$viewToggle.on("click", () => {
149
- this.toggleView();
150
- });
151
- $("footer").append(this.$viewToggle);
148
+ // add a button to the footer for toggling between compact and full view
149
+ this.$viewToggle = $("<button>").addClass("view-toggle").text(">");
150
+ this.$viewToggle.on("click", () => {
151
+ this.toggleView();
152
+ });
153
+ $("footer").append(this.$viewToggle);
152
154
 
155
+ Base.commune("getView").then((res) => {
153
156
  if (res.data === "full") this.toggleView(false);
154
157
  });
155
158
  }
@@ -159,15 +162,25 @@ class Base {
159
162
  * @param {Boolean} save Whether or not to save the view state.
160
163
  */
161
164
  toggleView = async (save = true) => {
162
- if (this.$viewToggle.text() === ">") {
165
+ if (this.viewState === "compact") {
166
+ this.viewState = "full";
163
167
  this.$viewToggle.text("<");
164
168
  $("main").addClass("full-view");
165
- if (save) Base.commune("setView", { view: "full" });
166
169
  }
167
170
  else {
171
+ this.viewState = "compact";
168
172
  this.$viewToggle.text(">");
169
173
  $("main").removeClass("full-view");
170
- if (save) Base.commune("setView", { view: "compact" });
171
174
  }
175
+
176
+ if (save) Base.commune("setView", { view: this.viewState });
177
+ }
178
+
179
+ /**
180
+ * Appends html to the head.
181
+ * @param {String} html The html to append.
182
+ */
183
+ appendToHead = (html) => {
184
+ $("head").append($(html));
172
185
  }
173
186
  }
package/views/head.ejs CHANGED
@@ -10,9 +10,9 @@
10
10
  <link async href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Condensed:wght@700&display=swap" rel="stylesheet">
11
11
  <!-- 'Redacted Script', cursive; -->
12
12
  <link async href="https://fonts.googleapis.com/css2?family=Redacted+Script:wght@300&display=swap" rel="stylesheet">
13
- <link async rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
13
+ <link async rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
14
14
  <link async rel="stylesheet" href="/styles/main.css">
15
15
  </head>
16
16
 
17
17
  <body>
18
- <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
18
+ <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>