diff --git a/package-lock.json b/package-lock.json
index 6d8b818..3ca84dd 100644
Binary files a/package-lock.json and b/package-lock.json differ
diff --git a/package.json b/package.json
index c9f0c74..266bbc1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fwdekker.com",
- "version": "0.40.13",
+ "version": "0.40.14",
"description": "The source code of [my personal website](https://fwdekker.com/).",
"author": "Florine W. Dekker",
"browser": "dist/bundle.js",
@@ -24,27 +24,27 @@
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
- "@types/chai": "^4.3.0",
- "@types/js-cookie": "^3.0.1",
- "@types/mocha": "^9.1.0",
- "@types/semver": "^6.2.1",
- "chai": "^4.3.6",
- "grunt": "^1.4.1",
+ "@types/chai": "^4.3.4",
+ "@types/js-cookie": "^3.0.2",
+ "@types/mocha": "^10.0.0",
+ "@types/semver": "^7.3.13",
+ "chai": "^4.3.7",
+ "grunt": "^1.5.3",
"grunt-cli": "^1.4.3",
- "grunt-contrib-clean": "^2.0.0",
+ "grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-focus": "^1.0.0",
"grunt-text-replace": "^0.4.0",
"grunt-webpack": "^5.0.0",
- "jsdom": "^19.0.0",
+ "jsdom": "^20.0.3",
"jsdom-global": "^3.0.2",
- "mocha": "^9.2.1",
+ "mocha": "^10.1.0",
"nyc": "^15.1.0",
- "ts-loader": "^9.2.6",
- "ts-node": "^10.5.0",
- "typescript": "^4.5.5",
- "webpack": "^5.69.1",
- "webpack-cli": "^4.9.2"
+ "ts-loader": "^9.4.1",
+ "ts-node": "^10.9.1",
+ "typescript": "^4.9.3",
+ "webpack": "^5.75.0",
+ "webpack-cli": "^5.0.0"
}
}
diff --git a/src/main/css/main.css b/src/main/css/main.css
index 22f572b..eab8c28 100644
--- a/src/main/css/main.css
+++ b/src/main/css/main.css
@@ -1,64 +1,58 @@
+/* Main elements */
+* {
+ box-sizing: border-box;
+}
+
+html,
+body,
+body > main {
+ margin: 0;
+ padding: 0;
+}
+
+html,
+body {
+ height: 100%;
+ background-color: black;
+}
+
noscript ul {
text-align: center;
}
-
-#terminal a {
- cursor: pointer;
- text-decoration: none;
+.fwd-nav {
+ position: sticky;
+ top: 0;
}
-#terminal a, #terminal a:link, #terminal a:visited {
- color: #00FF00;
-}
-
-#terminal a:hover {
- color: #00BF00;
- text-decoration: underline;
-}
-
-#terminal a:link.dirLink, #terminal a:visited.dirLink {
- color: #00FF00;
-}
-
-#terminal a:link.fileLink, #terminal a:visited.fileLink {
- color: #FFFF00;
-}
-
-.prefixPath, .prefixPath > a:link, .prefixPath > a:visited {
- color: #008000;
+.error-message {
+ color: #FF3333;
}
+/* Mobile support */
@media (max-width: 600px) {
- .wideScreenOnly {
+ .wide-screen-only {
display: none;
}
- .smallScreenOnly {
+ .small-screen-only {
display: inline;
}
}
@media (min-width: 600px) {
- .wideScreenOnly {
+ .wide-screen-only {
display: inline;
}
- .smallScreenOnly {
+ .small-screen-only {
display: none;
}
}
-* {
- box-sizing: border-box;
-}
-
-body {
- background-color: black;
-}
-
+/* Terminal */
#terminal {
min-height: 100%;
padding: 25px;
@@ -77,20 +71,20 @@ body {
margin: 0;
}
-#terminalInput {
+#terminal-input {
display: inline-block;
}
-#terminalInputField {
+#terminal-input-field {
outline: none;
border: none;
}
-#terminalInputField br {
+#terminal-input-field br {
display: none;
}
-.terminalInputFieldHidden {
+.terminal-input-field-hidden {
max-width: 1px !important;
overflow: hidden !important;
overflow-wrap: normal !important;
@@ -98,17 +92,40 @@ body {
vertical-align: top !important;
}
-#terminalSuggestions {
+#terminal-suggestions {
display: block;
}
-.errorMessage {
- color: #FF3333;
+/* Links */
+#terminal a {
+ cursor: pointer;
+ text-decoration: none;
}
-
-#nav {
- position: sticky;
- top: 0;
+#terminal a,
+#terminal a:link,
+#terminal a:visited {
+ color: #00FF00;
+}
+
+#terminal a:hover {
+ color: #00BF00;
+ text-decoration: underline;
+}
+
+#terminal a:link.dir-link,
+#terminal a:visited.dir-link {
+ color: #00FF00;
+}
+
+#terminal a:link.file-link,
+#terminal a:visited.file-link {
+ color: #FFFF00;
+}
+
+.prefix-path,
+.prefix-path > a:link,
+.prefix-path > a:visited {
+ color: #008000;
}
diff --git a/src/main/index.html b/src/main/index.html
index eab4fa0..6858da0 100644
--- a/src/main/index.html
+++ b/src/main/index.html
@@ -1,5 +1,5 @@
-
+
@@ -12,6 +12,9 @@
+
+
+
FWDekker
@@ -20,17 +23,16 @@
-
+
+
-
-
-
+
diff --git a/src/main/js/FileSystem.ts b/src/main/js/FileSystem.ts
index ba20c9d..f82529d 100644
--- a/src/main/js/FileSystem.ts
+++ b/src/main/js/FileSystem.ts
@@ -573,7 +573,7 @@ export class Directory extends Node {
* @param path the path to this node
*/
nameString(name: string, path: Path): string {
- return `${name}`;
+ return `${name}`;
}
visit(path: string,
@@ -673,15 +673,15 @@ export class File extends Node {
switch (this.mime ?? getFileExtension(name)) {
case "jsh": {
const script = `execute('${path.toString(true)}'); return false`;
- return `${name}`;
+ return `${name}`;
}
case "lnk": {
const script = `execute('open ${path.toString(true)}'); return false`;
- return `${name}`;
+ return `${name}`;
}
case "txt": {
const script = `execute('cat ${path.toString(true)}')`;
- return `${name}`;
+ return `${name}`;
}
default:
return name;
diff --git a/src/main/js/Main.ts b/src/main/js/Main.ts
index 019beac..ff654fd 100644
--- a/src/main/js/Main.ts
+++ b/src/main/js/Main.ts
@@ -1,6 +1,6 @@
+const {$, doAfterLoad} = (window as any).fwdekker;
import * as semver from "semver";
-// @ts-ignore
-const {$, doAfterLoad, nav} = window.fwdekker;
+
import {Persistence} from "./Persistence";
import {ExpectedGoodbyeError} from "./Shared";
import {Terminal} from "./Terminal";
@@ -37,8 +37,8 @@ doAfterLoad(() => {
}
if (Persistence.getWasUpdated()) {
- $("#terminalOutput").innerHTML = "" +
- "The terminal application has been updated. To prevent unexpected errors, " +
+ $("#terminal-output").innerHTML = "" +
+ "The terminal application has been updated. To prevent unexpected errors, " +
"all previous user changes have been reset.\n\n";
Persistence.setWasUpdated(false);
}
@@ -52,7 +52,7 @@ doAfterLoad(() => {
doAfterLoad(() => {
if (!Persistence.getPoweroff()) return;
- $("#terminalOutput").innerText = "Could not connect to fwdekker.com. Retrying in 10 seconds.";
+ $("#terminal-output").innerText = "Could not connect to fwdekker.com. Retrying in 10 seconds.";
setTimeout(() => location.reload(), 10000);
throw new ExpectedGoodbyeError("Goodbye");
});
@@ -61,14 +61,12 @@ doAfterLoad(() => {
* Initializes the application.
*/
doAfterLoad(async () => {
- $("#nav").appendChild(nav("/"));
-
window.terminal = new Terminal(
$("#terminal"),
- $("#terminalInputField"),
- $("#terminalOutput"),
- $("#terminalInputPrefix"),
- $("#terminalSuggestions")
+ $("#terminal-input-field"),
+ $("#terminal-output"),
+ $("#terminal-input-prefix"),
+ $("#terminal-suggestions")
);
window.execute = (command: string) => window.terminal.processInput(command);
diff --git a/src/main/js/Persistence.ts b/src/main/js/Persistence.ts
index f68e73c..acee555 100644
--- a/src/main/js/Persistence.ts
+++ b/src/main/js/Persistence.ts
@@ -1,4 +1,5 @@
import Cookies from "js-cookie";
+
import {Environment} from "./Environment";
import {Directory, FileSystem, Node} from "./FileSystem";
import {InputHistory} from "./InputHistory";
@@ -133,7 +134,7 @@ export class Persistence {
* @param value whether the server is "turned off"
*/
static setPoweroff(value: boolean): void {
- Cookies.set("poweroff", "" + value, {
+ Cookies?.set("poweroff", "" + value, {
expires: new Date(new Date().setSeconds(new Date().getSeconds() + 30)),
path: "/",
secure: true,
diff --git a/src/main/js/Shared.ts b/src/main/js/Shared.ts
index 50ce12e..ee9aede 100644
--- a/src/main/js/Shared.ts
+++ b/src/main/js/Shared.ts
@@ -16,7 +16,7 @@ const asciiHeader = ` ________ _______ _ _
* large enough.
*/
export const asciiHeaderHtml =
- `${asciiHeader}FWDekker`;
+ `${asciiHeader}FWDekker`;
/**
* A function that does nothing.
diff --git a/src/main/js/Shell.ts b/src/main/js/Shell.ts
index 188bf65..22d754e 100644
--- a/src/main/js/Shell.ts
+++ b/src/main/js/Shell.ts
@@ -1,12 +1,11 @@
import {Commands, ExitCode} from "./Commands";
import {Environment} from "./Environment";
import {Directory, FileSystem, Path} from "./FileSystem";
-import {InputArgs} from "./InputArgs";
import {InputHistory} from "./InputHistory";
import {Globber, InputParser} from "./InputParser";
import {Persistence} from "./Persistence";
-import {asciiHeaderHtml, ExpectedGoodbyeError, IllegalStateError, isStandalone} from "./Shared";
-import {OutputStream, StreamSet} from "./Stream";
+import {asciiHeaderHtml, ExpectedGoodbyeError, isStandalone} from "./Shared";
+import {StreamSet} from "./Stream";
import {EscapeCharacters} from "./Terminal";
import {UserList} from "./UserList";
@@ -69,9 +68,9 @@ export class Shell {
const target = isStandalone() ? `target="_blank"` : "";
return `${asciiHeaderHtml}
- PhD student Computer Science
+ PhD student Computer Science
@ TU Delft, the Netherlands
- ${(new Date()).toISOString()}
+ ${(new Date()).toISOString()}
Type "help" for help.
@@ -111,9 +110,9 @@ export class Shell {
.join("/");
const status = this.environment.get("status");
- const statusString = status === "0" ? "" : ` [${status}]`;
+ const statusString = status === "0" ? "" : ` [${status}]`;
- return `${userName}@fwdekker.com ${rootText}${partText}${statusString}> `;
+ return `${userName}@fwdekker.com ${rootText}${partText}${statusString}> `;
}
diff --git a/src/main/js/Terminal.ts b/src/main/js/Terminal.ts
index 649f5cb..283ad57 100644
--- a/src/main/js/Terminal.ts
+++ b/src/main/js/Terminal.ts
@@ -72,7 +72,7 @@ export class Terminal {
}
write(string: string) {
- this.wrappedBuffer.write(`${string}`);
+ this.wrappedBuffer.write(`${string}`);
}
}(this.standardOutput);
@@ -170,7 +170,7 @@ export class Terminal {
* Returns `true` if and only if the input field does not display the user's input.
*/
private get isInputHidden(): boolean {
- return this.input.classList.contains("terminalInputFieldHidden");
+ return this.input.classList.contains("terminal-input-field-hidden");
}
/**
@@ -180,9 +180,9 @@ export class Terminal {
*/
private set isInputHidden(isInputHidden: boolean) {
if (isInputHidden)
- this.input.classList.add("terminalInputFieldHidden");
+ this.input.classList.add("terminal-input-field-hidden");
else
- this.input.classList.remove("terminalInputFieldHidden");
+ this.input.classList.remove("terminal-input-field-hidden");
}
diff --git a/src/main/js/plain.js b/src/main/js/plain.js
index ed7ee9c..26ca4db 100644
--- a/src/main/js/plain.js
+++ b/src/main/js/plain.js
@@ -1,9 +1,3 @@
-if (/MSIE|Trident/.test(window.navigator.userAgent)) {
- window.onload = function() {
- document.getElementById("ie-warning").className = "";
- };
-}
-
if ("serviceWorker" in navigator) {
window.addEventListener("load", function() {
return navigator.serviceWorker.register("sw.js?v=%%VERSION_NUMBER%%");
diff --git a/src/test/File.spec.ts b/src/test/File.spec.ts
index 4b27559..9b1009c 100644
--- a/src/test/File.spec.ts
+++ b/src/test/File.spec.ts
@@ -52,17 +52,17 @@ describe("file", () => {
it("uses the file extension to determine the value", () => {
expect(new File("contents").nameString("file.txt", new Path("/file")))
- .to.equal(`file.txt`);
+ .to.equal(`file.txt`);
});
it("uses the mime type if no type is known", () => {
expect(new File("contents", "txt").nameString("file", new Path("/file")))
- .to.equal(`file`);
+ .to.equal(`file`);
});
it("overrides the file extension with the mime type", () => {
expect(new File("link", "lnk").nameString("file.txt", new Path("/file")))
- .to.equal(`file.txt`);
+ .to.equal(`file.txt`);
});
});
});