diff --git a/jest.config.js b/jest.config.js
index 2506cf3d..b7462c4b 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -23,7 +23,7 @@ module.exports = {
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
- coverageDirectory: 'coverage',
+ coverageDirectory: "coverage",
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
@@ -31,7 +31,7 @@ module.exports = {
// ],
// Indicates which provider should be used to instrument code for coverage
- coverageProvider: 'babel',
+ coverageProvider: "babel",
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
@@ -137,7 +137,7 @@ module.exports = {
// snapshotSerializers: [],
// The test environment that will be used for testing
- testEnvironment: 'jsdom',
+ testEnvironment: "jsdom",
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
diff --git a/webAO/__tests__/iniParse.test.js b/webAO/__tests__/iniParse.test.js
index d9e1b7a5..f1efc3e9 100644
--- a/webAO/__tests__/iniParse.test.js
+++ b/webAO/__tests__/iniParse.test.js
@@ -1,4 +1,4 @@
-import iniParse from '../iniParse';
+import iniParse from "../iniParse";
const iniExample = `
[Options]
@@ -9,31 +9,31 @@ showname = Matty
number = 9
1 = Normal#-#normal#0#1
`;
-describe('iniParse', () => {
- test('should not lowercase value if key is showname', () => {
- const parsedIni = iniParse(`
+describe("iniParse", () => {
+ test("should not lowercase value if key is showname", () => {
+ const parsedIni = iniParse(`
[test]
showname = MATT
`);
- expect(parsedIni.test.showname).toBe('MATT');
- });
- test('should lowercase value if key is not showname', () => {
- const parsedIni = iniParse(`
+ expect(parsedIni.test.showname).toBe("MATT");
+ });
+ test("should lowercase value if key is not showname", () => {
+ const parsedIni = iniParse(`
[test]
party = TIME
`);
- expect(parsedIni.test.party).toBe('time');
- });
- test('should parse sections', () => {
- const parsedIni = iniParse(iniExample);
- expect(Object.keys(parsedIni).length).toBe(2);
- });
- test('should parse parameters', () => {
- const parsedIni = iniParse(iniExample);
- expect(Object.keys(parsedIni.options).length).toBe(2);
- });
- test('should remove empty lines', () => {
- const parsedIni = iniParse(`
+ expect(parsedIni.test.party).toBe("time");
+ });
+ test("should parse sections", () => {
+ const parsedIni = iniParse(iniExample);
+ expect(Object.keys(parsedIni).length).toBe(2);
+ });
+ test("should parse parameters", () => {
+ const parsedIni = iniParse(iniExample);
+ expect(Object.keys(parsedIni.options).length).toBe(2);
+ });
+ test("should remove empty lines", () => {
+ const parsedIni = iniParse(`
[test]
@@ -42,6 +42,6 @@ describe('iniParse', () => {
`);
- expect(Object.keys(parsedIni.test).length).toBe(2);
- });
+ expect(Object.keys(parsedIni.test).length).toBe(2);
+ });
});
diff --git a/webAO/client/__tests__/setEmote.test.js b/webAO/client/__tests__/setEmote.test.js
index a0091c0e..856374e0 100644
--- a/webAO/client/__tests__/setEmote.test.js
+++ b/webAO/client/__tests__/setEmote.test.js
@@ -1,112 +1,140 @@
-import setEmote from '../setEmote.ts';
-import Client from '../../client.ts';
-import fileExists from '../../utils/fileExists';
-import transparentPng from '../../constants/transparentPng';
+import setEmote from "../setEmote.ts";
+import Client from "../../client.ts";
+import fileExists from "../../utils/fileExists";
+import transparentPng from "../../constants/transparentPng";
-jest.mock('../../viewport/utils/createMusic');
-jest.mock('../../utils/fileExists');
-jest.mock('../../viewport/utils/createSfxAudio');
-jest.mock('../../viewport/utils/createShoutAudio');
-jest.mock('../../viewport/utils/createTestimonyAudio');
-describe('setEmote', () => {
- const AO_HOST = '';
+jest.mock("../../viewport/utils/createMusic");
+jest.mock("../../utils/fileExists");
+jest.mock("../../viewport/utils/createSfxAudio");
+jest.mock("../../viewport/utils/createShoutAudio");
+jest.mock("../../viewport/utils/createTestimonyAudio");
+describe("setEmote", () => {
+ const AO_HOST = "";
- const client = new Client('127.0.0.1');
- const firstExtension = '.gif';
+ const client = new Client("127.0.0.1");
+ const firstExtension = ".gif";
- test('Should have a client_def_char_img with a valid source', async () => {
- fileExists.mockReturnValue(true);
- document.body.innerHTML = `
+ test("Should have a client_def_char_img with a valid source", async () => {
+ fileExists.mockReturnValue(true);
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 0, 'def');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_def_char_img').src).toEqual(expected);
- });
- test('Should have a client_pro_char_img to have a valid src', async () => {
- document.body.innerHTML = `
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 0, "def");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ expect(document.getElementById("client_def_char_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_pro_char_img to have a valid src", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 0, 'pro');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_pro_char_img').src).toEqual(expected);
- });
- test('Should have a client_wit_char_img', async () => {
- document.body.innerHTML = `
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 0, "pro");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ expect(document.getElementById("client_pro_char_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_wit_char_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 0, 'wit');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 0, "wit");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_wit_char_img').src).toEqual(expected);
- });
- test('Should have a client_def_pair_img', async () => {
- document.body.innerHTML = `
+ expect(document.getElementById("client_wit_char_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_def_pair_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 1, 'def');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 1, "def");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_def_pair_img').src).toEqual(expected);
- });
- test('Should have a client_pro_pair_img', async () => {
- document.body.innerHTML = `
+ expect(document.getElementById("client_def_pair_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_pro_pair_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 1, 'pro');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 1, "pro");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_pro_pair_img').src).toEqual(expected);
- });
- test('Should have a client_wit_pair_img', async () => {
- document.body.innerHTML = `
+ expect(document.getElementById("client_pro_pair_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_wit_pair_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 1, 'wit');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 1, "wit");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_wit_pair_img').src).toEqual(expected);
- });
- test('Should have a client_char_img', async () => {
- document.body.innerHTML = `
+ expect(document.getElementById("client_wit_pair_img").src).toEqual(
+ expected,
+ );
+ });
+ test("Should have a client_char_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 0, 'notvalid');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 0, "notvalid");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_char_img').src).toEqual(expected);
- });
- test('Should have a client_pair_img', async () => {
- document.body.innerHTML = `
+ expect(document.getElementById("client_char_img").src).toEqual(expected);
+ });
+ test("Should have a client_pair_img", async () => {
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', '(a)', 1, 'notvalid');
- const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
+ await setEmote(AO_HOST, client, "salanto", "coding", "(a)", 1, "notvalid");
+ const expected = `http://localhost/characters/salanto/(a)coding${firstExtension}`;
- expect(document.getElementById('client_pair_img').src).toEqual(expected);
- });
- test('Should handle .png urls differently', async () => {
- fileExists.mockReturnValueOnce(false);
- document.body.innerHTML = `
+ expect(document.getElementById("client_pair_img").src).toEqual(expected);
+ });
+ test("Should handle .png urls differently", async () => {
+ fileExists.mockReturnValueOnce(false);
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', 'prefixNotValid', 1, 'notvalid');
- const expected = 'http://localhost/characters/salanto/coding.png';
+ await setEmote(
+ AO_HOST,
+ client,
+ "salanto",
+ "coding",
+ "prefixNotValid",
+ 1,
+ "notvalid",
+ );
+ const expected = "http://localhost/characters/salanto/coding.png";
- expect(document.getElementById('client_pair_img').src).toEqual(expected);
- });
- test('Should replace character if new character responds', async () => {
- fileExists.mockReturnValue(false);
- document.body.innerHTML = `
+ expect(document.getElementById("client_pair_img").src).toEqual(expected);
+ });
+ test("Should replace character if new character responds", async () => {
+ fileExists.mockReturnValue(false);
+ document.body.innerHTML = `
`;
- await setEmote(AO_HOST, client, 'salanto', 'coding', 'prefixNotValid', 1, 'notvalid');
- const expected = transparentPng;
- expect(document.getElementById('client_pair_img').src).toEqual(expected);
- });
+ await setEmote(
+ AO_HOST,
+ client,
+ "salanto",
+ "coding",
+ "prefixNotValid",
+ 1,
+ "notvalid",
+ );
+ const expected = transparentPng;
+ expect(document.getElementById("client_pair_img").src).toEqual(expected);
+ });
});
diff --git a/webAO/components/__tests__/audioChannels.test.js b/webAO/components/__tests__/audioChannels.test.js
index 4407ae3c..b71fa49e 100644
--- a/webAO/components/__tests__/audioChannels.test.js
+++ b/webAO/components/__tests__/audioChannels.test.js
@@ -1,9 +1,9 @@
-import createAudioChannels from '../audioChannels';
+import createAudioChannels from "../audioChannels";
-describe('createAudioChannels', () => {
- test('Should create 4 channels', () => {
- document.body.innerHTML = '';
- createAudioChannels(4);
- expect(document.getElementsByClassName('audioChannel').length).toBe(4);
- });
+describe("createAudioChannels", () => {
+ test("Should create 4 channels", () => {
+ document.body.innerHTML = "";
+ createAudioChannels(4);
+ expect(document.getElementsByClassName("audioChannel").length).toBe(4);
+ });
});
diff --git a/webAO/components/__tests__/blips.test.js b/webAO/components/__tests__/blips.test.js
index dc90416b..d56ad275 100644
--- a/webAO/components/__tests__/blips.test.js
+++ b/webAO/components/__tests__/blips.test.js
@@ -1,9 +1,9 @@
-import createBlip from '../blip';
+import createBlip from "../blip";
-describe('createBlip', () => {
- test('create 3 blips audios', () => {
- document.body.innerHTML = '';
- createBlip(3);
- expect(document.getElementsByClassName('blipSound').length).toBe(3);
- });
+describe("createBlip", () => {
+ test("create 3 blips audios", () => {
+ document.body.innerHTML = "";
+ createBlip(3);
+ expect(document.getElementsByClassName("blipSound").length).toBe(3);
+ });
});
diff --git a/webAO/components/audioChannels.js b/webAO/components/audioChannels.js
index 6032e665..9eca8600 100644
--- a/webAO/components/audioChannels.js
+++ b/webAO/components/audioChannels.js
@@ -3,11 +3,11 @@
* @param {number} amountOfChannels Amount of Blips to put on page
*/
const createAudioChannels = (amountOfChannels) => {
- for (let i = 0; i < amountOfChannels; i++) {
- const audioChannel = document.createElement('audio');
- audioChannel.setAttribute('class', 'audioChannel');
- document.body.appendChild(audioChannel);
- }
+ for (let i = 0; i < amountOfChannels; i++) {
+ const audioChannel = document.createElement("audio");
+ audioChannel.setAttribute("class", "audioChannel");
+ document.body.appendChild(audioChannel);
+ }
};
createAudioChannels(4);
export default createAudioChannels;
diff --git a/webAO/components/blip.js b/webAO/components/blip.js
index 86a674b0..770525c5 100644
--- a/webAO/components/blip.js
+++ b/webAO/components/blip.js
@@ -1,17 +1,17 @@
-import { AO_HOST } from '../client/aoHost.ts';
+import { AO_HOST } from "../client/aoHost.ts";
/**
*
* @param {number} amountOfBlips Amount of Blips to put on page
*/
const createBlip = (amountOfBlips) => {
- for (let i = 0; i < amountOfBlips; i++) {
- const audio = document.createElement('audio');
- const blipUrl = `${AO_HOST}sounds/blips/male.opus`;
- audio.setAttribute('class', 'blipSound');
- audio.setAttribute('src', blipUrl);
- document.body.appendChild(audio);
- }
+ for (let i = 0; i < amountOfBlips; i++) {
+ const audio = document.createElement("audio");
+ const blipUrl = `${AO_HOST}sounds/blips/male.opus`;
+ audio.setAttribute("class", "blipSound");
+ audio.setAttribute("src", blipUrl);
+ document.body.appendChild(audio);
+ }
};
createBlip(6);
export default createBlip;
diff --git a/webAO/constants/backgrounds.js b/webAO/constants/backgrounds.js
index a0a21f66..71dfa606 100644
--- a/webAO/constants/backgrounds.js
+++ b/webAO/constants/backgrounds.js
@@ -1,25 +1,25 @@
export default [
- 'Anime',
- 'birthday',
- 'Christmas',
- 'CountyCourt',
- 'CruiseCourt',
- 'default',
- 'DGSEnglishCourt',
- 'DGSJapanCourt',
- 'DualDestinies',
- 'EnglishCourt',
- 'gs4',
- 'GS4Night',
- 'HD',
- "Khura'in",
- 'mlp',
- 'NewCourt',
- 'RuinedCourt',
- 'Sky',
- 'SpaceCourt',
- 'Themis',
- 'TouhouCourt',
- 'WitchTrialCourt',
- 'Zetta',
+ "Anime",
+ "birthday",
+ "Christmas",
+ "CountyCourt",
+ "CruiseCourt",
+ "default",
+ "DGSEnglishCourt",
+ "DGSJapanCourt",
+ "DualDestinies",
+ "EnglishCourt",
+ "gs4",
+ "GS4Night",
+ "HD",
+ "Khura'in",
+ "mlp",
+ "NewCourt",
+ "RuinedCourt",
+ "Sky",
+ "SpaceCourt",
+ "Themis",
+ "TouhouCourt",
+ "WitchTrialCourt",
+ "Zetta",
];
diff --git a/webAO/constants/characters.js b/webAO/constants/characters.js
index 9586b1a8..94e674c5 100644
--- a/webAO/constants/characters.js
+++ b/webAO/constants/characters.js
@@ -1,53 +1,53 @@
export default [
- 'Adrian',
- 'Apollo',
- 'April',
- 'Armstrong',
- 'Atmey',
- 'Butz',
- 'Diego',
- 'Edgeworth',
- 'Edgeworthw',
- 'Ema',
- 'Emaskye',
- 'Franny',
- 'Franziska',
- 'Gant',
- 'Gavin',
- 'Gavin K',
- 'Godot',
- 'Gregory',
- 'Grossberg',
- 'Gumshoe',
- 'Gumshoey',
- 'Hawk',
- 'Hobo_Phoenix',
- 'Ini',
- 'Judge',
- "Judge's Bro",
- 'Klav',
- 'Klavier',
- 'Kristoph',
- 'Lana',
- 'Layton',
- 'Lotta',
- 'Luis',
- 'Maggey',
- 'Manfred',
- 'Marshall',
- 'Matt',
- 'Maya',
- 'Mia',
- 'Miles',
- 'Oldbag',
- 'Payne',
- 'Pearl',
- 'Phoenix',
- 'Valant',
- 'Vasquez',
- 'Wellington',
- 'Winston',
- 'Winstonpayne',
- 'Young Mia',
- 'Zak',
+ "Adrian",
+ "Apollo",
+ "April",
+ "Armstrong",
+ "Atmey",
+ "Butz",
+ "Diego",
+ "Edgeworth",
+ "Edgeworthw",
+ "Ema",
+ "Emaskye",
+ "Franny",
+ "Franziska",
+ "Gant",
+ "Gavin",
+ "Gavin K",
+ "Godot",
+ "Gregory",
+ "Grossberg",
+ "Gumshoe",
+ "Gumshoey",
+ "Hawk",
+ "Hobo_Phoenix",
+ "Ini",
+ "Judge",
+ "Judge's Bro",
+ "Klav",
+ "Klavier",
+ "Kristoph",
+ "Lana",
+ "Layton",
+ "Lotta",
+ "Luis",
+ "Maggey",
+ "Manfred",
+ "Marshall",
+ "Matt",
+ "Maya",
+ "Mia",
+ "Miles",
+ "Oldbag",
+ "Payne",
+ "Pearl",
+ "Phoenix",
+ "Valant",
+ "Vasquez",
+ "Wellington",
+ "Winston",
+ "Winstonpayne",
+ "Young Mia",
+ "Zak",
];
diff --git a/webAO/constants/evidence.js b/webAO/constants/evidence.js
index da4933fe..cb60f6a4 100644
--- a/webAO/constants/evidence.js
+++ b/webAO/constants/evidence.js
@@ -1,10 +1,10 @@
export default [
- '1.png',
- '2.png',
- '3.png',
- '4.png',
- '5.png',
- '6.png',
- 'empty.png',
- 'lawyerbadge.png',
+ "1.png",
+ "2.png",
+ "3.png",
+ "4.png",
+ "5.png",
+ "6.png",
+ "empty.png",
+ "lawyerbadge.png",
];
diff --git a/webAO/constants/music.js b/webAO/constants/music.js
index f040554a..83e99843 100644
--- a/webAO/constants/music.js
+++ b/webAO/constants/music.js
@@ -1,51 +1,51 @@
export default [
- 'Announce The Truth (AA).opus',
- 'Announce The Truth (AJ).opus',
- 'Announce The Truth (JFA).opus',
- 'Announce The Truth (Miles).opus',
- 'Announce The Truth (T&T).opus',
- 'Confrontation ~ Presto 2009.opus',
- 'Crises of Fate.opus',
- 'Forgotten Legend.opus',
- 'Godot - The Fragrance of Dark Coffee.opus',
- 'Great Revival ~ Franziska von Karma.opus',
- 'Great Revival ~ Miles Edgeworth.opus',
- 'Hotline of Fate.opus',
- 'Interesting People.opus',
- 'Logic and Trick.opus',
- 'Luke Atmey ~ I Just Want Love.opus',
- 'Noisy People.opus',
- 'OBJECTION (AA).opus',
- 'Objection (AJ).opus',
- 'OBJECTION (JFA).opus',
- 'Objection (Miles).opus',
- 'OBJECTION (T&T).opus',
- 'Others ~ Guilty love.opus',
- 'Prelude (AA).opus',
- 'Prelude (AJ).opus',
- 'Prologue (AA).opus',
- 'Pursuit (AA) - variation.opus',
- 'Pursuit (AA).opus',
- 'Pursuit (AJ).opus',
- 'Pursuit (DS).opus',
- 'Pursuit (JFA) - variation.opus',
- 'Pursuit (JFA).opus',
- 'Pursuit (Miles).opus',
- 'Pursuit (T&T) - variation.opus',
- 'Pursuit (T&T).opus',
- 'Pursuit ~ I Want to Find the Truth (Orchestra).opus',
- 'Questioning AA (Allegro).opus',
- 'Questioning AA (Moderato).opus',
- 'Questioning AJ (Allegro).opus',
- 'Questioning AJ (Moderato).opus',
- 'Questioning JFA (Allegro).opus',
- 'Questioning JFA (Moderato).opus',
- 'Questioning T&T (Allegro).opus',
- 'Questioning T&T (Moderato).opus',
- 'Speak up Pup.opus',
- 'Suspense (AA).opus',
- 'The Great Truth Burglar.opus',
- 'Trial (AA).opus',
- 'Trial (AJ).opus',
- 'Trial (Miles).opus',
+ "Announce The Truth (AA).opus",
+ "Announce The Truth (AJ).opus",
+ "Announce The Truth (JFA).opus",
+ "Announce The Truth (Miles).opus",
+ "Announce The Truth (T&T).opus",
+ "Confrontation ~ Presto 2009.opus",
+ "Crises of Fate.opus",
+ "Forgotten Legend.opus",
+ "Godot - The Fragrance of Dark Coffee.opus",
+ "Great Revival ~ Franziska von Karma.opus",
+ "Great Revival ~ Miles Edgeworth.opus",
+ "Hotline of Fate.opus",
+ "Interesting People.opus",
+ "Logic and Trick.opus",
+ "Luke Atmey ~ I Just Want Love.opus",
+ "Noisy People.opus",
+ "OBJECTION (AA).opus",
+ "Objection (AJ).opus",
+ "OBJECTION (JFA).opus",
+ "Objection (Miles).opus",
+ "OBJECTION (T&T).opus",
+ "Others ~ Guilty love.opus",
+ "Prelude (AA).opus",
+ "Prelude (AJ).opus",
+ "Prologue (AA).opus",
+ "Pursuit (AA) - variation.opus",
+ "Pursuit (AA).opus",
+ "Pursuit (AJ).opus",
+ "Pursuit (DS).opus",
+ "Pursuit (JFA) - variation.opus",
+ "Pursuit (JFA).opus",
+ "Pursuit (Miles).opus",
+ "Pursuit (T&T) - variation.opus",
+ "Pursuit (T&T).opus",
+ "Pursuit ~ I Want to Find the Truth (Orchestra).opus",
+ "Questioning AA (Allegro).opus",
+ "Questioning AA (Moderato).opus",
+ "Questioning AJ (Allegro).opus",
+ "Questioning AJ (Moderato).opus",
+ "Questioning JFA (Allegro).opus",
+ "Questioning JFA (Moderato).opus",
+ "Questioning T&T (Allegro).opus",
+ "Questioning T&T (Moderato).opus",
+ "Speak up Pup.opus",
+ "Suspense (AA).opus",
+ "The Great Truth Burglar.opus",
+ "Trial (AA).opus",
+ "Trial (AJ).opus",
+ "Trial (Miles).opus",
];
diff --git a/webAO/constants/transparentPng.js b/webAO/constants/transparentPng.js
index 452dad91..6905dceb 100644
--- a/webAO/constants/transparentPng.js
+++ b/webAO/constants/transparentPng.js
@@ -1 +1 @@
-export default 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
+export default "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
diff --git a/webAO/dom/changeVolume.js b/webAO/dom/changeVolume.js
index c62d933c..bae82d25 100644
--- a/webAO/dom/changeVolume.js
+++ b/webAO/dom/changeVolume.js
@@ -1,11 +1,11 @@
-import setCookie from '../utils/setCookie.ts';
+import setCookie from "../utils/setCookie.ts";
/**
* Triggered by the sound effect volume slider.
*/
export function changeSFXVolume() {
- setCookie('sfxVolume', document.getElementById('client_sfxaudio').volume);
+ setCookie("sfxVolume", document.getElementById("client_sfxaudio").volume);
}
window.changeSFXVolume = changeSFXVolume;
@@ -13,7 +13,10 @@ window.changeSFXVolume = changeSFXVolume;
* Triggered by the testimony volume slider.
*/
export function changeTestimonyVolume() {
- setCookie('testimonyVolume', document.getElementById('client_testimonyaudio').volume);
+ setCookie(
+ "testimonyVolume",
+ document.getElementById("client_testimonyaudio").volume,
+ );
}
window.changeTestimonyVolume = changeTestimonyVolume;
@@ -22,6 +25,6 @@ window.changeTestimonyVolume = changeTestimonyVolume;
*/
export function changeShoutVolume() {
- setCookie('shoutVolume', document.getElementById('client_shoutaudio').volume);
+ setCookie("shoutVolume", document.getElementById("client_shoutaudio").volume);
}
window.changeShoutVolume = changeShoutVolume;
diff --git a/webAO/dom/toggleEffect.js b/webAO/dom/toggleEffect.js
index d9ba421e..ac83f2c0 100644
--- a/webAO/dom/toggleEffect.js
+++ b/webAO/dom/toggleEffect.js
@@ -6,11 +6,11 @@
* @param {string} effect the new effect to be selected
*/
export function toggleEffect(button) {
- if (button.classList.contains('dark')) {
- button.className = 'client_button';
- } else {
- button.className = 'client_button dark';
- }
+ if (button.classList.contains("dark")) {
+ button.className = "client_button";
+ } else {
+ button.className = "client_button dark";
+ }
}
window.toggleEffect = toggleEffect;
export default toggleEffect;
diff --git a/webAO/dom/toggleElement.js b/webAO/dom/toggleElement.js
index 3d4ceb22..76a1c633 100644
--- a/webAO/dom/toggleElement.js
+++ b/webAO/dom/toggleElement.js
@@ -3,12 +3,12 @@
* @param {string} elementId the id of the element to toggle
*/
export function toggleElement(elementId) {
- const element = document.getElementById(elementId);
- if (element.style.display !== 'none') {
- element.style.display = 'none';
- } else {
- element.style.display = 'block';
- }
+ const element = document.getElementById(elementId);
+ if (element.style.display !== "none") {
+ element.style.display = "none";
+ } else {
+ element.style.display = "block";
+ }
}
window.toggleElement = toggleElement;
export default toggleElement;
diff --git a/webAO/iniParse.js b/webAO/iniParse.js
index d3a9a90f..62eeab00 100644
--- a/webAO/iniParse.js
+++ b/webAO/iniParse.js
@@ -1,42 +1,43 @@
const regexPatterns = {
- section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
- param: /^\s*([\w.\-_]+)\s*=\s*(.*?)\s*$/,
- comment: /^\s*;.*$/,
+ section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
+ param: /^\s*([\w.\-_]+)\s*=\s*(.*?)\s*$/,
+ comment: /^\s*;.*$/,
};
-const valueHandler = (matchKey, matchValue) => (matchKey === 'showname' ? matchValue : matchValue.toLowerCase());
+const valueHandler = (matchKey, matchValue) =>
+ matchKey === "showname" ? matchValue : matchValue.toLowerCase();
const lineFilter = (value) => {
- const isEmpty = value.length === 0;
- const isComment = regexPatterns.comment.test(value);
- if (isComment || isEmpty) {
- return false;
- }
- return true;
+ const isEmpty = value.length === 0;
+ const isComment = regexPatterns.comment.test(value);
+ if (isComment || isEmpty) {
+ return false;
+ }
+ return true;
};
const iniParse = (data) => {
- const parsedIni = {};
- const lines = data.split(/\r\n|\r|\n/);
- const filteredLines = lines.filter(lineFilter);
+ const parsedIni = {};
+ const lines = data.split(/\r\n|\r|\n/);
+ const filteredLines = lines.filter(lineFilter);
- let currentSection;
- filteredLines.forEach((line) => {
- const isParameter = regexPatterns.param.test(line);
- const isSection = regexPatterns.section.test(line);
- if (isParameter && currentSection) {
- const match = line.match(regexPatterns.param);
- const matchKey = match[1].toLowerCase();
- const matchValue = match[2];
- parsedIni[currentSection][matchKey] = valueHandler(matchKey, matchValue);
- } else if (isSection) {
- const match = line.match(regexPatterns.section);
- const matchKey = match[1].toLowerCase();
- parsedIni[matchKey] = {};
- currentSection = matchKey;
- }
- });
- return parsedIni;
+ let currentSection;
+ filteredLines.forEach((line) => {
+ const isParameter = regexPatterns.param.test(line);
+ const isSection = regexPatterns.section.test(line);
+ if (isParameter && currentSection) {
+ const match = line.match(regexPatterns.param);
+ const matchKey = match[1].toLowerCase();
+ const matchValue = match[2];
+ parsedIni[currentSection][matchKey] = valueHandler(matchKey, matchValue);
+ } else if (isSection) {
+ const match = line.match(regexPatterns.section);
+ const matchKey = match[1].toLowerCase();
+ parsedIni[matchKey] = {};
+ currentSection = matchKey;
+ }
+ });
+ return parsedIni;
};
export default iniParse;
diff --git a/webAO/lib/jdataview.min.js b/webAO/lib/jdataview.min.js
index 86f87948..42741a0b 100644
--- a/webAO/lib/jdataview.min.js
+++ b/webAO/lib/jdataview.min.js
@@ -1,118 +1,456 @@
(function (global) {
- const compatibility = { ArrayBuffer: typeof ArrayBuffer !== 'undefined', DataView: typeof DataView !== 'undefined' && ('getFloat64' in DataView.prototype || 'getFloat64' in new DataView(new ArrayBuffer(1))), NodeBuffer: typeof Buffer !== 'undefined' && 'readInt16LE' in Buffer.prototype }; const dataTypes = {
- Int8: 1, Int16: 2, Int32: 4, Uint8: 1, Uint16: 2, Uint32: 4, Float32: 4, Float64: 8,
- }; const nodeNaming = {
- Int8: 'Int8', Int16: 'Int16', Int32: 'Int32', Uint8: 'UInt8', Uint16: 'UInt16', Uint32: 'UInt32', Float32: 'Float', Float64: 'Double',
- }; var jDataView = function (buffer, byteOffset, byteLength, littleEndian) {
- if (!(this instanceof jDataView)) { throw new Error('jDataView constructor may not be called as a function'); }
- this.buffer = buffer; if (!(compatibility.NodeBuffer && buffer instanceof Buffer) && !(compatibility.ArrayBuffer && buffer instanceof ArrayBuffer) && typeof buffer !== 'string') { throw new TypeError('jDataView buffer has an incompatible type'); }
- this._isArrayBuffer = compatibility.ArrayBuffer && buffer instanceof ArrayBuffer; this._isDataView = compatibility.DataView && this._isArrayBuffer; this._isNodeBuffer = compatibility.NodeBuffer && buffer instanceof Buffer; this._littleEndian = littleEndian === undefined ? false : littleEndian; const bufferLength = this._isArrayBuffer ? buffer.byteLength : buffer.length; if (byteOffset === undefined) { byteOffset = 0; }
- this.byteOffset = byteOffset; if (byteLength === undefined) { byteLength = bufferLength - byteOffset; }
- this.byteLength = byteLength; if (!this._isDataView) {
- if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); }
- if (typeof byteLength !== 'number') { throw new TypeError('jDataView byteLength is not a number'); }
- if (byteOffset < 0) { throw new Error('jDataView byteOffset is negative'); }
- if (byteLength < 0) { throw new Error('jDataView byteLength is negative'); }
+ const compatibility = {
+ ArrayBuffer: typeof ArrayBuffer !== "undefined",
+ DataView:
+ typeof DataView !== "undefined" &&
+ ("getFloat64" in DataView.prototype ||
+ "getFloat64" in new DataView(new ArrayBuffer(1))),
+ NodeBuffer:
+ typeof Buffer !== "undefined" && "readInt16LE" in Buffer.prototype,
+ };
+ const dataTypes = {
+ Int8: 1,
+ Int16: 2,
+ Int32: 4,
+ Uint8: 1,
+ Uint16: 2,
+ Uint32: 4,
+ Float32: 4,
+ Float64: 8,
+ };
+ const nodeNaming = {
+ Int8: "Int8",
+ Int16: "Int16",
+ Int32: "Int32",
+ Uint8: "UInt8",
+ Uint16: "UInt16",
+ Uint32: "UInt32",
+ Float32: "Float",
+ Float64: "Double",
+ };
+ var jDataView = function (buffer, byteOffset, byteLength, littleEndian) {
+ if (!(this instanceof jDataView)) {
+ throw new Error("jDataView constructor may not be called as a function");
}
- if (this._isDataView) { this._view = new DataView(buffer, byteOffset, byteLength); this._start = 0; }
- this._start = byteOffset; if (byteOffset + byteLength > bufferLength) { throw new Error('jDataView (byteOffset + byteLength) value is out of bounds'); }
- this._offset = 0; if (this._isDataView) {
+ this.buffer = buffer;
+ if (
+ !(compatibility.NodeBuffer && buffer instanceof Buffer) &&
+ !(compatibility.ArrayBuffer && buffer instanceof ArrayBuffer) &&
+ typeof buffer !== "string"
+ ) {
+ throw new TypeError("jDataView buffer has an incompatible type");
+ }
+ this._isArrayBuffer =
+ compatibility.ArrayBuffer && buffer instanceof ArrayBuffer;
+ this._isDataView = compatibility.DataView && this._isArrayBuffer;
+ this._isNodeBuffer = compatibility.NodeBuffer && buffer instanceof Buffer;
+ this._littleEndian = littleEndian === undefined ? false : littleEndian;
+ const bufferLength = this._isArrayBuffer
+ ? buffer.byteLength
+ : buffer.length;
+ if (byteOffset === undefined) {
+ byteOffset = 0;
+ }
+ this.byteOffset = byteOffset;
+ if (byteLength === undefined) {
+ byteLength = bufferLength - byteOffset;
+ }
+ this.byteLength = byteLength;
+ if (!this._isDataView) {
+ if (typeof byteOffset !== "number") {
+ throw new TypeError("jDataView byteOffset is not a number");
+ }
+ if (typeof byteLength !== "number") {
+ throw new TypeError("jDataView byteLength is not a number");
+ }
+ if (byteOffset < 0) {
+ throw new Error("jDataView byteOffset is negative");
+ }
+ if (byteLength < 0) {
+ throw new Error("jDataView byteLength is negative");
+ }
+ }
+ if (this._isDataView) {
+ this._view = new DataView(buffer, byteOffset, byteLength);
+ this._start = 0;
+ }
+ this._start = byteOffset;
+ if (byteOffset + byteLength > bufferLength) {
+ throw new Error(
+ "jDataView (byteOffset + byteLength) value is out of bounds",
+ );
+ }
+ this._offset = 0;
+ if (this._isDataView) {
for (var type in dataTypes) {
- if (!dataTypes.hasOwnProperty(type)) { continue; }
+ if (!dataTypes.hasOwnProperty(type)) {
+ continue;
+ }
(function (type, view) {
- const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) {
- if (littleEndian === undefined) { littleEndian = view._littleEndian; }
- if (byteOffset === undefined) { byteOffset = view._offset; }
- view._offset = byteOffset + size; return view._view[`get${type}`](byteOffset, littleEndian);
+ const size = dataTypes[type];
+ view[`get${type}`] = function (byteOffset, littleEndian) {
+ if (littleEndian === undefined) {
+ littleEndian = view._littleEndian;
+ }
+ if (byteOffset === undefined) {
+ byteOffset = view._offset;
+ }
+ view._offset = byteOffset + size;
+ return view._view[`get${type}`](byteOffset, littleEndian);
};
- }(type, this));
+ })(type, this);
}
} else if (this._isNodeBuffer && compatibility.NodeBuffer) {
for (var type in dataTypes) {
- if (!dataTypes.hasOwnProperty(type)) { continue; }
- var name; if (type === 'Int8' || type === 'Uint8') { name = `read${nodeNaming[type]}`; } else if (littleEndian) { name = `read${nodeNaming[type]}LE`; } else { name = `read${nodeNaming[type]}BE`; }
+ if (!dataTypes.hasOwnProperty(type)) {
+ continue;
+ }
+ var name;
+ if (type === "Int8" || type === "Uint8") {
+ name = `read${nodeNaming[type]}`;
+ } else if (littleEndian) {
+ name = `read${nodeNaming[type]}LE`;
+ } else {
+ name = `read${nodeNaming[type]}BE`;
+ }
(function (type, view, name) {
- const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) {
- if (littleEndian === undefined) { littleEndian = view._littleEndian; }
- if (byteOffset === undefined) { byteOffset = view._offset; }
- view._offset = byteOffset + size; return view.buffer[name](view._start + byteOffset);
+ const size = dataTypes[type];
+ view[`get${type}`] = function (byteOffset, littleEndian) {
+ if (littleEndian === undefined) {
+ littleEndian = view._littleEndian;
+ }
+ if (byteOffset === undefined) {
+ byteOffset = view._offset;
+ }
+ view._offset = byteOffset + size;
+ return view.buffer[name](view._start + byteOffset);
};
- }(type, this, name));
+ })(type, this, name);
}
} else {
for (var type in dataTypes) {
- if (!dataTypes.hasOwnProperty(type)) { continue; }
+ if (!dataTypes.hasOwnProperty(type)) {
+ continue;
+ }
(function (type, view) {
- const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) {
- if (littleEndian === undefined) { littleEndian = view._littleEndian; }
- if (byteOffset === undefined) { byteOffset = view._offset; }
- view._offset = byteOffset + size; if (view._isArrayBuffer && (view._start + byteOffset) % size === 0 && (size === 1 || littleEndian)) { return new global[`${type}Array`](view.buffer, view._start + byteOffset, 1)[0]; } if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); }
- if (byteOffset + size > view.byteLength) { throw new Error('jDataView (byteOffset + size) value is out of bounds'); }
+ const size = dataTypes[type];
+ view[`get${type}`] = function (byteOffset, littleEndian) {
+ if (littleEndian === undefined) {
+ littleEndian = view._littleEndian;
+ }
+ if (byteOffset === undefined) {
+ byteOffset = view._offset;
+ }
+ view._offset = byteOffset + size;
+ if (
+ view._isArrayBuffer &&
+ (view._start + byteOffset) % size === 0 &&
+ (size === 1 || littleEndian)
+ ) {
+ return new global[`${type}Array`](
+ view.buffer,
+ view._start + byteOffset,
+ 1,
+ )[0];
+ }
+ if (typeof byteOffset !== "number") {
+ throw new TypeError("jDataView byteOffset is not a number");
+ }
+ if (byteOffset + size > view.byteLength) {
+ throw new Error(
+ "jDataView (byteOffset + size) value is out of bounds",
+ );
+ }
return view[`_get${type}`](view._start + byteOffset, littleEndian);
};
- }(type, this));
+ })(type, this);
}
}
- }; if (compatibility.NodeBuffer) {
+ };
+ if (compatibility.NodeBuffer) {
jDataView.createBuffer = function () {
- const buffer = new Buffer(arguments.length); for (let i = 0; i < arguments.length; ++i) { buffer[i] = arguments[i]; }
+ const buffer = new Buffer(arguments.length);
+ for (let i = 0; i < arguments.length; ++i) {
+ buffer[i] = arguments[i];
+ }
return buffer;
};
} else if (compatibility.ArrayBuffer) {
jDataView.createBuffer = function () {
- const buffer = new ArrayBuffer(arguments.length); const view = new Int8Array(buffer); for (let i = 0; i < arguments.length; ++i) { view[i] = arguments[i]; }
+ const buffer = new ArrayBuffer(arguments.length);
+ const view = new Int8Array(buffer);
+ for (let i = 0; i < arguments.length; ++i) {
+ view[i] = arguments[i];
+ }
return buffer;
};
- } else { jDataView.createBuffer = function () { return String.fromCharCode.apply(null, arguments); }; }
+ } else {
+ jDataView.createBuffer = function () {
+ return String.fromCharCode.apply(null, arguments);
+ };
+ }
jDataView.prototype = {
compatibility,
getString(length, byteOffset) {
- let value; if (byteOffset === undefined) { byteOffset = this._offset; }
- if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); }
- if (length < 0 || byteOffset + length > this.byteLength) { throw new Error('jDataView length or (byteOffset+length) value is out of bounds'); }
- if (this._isNodeBuffer) { value = this.buffer.toString('ascii', this._start + byteOffset, this._start + byteOffset + length); } else { value = ''; for (let i = 0; i < length; ++i) { const char = this.getUint8(byteOffset + i); value += String.fromCharCode(char > 127 ? 65533 : char); } }
- this._offset = byteOffset + length; return value;
+ let value;
+ if (byteOffset === undefined) {
+ byteOffset = this._offset;
+ }
+ if (typeof byteOffset !== "number") {
+ throw new TypeError("jDataView byteOffset is not a number");
+ }
+ if (length < 0 || byteOffset + length > this.byteLength) {
+ throw new Error(
+ "jDataView length or (byteOffset+length) value is out of bounds",
+ );
+ }
+ if (this._isNodeBuffer) {
+ value = this.buffer.toString(
+ "ascii",
+ this._start + byteOffset,
+ this._start + byteOffset + length,
+ );
+ } else {
+ value = "";
+ for (let i = 0; i < length; ++i) {
+ const char = this.getUint8(byteOffset + i);
+ value += String.fromCharCode(char > 127 ? 65533 : char);
+ }
+ }
+ this._offset = byteOffset + length;
+ return value;
+ },
+ getChar(byteOffset) {
+ return this.getString(1, byteOffset);
+ },
+ tell() {
+ return this._offset;
},
- getChar(byteOffset) { return this.getString(1, byteOffset); },
- tell() { return this._offset; },
seek(byteOffset) {
- if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); }
- if (byteOffset < 0 || byteOffset > this.byteLength) { throw new Error('jDataView byteOffset value is out of bounds'); }
- return this._offset = byteOffset;
+ if (typeof byteOffset !== "number") {
+ throw new TypeError("jDataView byteOffset is not a number");
+ }
+ if (byteOffset < 0 || byteOffset > this.byteLength) {
+ throw new Error("jDataView byteOffset value is out of bounds");
+ }
+ return (this._offset = byteOffset);
+ },
+ _endianness(byteOffset, pos, max, littleEndian) {
+ return byteOffset + (littleEndian ? max - pos - 1 : pos);
},
- _endianness(byteOffset, pos, max, littleEndian) { return byteOffset + (littleEndian ? max - pos - 1 : pos); },
_getFloat64(byteOffset, littleEndian) {
- const b0 = this._getUint8(this._endianness(byteOffset, 0, 8, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 1, 8, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 2, 8, littleEndian)); const b3 = this._getUint8(this._endianness(byteOffset, 3, 8, littleEndian)); const b4 = this._getUint8(this._endianness(byteOffset, 4, 8, littleEndian)); const b5 = this._getUint8(this._endianness(byteOffset, 5, 8, littleEndian)); const b6 = this._getUint8(this._endianness(byteOffset, 6, 8, littleEndian)); const b7 = this._getUint8(this._endianness(byteOffset, 7, 8, littleEndian)); const sign = 1 - (2 * (b0 >> 7)); const exponent = ((((b0 << 1) & 0xff) << 3) | (b1 >> 4)) - (2 ** 10 - 1); const mantissa = ((b1 & 0x0f) * 2 ** 48) + (b2 * 2 ** 40) + (b3 * 2 ** 32)
-+ (b4 * 2 ** 24) + (b5 * 2 ** 16) + (b6 * 2 ** 8) + b7; if (exponent === 1024) { if (mantissa !== 0) { return NaN; } return sign * Infinity; }
- if (exponent === -1023) { return sign * mantissa * 2 ** (-1022 - 52); }
+ const b0 = this._getUint8(
+ this._endianness(byteOffset, 0, 8, littleEndian),
+ );
+ const b1 = this._getUint8(
+ this._endianness(byteOffset, 1, 8, littleEndian),
+ );
+ const b2 = this._getUint8(
+ this._endianness(byteOffset, 2, 8, littleEndian),
+ );
+ const b3 = this._getUint8(
+ this._endianness(byteOffset, 3, 8, littleEndian),
+ );
+ const b4 = this._getUint8(
+ this._endianness(byteOffset, 4, 8, littleEndian),
+ );
+ const b5 = this._getUint8(
+ this._endianness(byteOffset, 5, 8, littleEndian),
+ );
+ const b6 = this._getUint8(
+ this._endianness(byteOffset, 6, 8, littleEndian),
+ );
+ const b7 = this._getUint8(
+ this._endianness(byteOffset, 7, 8, littleEndian),
+ );
+ const sign = 1 - 2 * (b0 >> 7);
+ const exponent = ((((b0 << 1) & 0xff) << 3) | (b1 >> 4)) - (2 ** 10 - 1);
+ const mantissa =
+ (b1 & 0x0f) * 2 ** 48 +
+ b2 * 2 ** 40 +
+ b3 * 2 ** 32 +
+ b4 * 2 ** 24 +
+ b5 * 2 ** 16 +
+ b6 * 2 ** 8 +
+ b7;
+ if (exponent === 1024) {
+ if (mantissa !== 0) {
+ return NaN;
+ }
+ return sign * Infinity;
+ }
+ if (exponent === -1023) {
+ return sign * mantissa * 2 ** (-1022 - 52);
+ }
return sign * (1 + mantissa * 2 ** -52) * 2 ** exponent;
},
_getFloat32(byteOffset, littleEndian) {
- const b0 = this._getUint8(this._endianness(byteOffset, 0, 4, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 1, 4, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 2, 4, littleEndian)); const b3 = this._getUint8(this._endianness(byteOffset, 3, 4, littleEndian)); const sign = 1 - (2 * (b0 >> 7)); const exponent = (((b0 << 1) & 0xff) | (b1 >> 7)) - 127; const mantissa = ((b1 & 0x7f) << 16) | (b2 << 8) | b3; if (exponent === 128) { if (mantissa !== 0) { return NaN; } return sign * Infinity; }
- if (exponent === -127) { return sign * mantissa * 2 ** (-126 - 23); }
+ const b0 = this._getUint8(
+ this._endianness(byteOffset, 0, 4, littleEndian),
+ );
+ const b1 = this._getUint8(
+ this._endianness(byteOffset, 1, 4, littleEndian),
+ );
+ const b2 = this._getUint8(
+ this._endianness(byteOffset, 2, 4, littleEndian),
+ );
+ const b3 = this._getUint8(
+ this._endianness(byteOffset, 3, 4, littleEndian),
+ );
+ const sign = 1 - 2 * (b0 >> 7);
+ const exponent = (((b0 << 1) & 0xff) | (b1 >> 7)) - 127;
+ const mantissa = ((b1 & 0x7f) << 16) | (b2 << 8) | b3;
+ if (exponent === 128) {
+ if (mantissa !== 0) {
+ return NaN;
+ }
+ return sign * Infinity;
+ }
+ if (exponent === -127) {
+ return sign * mantissa * 2 ** (-126 - 23);
+ }
return sign * (1 + mantissa * 2 ** -23) * 2 ** exponent;
},
- _getInt32(byteOffset, littleEndian) { const b = this._getUint32(byteOffset, littleEndian); return b > 2 ** 31 - 1 ? b - 2 ** 32 : b; },
- _getUint32(byteOffset, littleEndian) { const b3 = this._getUint8(this._endianness(byteOffset, 0, 4, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 1, 4, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 2, 4, littleEndian)); const b0 = this._getUint8(this._endianness(byteOffset, 3, 4, littleEndian)); return (b3 * 2 ** 24) + (b2 << 16) + (b1 << 8) + b0; },
- _getInt16(byteOffset, littleEndian) { const b = this._getUint16(byteOffset, littleEndian); return b > 2 ** 15 - 1 ? b - 2 ** 16 : b; },
- _getUint16(byteOffset, littleEndian) { const b1 = this._getUint8(this._endianness(byteOffset, 0, 2, littleEndian)); const b0 = this._getUint8(this._endianness(byteOffset, 1, 2, littleEndian)); return (b1 << 8) + b0; },
- _getInt8(byteOffset) { const b = this._getUint8(byteOffset); return b > 2 ** 7 - 1 ? b - 2 ** 8 : b; },
- _getUint8(byteOffset) { if (this._isArrayBuffer) { return new Uint8Array(this.buffer, byteOffset, 1)[0]; } if (this._isNodeBuffer) { return this.buffer[byteOffset]; } return this.buffer.charCodeAt(byteOffset) & 0xff; },
- }; if (typeof jQuery !== 'undefined' && jQuery.fn.jquery >= '1.6.2') {
+ _getInt32(byteOffset, littleEndian) {
+ const b = this._getUint32(byteOffset, littleEndian);
+ return b > 2 ** 31 - 1 ? b - 2 ** 32 : b;
+ },
+ _getUint32(byteOffset, littleEndian) {
+ const b3 = this._getUint8(
+ this._endianness(byteOffset, 0, 4, littleEndian),
+ );
+ const b2 = this._getUint8(
+ this._endianness(byteOffset, 1, 4, littleEndian),
+ );
+ const b1 = this._getUint8(
+ this._endianness(byteOffset, 2, 4, littleEndian),
+ );
+ const b0 = this._getUint8(
+ this._endianness(byteOffset, 3, 4, littleEndian),
+ );
+ return b3 * 2 ** 24 + (b2 << 16) + (b1 << 8) + b0;
+ },
+ _getInt16(byteOffset, littleEndian) {
+ const b = this._getUint16(byteOffset, littleEndian);
+ return b > 2 ** 15 - 1 ? b - 2 ** 16 : b;
+ },
+ _getUint16(byteOffset, littleEndian) {
+ const b1 = this._getUint8(
+ this._endianness(byteOffset, 0, 2, littleEndian),
+ );
+ const b0 = this._getUint8(
+ this._endianness(byteOffset, 1, 2, littleEndian),
+ );
+ return (b1 << 8) + b0;
+ },
+ _getInt8(byteOffset) {
+ const b = this._getUint8(byteOffset);
+ return b > 2 ** 7 - 1 ? b - 2 ** 8 : b;
+ },
+ _getUint8(byteOffset) {
+ if (this._isArrayBuffer) {
+ return new Uint8Array(this.buffer, byteOffset, 1)[0];
+ }
+ if (this._isNodeBuffer) {
+ return this.buffer[byteOffset];
+ }
+ return this.buffer.charCodeAt(byteOffset) & 0xff;
+ },
+ };
+ if (typeof jQuery !== "undefined" && jQuery.fn.jquery >= "1.6.2") {
const convertResponseBodyToText = function (byteArray) {
- let scrambledStr; try { scrambledStr = IEBinaryToArray_ByteStr(byteArray); } catch (e) { const IEBinaryToArray_ByteStr_Script = 'Function IEBinaryToArray_ByteStr(Binary)\r\n' + ' IEBinaryToArray_ByteStr = CStr(Binary)\r\n' + 'End Function\r\n' + 'Function IEBinaryToArray_ByteStr_Last(Binary)\r\n' + ' Dim lastIndex\r\n' + ' lastIndex = LenB(Binary)\r\n' + ' if lastIndex mod 2 Then\r\n' + ' IEBinaryToArray_ByteStr_Last = AscB( MidB( Binary, lastIndex, 1 ) )\r\n' + ' Else\r\n' + ' IEBinaryToArray_ByteStr_Last = -1\r\n' + ' End If\r\n' + 'End Function\r\n'; window.execScript(IEBinaryToArray_ByteStr_Script, 'vbscript'); scrambledStr = IEBinaryToArray_ByteStr(byteArray); }
- const lastChr = IEBinaryToArray_ByteStr_Last(byteArray); let result = ''; let i = 0; let l = scrambledStr.length % 8; let thischar; while (i < l) { thischar = scrambledStr.charCodeAt(i++); result += String.fromCharCode(thischar & 0xff, thischar >> 8); }
+ let scrambledStr;
+ try {
+ scrambledStr = IEBinaryToArray_ByteStr(byteArray);
+ } catch (e) {
+ const IEBinaryToArray_ByteStr_Script =
+ "Function IEBinaryToArray_ByteStr(Binary)\r\n" +
+ " IEBinaryToArray_ByteStr = CStr(Binary)\r\n" +
+ "End Function\r\n" +
+ "Function IEBinaryToArray_ByteStr_Last(Binary)\r\n" +
+ " Dim lastIndex\r\n" +
+ " lastIndex = LenB(Binary)\r\n" +
+ " if lastIndex mod 2 Then\r\n" +
+ " IEBinaryToArray_ByteStr_Last = AscB( MidB( Binary, lastIndex, 1 ) )\r\n" +
+ " Else\r\n" +
+ " IEBinaryToArray_ByteStr_Last = -1\r\n" +
+ " End If\r\n" +
+ "End Function\r\n";
+ window.execScript(IEBinaryToArray_ByteStr_Script, "vbscript");
+ scrambledStr = IEBinaryToArray_ByteStr(byteArray);
+ }
+ const lastChr = IEBinaryToArray_ByteStr_Last(byteArray);
+ let result = "";
+ let i = 0;
+ let l = scrambledStr.length % 8;
+ let thischar;
+ while (i < l) {
+ thischar = scrambledStr.charCodeAt(i++);
+ result += String.fromCharCode(thischar & 0xff, thischar >> 8);
+ }
l = scrambledStr.length;
- while (i < l) { result += String.fromCharCode((thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8); }
- if (lastChr > -1) { result += String.fromCharCode(lastChr); }
+ while (i < l) {
+ result += String.fromCharCode(
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ ((thischar = scrambledStr.charCodeAt(i++)), thischar & 0xff),
+ thischar >> 8,
+ );
+ }
+ if (lastChr > -1) {
+ result += String.fromCharCode(lastChr);
+ }
return result;
- }; jQuery.ajaxSetup({ converters: { '* dataview': function (data) { return new jDataView(data); } }, accepts: { dataview: 'text/plain; charset=x-user-defined' }, responseHandler: { dataview(responses, options, xhr) { if ('mozResponseArrayBuffer' in xhr) { responses.text = xhr.mozResponseArrayBuffer; } else if ('responseType' in xhr && xhr.responseType === 'arraybuffer' && xhr.response) { responses.text = xhr.response; } else if ('responseBody' in xhr) { responses.text = convertResponseBodyToText(xhr.responseBody); } else { responses.text = xhr.responseText; } } } }); jQuery.ajaxPrefilter('dataview', (options, originalOptions, jqXHR) => {
+ };
+ jQuery.ajaxSetup({
+ converters: {
+ "* dataview": function (data) {
+ return new jDataView(data);
+ },
+ },
+ accepts: { dataview: "text/plain; charset=x-user-defined" },
+ responseHandler: {
+ dataview(responses, options, xhr) {
+ if ("mozResponseArrayBuffer" in xhr) {
+ responses.text = xhr.mozResponseArrayBuffer;
+ } else if (
+ "responseType" in xhr &&
+ xhr.responseType === "arraybuffer" &&
+ xhr.response
+ ) {
+ responses.text = xhr.response;
+ } else if ("responseBody" in xhr) {
+ responses.text = convertResponseBodyToText(xhr.responseBody);
+ } else {
+ responses.text = xhr.responseText;
+ }
+ },
+ },
+ });
+ jQuery.ajaxPrefilter("dataview", (options, originalOptions, jqXHR) => {
if (jQuery.support.ajaxResponseType) {
- if (!options.hasOwnProperty('xhrFields')) { options.xhrFields = {}; }
- options.xhrFields.responseType = 'arraybuffer';
+ if (!options.hasOwnProperty("xhrFields")) {
+ options.xhrFields = {};
+ }
+ options.xhrFields.responseType = "arraybuffer";
}
- options.mimeType = 'text/plain; charset=x-user-defined';
+ options.mimeType = "text/plain; charset=x-user-defined";
});
}
- global.jDataView = (global.module || {}).exports = jDataView; if (typeof module !== 'undefined') { module.exports = jDataView; }
-}(this));
+ global.jDataView = (global.module || {}).exports = jDataView;
+ if (typeof module !== "undefined") {
+ module.exports = jDataView;
+ }
+})(this);
diff --git a/webAO/lib/jquery.ui.touch-punch.min.js b/webAO/lib/jquery.ui.touch-punch.min.js
index d572ab6f..40e32d71 100644
--- a/webAO/lib/jquery.ui.touch-punch.min.js
+++ b/webAO/lib/jquery.ui.touch-punch.min.js
@@ -8,4 +8,74 @@
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
-!(function (a) { function f(a, b) { if (!(a.originalEvent.touches.length > 1)) { a.preventDefault(); const c = a.originalEvent.changedTouches[0]; const d = document.createEvent('MouseEvents'); d.initMouseEvent(b, !0, !0, window, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null), a.target.dispatchEvent(d); } } if (a.support.touch = 'ontouchend' in document, a.support.touch) { let e; const b = a.ui.mouse.prototype; const c = b._mouseInit; const d = b._mouseDestroy; b._touchStart = function (a) { const b = this; !e && b._mouseCapture(a.originalEvent.changedTouches[0]) && (e = !0, b._touchMoved = !1, f(a, 'mouseover'), f(a, 'mousemove'), f(a, 'mousedown')); }, b._touchMove = function (a) { e && (this._touchMoved = !0, f(a, 'mousemove')); }, b._touchEnd = function (a) { e && (f(a, 'mouseup'), f(a, 'mouseout'), this._touchMoved || f(a, 'click'), e = !1); }, b._mouseInit = function () { const b = this; b.element.bind({ touchstart: a.proxy(b, '_touchStart'), touchmove: a.proxy(b, '_touchMove'), touchend: a.proxy(b, '_touchEnd') }), c.call(b); }, b._mouseDestroy = function () { const b = this; b.element.unbind({ touchstart: a.proxy(b, '_touchStart'), touchmove: a.proxy(b, '_touchMove'), touchend: a.proxy(b, '_touchEnd') }), d.call(b); }; } }(jQuery));
+!(function (a) {
+ function f(a, b) {
+ if (!(a.originalEvent.touches.length > 1)) {
+ a.preventDefault();
+ const c = a.originalEvent.changedTouches[0];
+ const d = document.createEvent("MouseEvents");
+ d.initMouseEvent(
+ b,
+ !0,
+ !0,
+ window,
+ 1,
+ c.screenX,
+ c.screenY,
+ c.clientX,
+ c.clientY,
+ !1,
+ !1,
+ !1,
+ !1,
+ 0,
+ null,
+ ),
+ a.target.dispatchEvent(d);
+ }
+ }
+ if (((a.support.touch = "ontouchend" in document), a.support.touch)) {
+ let e;
+ const b = a.ui.mouse.prototype;
+ const c = b._mouseInit;
+ const d = b._mouseDestroy;
+ (b._touchStart = function (a) {
+ const b = this;
+ !e &&
+ b._mouseCapture(a.originalEvent.changedTouches[0]) &&
+ ((e = !0),
+ (b._touchMoved = !1),
+ f(a, "mouseover"),
+ f(a, "mousemove"),
+ f(a, "mousedown"));
+ }),
+ (b._touchMove = function (a) {
+ e && ((this._touchMoved = !0), f(a, "mousemove"));
+ }),
+ (b._touchEnd = function (a) {
+ e &&
+ (f(a, "mouseup"),
+ f(a, "mouseout"),
+ this._touchMoved || f(a, "click"),
+ (e = !1));
+ }),
+ (b._mouseInit = function () {
+ const b = this;
+ b.element.bind({
+ touchstart: a.proxy(b, "_touchStart"),
+ touchmove: a.proxy(b, "_touchMove"),
+ touchend: a.proxy(b, "_touchEnd"),
+ }),
+ c.call(b);
+ }),
+ (b._mouseDestroy = function () {
+ const b = this;
+ b.element.unbind({
+ touchstart: a.proxy(b, "_touchStart"),
+ touchmove: a.proxy(b, "_touchMove"),
+ touchend: a.proxy(b, "_touchEnd"),
+ }),
+ d.call(b);
+ });
+ }
+})(jQuery);
diff --git a/webAO/services/request.js b/webAO/services/request.js
index 25a85673..0d706d41 100644
--- a/webAO/services/request.js
+++ b/webAO/services/request.js
@@ -5,31 +5,33 @@
* @throws {Error} if status code is not 2xx, or a network error occurs
*/
export async function requestBuffer(url) {
- return new Promise((resolve, reject) => {
- const xhr = new XMLHttpRequest();
- xhr.responseType = 'arraybuffer';
- xhr.addEventListener('error', () => {
- const err = new Error(`Request for ${url} failed: ${xhr.statusText}`);
- err.code = xhr.status;
- reject(err);
- });
- xhr.addEventListener('abort', () => {
- const err = new Error(`Request for ${url} was aborted!`);
- err.code = xhr.status;
- reject(err);
- });
- xhr.addEventListener('load', () => {
- if (xhr.status < 200 || xhr.status >= 300) {
- const err = new Error(`Request for ${url} failed with status code ${xhr.status}`);
- err.code = xhr.status;
- reject(err);
- } else {
- resolve(xhr.response);
- }
- });
- xhr.open('GET', url, true);
- xhr.send();
+ return new Promise((resolve, reject) => {
+ const xhr = new XMLHttpRequest();
+ xhr.responseType = "arraybuffer";
+ xhr.addEventListener("error", () => {
+ const err = new Error(`Request for ${url} failed: ${xhr.statusText}`);
+ err.code = xhr.status;
+ reject(err);
+ });
+ xhr.addEventListener("abort", () => {
+ const err = new Error(`Request for ${url} was aborted!`);
+ err.code = xhr.status;
+ reject(err);
+ });
+ xhr.addEventListener("load", () => {
+ if (xhr.status < 200 || xhr.status >= 300) {
+ const err = new Error(
+ `Request for ${url} failed with status code ${xhr.status}`,
+ );
+ err.code = xhr.status;
+ reject(err);
+ } else {
+ resolve(xhr.response);
+ }
});
+ xhr.open("GET", url, true);
+ xhr.send();
+ });
}
/**
@@ -38,29 +40,32 @@ export async function requestBuffer(url) {
* @returns response data
* @throws {Error} if status code is not 2xx, or a network error occurs
*/
-export const request = async (url) => new Promise((resolve, reject) => {
+export const request = async (url) =>
+ new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
- xhr.responseType = 'text';
- xhr.addEventListener('error', () => {
- const err = new Error(`Request for ${url} failed: ${xhr.statusText}`);
- err.code = xhr.status;
- reject(err);
+ xhr.responseType = "text";
+ xhr.addEventListener("error", () => {
+ const err = new Error(`Request for ${url} failed: ${xhr.statusText}`);
+ err.code = xhr.status;
+ reject(err);
});
- xhr.addEventListener('abort', () => {
- const err = new Error(`Request for ${url} was aborted!`);
+ xhr.addEventListener("abort", () => {
+ const err = new Error(`Request for ${url} was aborted!`);
+ err.code = xhr.status;
+ reject(err);
+ });
+ xhr.addEventListener("load", () => {
+ if (xhr.status < 200 || xhr.status >= 300) {
+ const err = new Error(
+ `Request for ${url} failed with status code ${xhr.status}`,
+ );
err.code = xhr.status;
reject(err);
+ } else {
+ resolve(xhr.response);
+ }
});
- xhr.addEventListener('load', () => {
- if (xhr.status < 200 || xhr.status >= 300) {
- const err = new Error(`Request for ${url} failed with status code ${xhr.status}`);
- err.code = xhr.status;
- reject(err);
- } else {
- resolve(xhr.response);
- }
- });
- xhr.open('GET', url, true);
+ xhr.open("GET", url, true);
xhr.send();
-});
+ });
export default request;
diff --git a/webAO/styles/chatbox/chatboxes.js b/webAO/styles/chatbox/chatboxes.js
index 5dc70e01..f8b4fe2c 100644
--- a/webAO/styles/chatbox/chatboxes.js
+++ b/webAO/styles/chatbox/chatboxes.js
@@ -1,28 +1,28 @@
export default [
- 'aa',
- 'acww',
- 'dd',
- 'dgs',
- 'plvsaa',
- 'trilogy',
- 'future',
- 'legacy',
- 'ddlc',
- 'dr1',
- 'dr2',
- 'drv3',
- 'drae',
- 'p3',
- 'p4',
- 'p5',
- '999',
- 'halla',
- 'homestuck',
- 'key',
- 'sonic',
- 'yakuza',
- 'yttd',
- 'whentheycry',
- 'n64zelda',
- 'papermario',
+ "aa",
+ "acww",
+ "dd",
+ "dgs",
+ "plvsaa",
+ "trilogy",
+ "future",
+ "legacy",
+ "ddlc",
+ "dr1",
+ "dr2",
+ "drv3",
+ "drae",
+ "p3",
+ "p4",
+ "p5",
+ "999",
+ "halla",
+ "homestuck",
+ "key",
+ "sonic",
+ "yakuza",
+ "yttd",
+ "whentheycry",
+ "n64zelda",
+ "papermario",
];
diff --git a/webAO/ui.js b/webAO/ui.js
index 3342a096..81b41e8d 100644
--- a/webAO/ui.js
+++ b/webAO/ui.js
@@ -1,7 +1,7 @@
/* eslint indent: ["error", 2, { "SwitchCase": 1 }] */
/* eslint no-param-reassign: ["error",
{ "props": true, "ignorePropertyModificationsFor": ["container"] }] */
-import { GoldenLayout } from 'golden-layout';
+import { GoldenLayout } from "golden-layout";
const config = {
settings: {
@@ -11,83 +11,98 @@ const config = {
dimensions: {
minItemHeight: 40,
},
- content: [{
- type: 'row',
- content: [{
- type: 'column',
- width: 40,
- content: [{
- type: 'component',
- height: 80,
- isClosable: false,
- componentName: 'template',
- title: 'IC',
- componentState: { id: 'client_wrapper' },
- },
- {
- type: 'component',
- height: 20,
- isClosable: false,
- title: 'IC Options',
- componentName: 'template',
- componentState: { id: 'icoptions' },
- }]
- },
+ content: [
{
- type: 'column',
- content: [{
- type: 'row',
- height: 65,
- content: [{
- type: 'stack',
- content: [{
- type: 'component',
- isClosable: false,
- title: 'Main',
- componentName: 'template',
- componentState: { id: 'mainmenu' },
- },
- {
- type: 'component',
- isClosable: false,
- title: 'Log',
- componentName: 'template',
- componentState: { id: 'log' },
- }],
+ type: "row",
+ content: [
+ {
+ type: "column",
+ width: 40,
+ content: [
+ {
+ type: "component",
+ height: 80,
+ isClosable: false,
+ componentName: "template",
+ title: "IC",
+ componentState: { id: "client_wrapper" },
+ },
+ {
+ type: "component",
+ height: 20,
+ isClosable: false,
+ title: "IC Options",
+ componentName: "template",
+ componentState: { id: "icoptions" },
+ },
+ ],
},
{
- type: 'stack',
- width: 30,
- content: [{
- type: 'component',
- isClosable: false,
- title: 'Music',
- componentName: 'template',
- componentState: { id: 'music' },
- },
- {
- type: 'component',
- isClosable: true,
- title: 'Players',
- componentName: 'template',
- componentState: { id: 'players' },
- }],
- }],
- },
- {
- type: 'row',
- content: [{
- type: 'component',
- title: 'OOC',
- componentName: 'template',
- componentState: { id: 'ooc' },
- }],
- }],
- }],
- }],
+ type: "column",
+ content: [
+ {
+ type: "row",
+ height: 65,
+ content: [
+ {
+ type: "stack",
+ content: [
+ {
+ type: "component",
+ isClosable: false,
+ title: "Main",
+ componentName: "template",
+ componentState: { id: "mainmenu" },
+ },
+ {
+ type: "component",
+ isClosable: false,
+ title: "Log",
+ componentName: "template",
+ componentState: { id: "log" },
+ },
+ ],
+ },
+ {
+ type: "stack",
+ width: 30,
+ content: [
+ {
+ type: "component",
+ isClosable: false,
+ title: "Music",
+ componentName: "template",
+ componentState: { id: "music" },
+ },
+ {
+ type: "component",
+ isClosable: true,
+ title: "Players",
+ componentName: "template",
+ componentState: { id: "players" },
+ },
+ ],
+ },
+ ],
+ },
+ {
+ type: "row",
+ content: [
+ {
+ type: "component",
+ title: "OOC",
+ componentName: "template",
+ componentState: { id: "ooc" },
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ ],
};
-
const configMobile = {
settings: {
showPopoutIcon: false,
@@ -96,92 +111,104 @@ const configMobile = {
dimensions: {
minItemHeight: 40,
},
- content: [{
- type: 'row',
- content: [{
- type: 'column',
- content: [{
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- componentName: 'template',
- title: 'IC',
- componentState: { id: 'client_wrapper' },
- height: 56 // Adjust the height proportion as needed
- },
- {
- type: 'stack',
- height: 44,
- content: [{
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- title: 'IC Options',
- componentName: 'template',
- componentState: { id: 'icoptions' },
- },
- {
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- title: 'Main',
- componentName: 'template',
- componentState: { id: 'mainmenu' },
- },
- {
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- title: 'Log',
- componentName: 'template',
- componentState: { id: 'log' },
- },
- {
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- title: 'Music',
- componentName: 'template',
- componentState: { id: 'music' },
- },
+ content: [
+ {
+ type: "row",
+ content: [
{
- type: 'component',
- isClosable: true,
- title: 'Players',
- componentName: 'template',
- componentState: { id: 'players' },
+ type: "column",
+ content: [
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ componentName: "template",
+ title: "IC",
+ componentState: { id: "client_wrapper" },
+ height: 56, // Adjust the height proportion as needed
+ },
+ {
+ type: "stack",
+ height: 44,
+ content: [
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ title: "IC Options",
+ componentName: "template",
+ componentState: { id: "icoptions" },
+ },
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ title: "Main",
+ componentName: "template",
+ componentState: { id: "mainmenu" },
+ },
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ title: "Log",
+ componentName: "template",
+ componentState: { id: "log" },
+ },
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ title: "Music",
+ componentName: "template",
+ componentState: { id: "music" },
+ },
+ {
+ type: "component",
+ isClosable: true,
+ title: "Players",
+ componentName: "template",
+ componentState: { id: "players" },
+ },
+ {
+ type: "component",
+ isClosable: false,
+ reorderEnabled: false,
+ title: "OOC",
+ componentName: "template",
+ componentState: { id: "ooc" },
+ },
+ ],
+ },
+ ],
},
- {
- type: 'component',
- isClosable: false,
- reorderEnabled: false,
- title: 'OOC',
- componentName: 'template',
- componentState: { id: 'ooc' },
- }]
- }]
- }]
- }]
-}
-
+ ],
+ },
+ ],
+};
-const isMobileDevice = window.innerWidth <= window.innerHeight;
+const isMobileDevice = window.innerWidth <= window.innerHeight;
const golden = new GoldenLayout();
-golden.registerComponentFactoryFunction('template', (container, componentState) => {
- const template = document.querySelector(`#${componentState.id}`);
- container.element.innerHTML = template.innerHTML;
-});
-if (isMobileDevice){
+golden.registerComponentFactoryFunction(
+ "template",
+ (container, componentState) => {
+ const template = document.querySelector(`#${componentState.id}`);
+ container.element.innerHTML = template.innerHTML;
+ },
+);
+if (isMobileDevice) {
golden.loadLayout(configMobile);
-}
-else {
+} else {
golden.loadLayout(config);
}
console.log(golden.root.contentItems[0].contentItems[0].contentItems[0]);
-golden.root.contentItems[0].contentItems[0].contentItems[0].on('resize',function(){
- console.log("IC pane resized"); //TEMP
- console.log(golden.root.contentItems[0].contentItems[0]);
- });
\ No newline at end of file
+golden.root.contentItems[0].contentItems[0].contentItems[0].on(
+ "resize",
+ function () {
+ console.log("IC pane resized"); //TEMP
+ console.log(golden.root.contentItems[0].contentItems[0]);
+ },
+);
diff --git a/webAO/utils/calculateApngLength.js b/webAO/utils/calculateApngLength.js
index ab8682a4..5d4ea7e9 100644
--- a/webAO/utils/calculateApngLength.js
+++ b/webAO/utils/calculateApngLength.js
@@ -1,30 +1,32 @@
/**
- * Adds up the chunk delays to find out how long a APNG is
- * @param {data} apngFile the APNG data
- */
+ * Adds up the chunk delays to find out how long a APNG is
+ * @param {data} apngFile the APNG data
+ */
const calculateApngLength = (apngFile) => {
- const d = new Uint8Array(apngFile);
- // https://wiki.mozilla.org/APNG_Specification#.60fcTL.60:_The_Frame_Control_Chunk
- let duration = 0;
- for (let i = 0; i < d.length; i++) {
- // Find fcTL header (66 63 54 4C)
- if (d[i] === 0x66
- && d[i + 1] === 0x63
- && d[i + 2] === 0x54
- && d[i + 3] === 0x4C) {
- // numerator and denominator
- const delayNum = Number(d[i + 23]);
- const delayDen = Number(d[i + 25]);
- let delay;
- // minimum is 100ms
- if (delayDen === 0) {
- delay = delayNum / 100;
- } else {
- delay = delayNum / delayDen;
- }
- duration += delay;
- }
+ const d = new Uint8Array(apngFile);
+ // https://wiki.mozilla.org/APNG_Specification#.60fcTL.60:_The_Frame_Control_Chunk
+ let duration = 0;
+ for (let i = 0; i < d.length; i++) {
+ // Find fcTL header (66 63 54 4C)
+ if (
+ d[i] === 0x66 &&
+ d[i + 1] === 0x63 &&
+ d[i + 2] === 0x54 &&
+ d[i + 3] === 0x4c
+ ) {
+ // numerator and denominator
+ const delayNum = Number(d[i + 23]);
+ const delayDen = Number(d[i + 25]);
+ let delay;
+ // minimum is 100ms
+ if (delayDen === 0) {
+ delay = delayNum / 100;
+ } else {
+ delay = delayNum / delayDen;
+ }
+ duration += delay;
}
- return duration * 10;
+ }
+ return duration * 10;
};
export default calculateApngLength;
diff --git a/webAO/utils/calculateGifLength.js b/webAO/utils/calculateGifLength.js
index eccfc77f..d8f64c16 100644
--- a/webAO/utils/calculateGifLength.js
+++ b/webAO/utils/calculateGifLength.js
@@ -1,29 +1,31 @@
/* eslint no-bitwise: "off" */
/**
- * Adds up the frame delays to find out how long a GIF is
- * I totally didn't steal this
- * @param {data} gifFile the GIF data
- */
+ * Adds up the frame delays to find out how long a GIF is
+ * I totally didn't steal this
+ * @param {data} gifFile the GIF data
+ */
const calculateGifLength = (gifFile) => {
- const d = new Uint8Array(gifFile);
- // Thanks to http://justinsomnia.org/2006/10/gif-animation-duration-calculation/
- // And http://www.w3.org/Graphics/GIF/spec-gif89a.txt
- let duration = 0;
- for (let i = 0; i < d.length; i++) {
- // Find a Graphic Control Extension hex(21F904__ ____ __00)
- if (d[i] === 0x21
- && d[i + 1] === 0xF9
- && d[i + 2] === 0x04
- && d[i + 7] === 0x00) {
- // Swap 5th and 6th bytes to get the delay per frame
- const delay = (d[i + 5] << 8) | (d[i + 4] & 0xFF);
+ const d = new Uint8Array(gifFile);
+ // Thanks to http://justinsomnia.org/2006/10/gif-animation-duration-calculation/
+ // And http://www.w3.org/Graphics/GIF/spec-gif89a.txt
+ let duration = 0;
+ for (let i = 0; i < d.length; i++) {
+ // Find a Graphic Control Extension hex(21F904__ ____ __00)
+ if (
+ d[i] === 0x21 &&
+ d[i + 1] === 0xf9 &&
+ d[i + 2] === 0x04 &&
+ d[i + 7] === 0x00
+ ) {
+ // Swap 5th and 6th bytes to get the delay per frame
+ const delay = (d[i + 5] << 8) | (d[i + 4] & 0xff);
- // Should be aware browsers have a minimum frame delay
- // e.g. 6ms for IE, 2ms modern browsers (50fps)
- duration += delay < 2 ? 10 : delay;
- }
+ // Should be aware browsers have a minimum frame delay
+ // e.g. 6ms for IE, 2ms modern browsers (50fps)
+ duration += delay < 2 ? 10 : delay;
}
- return duration * 10;
+ }
+ return duration * 10;
};
export default calculateGifLength;
diff --git a/webAO/utils/calculateWebpLength.js b/webAO/utils/calculateWebpLength.js
index e81a77b2..76a69e3c 100644
--- a/webAO/utils/calculateWebpLength.js
+++ b/webAO/utils/calculateWebpLength.js
@@ -1,24 +1,26 @@
/* eslint no-bitwise: "off" */
const calculateWebpLength = (webpFile) => {
- const d = new Uint8Array(webpFile);
- // https://developers.google.com/speed/webp/docs/riff_container#animation
- let duration = 0;
- for (let i = 0; i < d.length; i++) {
- // Find ANMF header (41 4E 4D 46)
- if (d[i] === 0x41
- && d[i + 1] === 0x4E
- && d[i + 2] === 0x4D
- && d[i + 3] === 0x46) {
- // Swap 5th and 6th bytes to get the delay per frame
- const delay = (d[i + 21] << 8) | (d[i + 20] & 0xFF);
+ const d = new Uint8Array(webpFile);
+ // https://developers.google.com/speed/webp/docs/riff_container#animation
+ let duration = 0;
+ for (let i = 0; i < d.length; i++) {
+ // Find ANMF header (41 4E 4D 46)
+ if (
+ d[i] === 0x41 &&
+ d[i + 1] === 0x4e &&
+ d[i + 2] === 0x4d &&
+ d[i + 3] === 0x46
+ ) {
+ // Swap 5th and 6th bytes to get the delay per frame
+ const delay = (d[i + 21] << 8) | (d[i + 20] & 0xff);
- // Should be aware browsers have a minimum frame delay
- // e.g. 6ms for IE, 2ms modern browsers (50fps)
- duration += delay < 2 ? 10 : delay;
- }
+ // Should be aware browsers have a minimum frame delay
+ // e.g. 6ms for IE, 2ms modern browsers (50fps)
+ duration += delay < 2 ? 10 : delay;
}
- return duration;
+ }
+ return duration;
};
export default calculateWebpLength;
diff --git a/webAO/utils/calculatorHandler.js b/webAO/utils/calculatorHandler.js
index 890b53c5..301de0e5 100644
--- a/webAO/utils/calculatorHandler.js
+++ b/webAO/utils/calculatorHandler.js
@@ -1,9 +1,9 @@
-import calculateGifLength from './calculateGifLength';
-import calculateWebpLength from './calculateWebpLength';
-import calculateApngLength from './calculateApngLength';
+import calculateGifLength from "./calculateGifLength";
+import calculateWebpLength from "./calculateWebpLength";
+import calculateApngLength from "./calculateApngLength";
export default {
- '.gif': calculateGifLength,
- '.webp': calculateWebpLength,
- '.apng': calculateApngLength,
+ ".gif": calculateGifLength,
+ ".webp": calculateWebpLength,
+ ".apng": calculateApngLength,
};
diff --git a/webAO/utils/getAnimLength.js b/webAO/utils/getAnimLength.js
index 2d838449..ac673c27 100644
--- a/webAO/utils/getAnimLength.js
+++ b/webAO/utils/getAnimLength.js
@@ -2,26 +2,26 @@
/* eslint no-restricted-syntax: "off" */
/* TODO: use promises for this */
-import calculatorHandler from './calculatorHandler';
-import fileExists from './fileExists';
-import { requestBuffer } from '../services/request';
+import calculatorHandler from "./calculatorHandler";
+import fileExists from "./fileExists";
+import { requestBuffer } from "../services/request";
/**
- * Gets animation length. If the animation cannot be found, it will
- * silently fail and return 0 instead.
- * @param {string} filename the animation file name
- */
+ * Gets animation length. If the animation cannot be found, it will
+ * silently fail and return 0 instead.
+ * @param {string} filename the animation file name
+ */
const getAnimLength = async (url) => {
- const extensions = ['.gif', '.webp', '.apng'];
- for (const extension of extensions) {
- const urlWithExtension = url + extension;
- const exists = await fileExists(urlWithExtension);
- if (exists) {
- const fileBuffer = await requestBuffer(urlWithExtension);
- const length = calculatorHandler[extension](fileBuffer);
- return length;
- }
+ const extensions = [".gif", ".webp", ".apng"];
+ for (const extension of extensions) {
+ const urlWithExtension = url + extension;
+ const exists = await fileExists(urlWithExtension);
+ if (exists) {
+ const fileBuffer = await requestBuffer(urlWithExtension);
+ const length = calculatorHandler[extension](fileBuffer);
+ return length;
}
- return 0;
+ }
+ return 0;
};
export default getAnimLength;
diff --git a/webAO/utils/getResources.js b/webAO/utils/getResources.js
index a7114521..9837c77a 100644
--- a/webAO/utils/getResources.js
+++ b/webAO/utils/getResources.js
@@ -1,39 +1,39 @@
const getResources = (AO_HOST, THEME) => ({
- holdit: {
- src: `${AO_HOST}misc/default/holdit_bubble.png`,
- duration: 720,
- },
- objection: {
- src: `${AO_HOST}misc/default/objection_bubble.png`,
- duration: 720,
- },
- takethat: {
- src: `${AO_HOST}misc/default/takethat_bubble.png`,
- duration: 840,
- },
- custom: {
- src: '',
- duration: 840,
- },
- witnesstestimony: {
- src: `${AO_HOST}themes/${THEME}/witnesstestimony_bubble.gif`,
- duration: 1560,
- sfx: `${AO_HOST}sounds/general/sfx-testimony.opus`,
- },
- crossexamination: {
- src: `${AO_HOST}themes/${THEME}/crossexamination_bubble.gif`,
- duration: 1600,
- sfx: `${AO_HOST}sounds/general/sfx-testimony2.opus`,
- },
- guilty: {
- src: `${AO_HOST}themes/${THEME}/guilty_bubble.gif`,
- duration: 2870,
- sfx: `${AO_HOST}sounds/general/sfx-guilty.opus`,
- },
- notguilty: {
- src: `${AO_HOST}themes/${THEME}/notguilty_bubble.gif`,
- duration: 2440,
- sfx: `${AO_HOST}sounds/general/sfx-notguilty.opus`,
- },
+ holdit: {
+ src: `${AO_HOST}misc/default/holdit_bubble.png`,
+ duration: 720,
+ },
+ objection: {
+ src: `${AO_HOST}misc/default/objection_bubble.png`,
+ duration: 720,
+ },
+ takethat: {
+ src: `${AO_HOST}misc/default/takethat_bubble.png`,
+ duration: 840,
+ },
+ custom: {
+ src: "",
+ duration: 840,
+ },
+ witnesstestimony: {
+ src: `${AO_HOST}themes/${THEME}/witnesstestimony_bubble.gif`,
+ duration: 1560,
+ sfx: `${AO_HOST}sounds/general/sfx-testimony.opus`,
+ },
+ crossexamination: {
+ src: `${AO_HOST}themes/${THEME}/crossexamination_bubble.gif`,
+ duration: 1600,
+ sfx: `${AO_HOST}sounds/general/sfx-testimony2.opus`,
+ },
+ guilty: {
+ src: `${AO_HOST}themes/${THEME}/guilty_bubble.gif`,
+ duration: 2870,
+ sfx: `${AO_HOST}sounds/general/sfx-guilty.opus`,
+ },
+ notguilty: {
+ src: `${AO_HOST}themes/${THEME}/notguilty_bubble.gif`,
+ duration: 2440,
+ sfx: `${AO_HOST}sounds/general/sfx-notguilty.opus`,
+ },
});
export default getResources;
diff --git a/webpack.config.js b/webpack.config.js
index f4b34b52..f31cb569 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,59 +1,60 @@
/* eslint-env node */
-const path = require('path');
-const dotenv = require('dotenv');
-const webpack = require('webpack');
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-const CopyPlugin = require('copy-webpack-plugin');
-const WorkboxPlugin = require('workbox-webpack-plugin');
-const glob = require('glob');
+const path = require("path");
+const dotenv = require("dotenv");
+const webpack = require("webpack");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const CopyPlugin = require("copy-webpack-plugin");
+const WorkboxPlugin = require("workbox-webpack-plugin");
+const glob = require("glob");
// this will update the process.env with environment variables in .env file
dotenv.config();
module.exports = {
entry: {
- ui: './webAO/ui.js',
- client: './webAO/client.ts',
- master: './webAO/master.ts',
+ ui: "./webAO/ui.js",
+ client: "./webAO/client.ts",
+ master: "./webAO/master.ts",
dom: {
- dependOn: 'client',
- import: glob.sync('./webAO/dom/*.{js,ts}')
+ dependOn: "client",
+ import: glob.sync("./webAO/dom/*.{js,ts}"),
},
- components: glob.sync('./webAO/components/*.js'),
+ components: glob.sync("./webAO/components/*.js"),
},
node: {
global: true,
},
- devtool: 'source-map',
+ devtool: "source-map",
resolve: {
- extensions: ['.js', '.jsx', '.tsx', '.ts', '.json'],
+ extensions: [".js", ".jsx", ".tsx", ".ts", ".json"],
},
devServer: {
static: {
- directory: path.join(__dirname, 'webAO'),
+ directory: path.join(__dirname, "webAO"),
},
compress: true,
port: 8080,
},
- mode: 'production',
+ mode: "production",
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
- loader: 'babel-loader',
+ loader: "babel-loader",
options: {
presets: [
[
- '@babel/preset-env', {
- useBuiltIns: 'usage',
+ "@babel/preset-env",
+ {
+ useBuiltIns: "usage",
targets: [
- 'defaults',
- 'Safari > 3',
- 'Opera > 8',
- 'Android > 3',
+ "defaults",
+ "Safari > 3",
+ "Opera > 8",
+ "Android > 3",
],
corejs: 3,
},
@@ -68,8 +69,8 @@ module.exports = {
],
},
output: {
- path: path.resolve(__dirname, 'dist'),
- filename: '[name].[contenthash].bundle.js',
+ path: path.resolve(__dirname, "dist"),
+ filename: "[name].[contenthash].bundle.js",
clean: true,
},
performance: {
@@ -80,30 +81,28 @@ module.exports = {
plugins: [
new CopyPlugin({
patterns: [
- { from: path.resolve(__dirname, 'webAO', 'styles'), to: 'styles' },
- { from: path.resolve(__dirname, 'static') },
- { from: path.resolve(__dirname, 'webAO', 'golden'), to: 'golden' },
- { from: path.resolve(__dirname, 'webAO', 'lib'), to: 'lib' },
+ { from: path.resolve(__dirname, "webAO", "styles"), to: "styles" },
+ { from: path.resolve(__dirname, "static") },
+ { from: path.resolve(__dirname, "webAO", "golden"), to: "golden" },
+ { from: path.resolve(__dirname, "webAO", "lib"), to: "lib" },
],
}),
new HtmlWebpackPlugin({
- filename: 'index.html',
- template: 'public/index.html',
- chunks: ['master', 'sw'],
- title: 'Attorney Online',
+ filename: "index.html",
+ template: "public/index.html",
+ chunks: ["master", "sw"],
+ title: "Attorney Online",
}),
new HtmlWebpackPlugin({
- title: 'Attorney Online',
- filename: 'client.html',
- chunks: ['client', 'ui', 'dom', 'components'],
- template: 'public/client.html',
+ title: "Attorney Online",
+ filename: "client.html",
+ chunks: ["client", "ui", "dom", "components"],
+ template: "public/client.html",
}),
new webpack.DefinePlugin({
- 'process.env': JSON.stringify(process.env),
+ "process.env": JSON.stringify(process.env),
}),
// new WorkboxPlugin.GenerateSW(),
-
],
-
};