diff --git a/build/UserALEWebExtension/optionsPage.html b/build/UserALEWebExtension/browserAction.html similarity index 100% rename from build/UserALEWebExtension/optionsPage.html rename to build/UserALEWebExtension/browserAction.html diff --git a/build/UserALEWebExtension/manifest.json b/build/UserALEWebExtension/manifest.json index a9b341d..b7fef77 100644 --- a/build/UserALEWebExtension/manifest.json +++ b/build/UserALEWebExtension/manifest.json @@ -18,9 +18,9 @@ } ], "options_ui": { - "page": "optionsPage.html" + "page": "options.html" }, "browser_action": { - "default_popup": "optionsPage.html" + "default_popup": "browserAction.html" } } diff --git a/build/UserALEWebExtension/options.html b/build/UserALEWebExtension/options.html new file mode 100644 index 0000000..dccb4ee --- /dev/null +++ b/build/UserALEWebExtension/options.html @@ -0,0 +1,57 @@ + + + + + + User ALE Web Extension - Options + + + + +

Logging Options

+
+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ +
+ +
+
+ + diff --git a/build/UserALEWebExtension/options.js b/build/UserALEWebExtension/options.js index 1d890f9..7ded5ef 100644 --- a/build/UserALEWebExtension/options.js +++ b/build/UserALEWebExtension/options.js @@ -1247,7 +1247,10 @@ function getConfig() { payload.pluginConfig.urlWhitelist; }); document.getElementById("optionsForm").addEventListener("submit", setConfig); - document.getElementById("issueForm").addEventListener("submit", reportIssue); + const issueForm = document.getElementById("issueForm"); + if (issueForm instanceof HTMLElement) { + issueForm.addEventListener("submit", reportIssue); + } } function reportIssue() { browser.runtime.sendMessage({ diff --git a/rollup.config.js b/rollup.config.js index 2b3229e..5f5729f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -100,7 +100,8 @@ export default [ targets: [ {src: srcWebExtensionDir + 'icons/**/*.*', dest: buildWebExtensionDir + 'icons'}, {src: srcWebExtensionDir + 'manifest.json', dest: buildWebExtensionDir}, - {src: srcWebExtensionDir + 'optionsPage.html', dest: buildWebExtensionDir} + {src: srcWebExtensionDir + 'options.html', dest: buildWebExtensionDir}, + {src: srcWebExtensionDir + 'browserAction.html', dest: buildWebExtensionDir} ], copyOnce: true }), diff --git a/src/UserALEWebExtension/optionsPage.html b/src/UserALEWebExtension/browserAction.html similarity index 100% rename from src/UserALEWebExtension/optionsPage.html rename to src/UserALEWebExtension/browserAction.html diff --git a/src/UserALEWebExtension/manifest.json b/src/UserALEWebExtension/manifest.json index a9b341d..b7fef77 100644 --- a/src/UserALEWebExtension/manifest.json +++ b/src/UserALEWebExtension/manifest.json @@ -18,9 +18,9 @@ } ], "options_ui": { - "page": "optionsPage.html" + "page": "options.html" }, "browser_action": { - "default_popup": "optionsPage.html" + "default_popup": "browserAction.html" } } diff --git a/src/UserALEWebExtension/options.html b/src/UserALEWebExtension/options.html new file mode 100644 index 0000000..dccb4ee --- /dev/null +++ b/src/UserALEWebExtension/options.html @@ -0,0 +1,57 @@ + + + + + + User ALE Web Extension - Options + + + + +

Logging Options

+
+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ +
+ +
+
+ + diff --git a/src/UserALEWebExtension/options.ts b/src/UserALEWebExtension/options.ts index 4df8d50..5d221da 100644 --- a/src/UserALEWebExtension/options.ts +++ b/src/UserALEWebExtension/options.ts @@ -80,10 +80,10 @@ function getConfig() { "submit", setConfig, ); - (document.getElementById("issueForm") as HTMLFormElement).addEventListener( - "submit", - reportIssue, - ); + const issueForm = document.getElementById("issueForm"); + if (issueForm instanceof HTMLElement) { + issueForm.addEventListener("submit", reportIssue); + } } function reportIssue() { diff --git a/test/e2e/spec/01-extension.spec.ts b/test/e2e/spec/01-extension.spec.ts index 18259ff..b3e7ea9 100644 --- a/test/e2e/spec/01-extension.spec.ts +++ b/test/e2e/spec/01-extension.spec.ts @@ -40,7 +40,7 @@ test.describe("Userale extension", () => { const requestPromise = sender.waitForRequest( (request) => request.method() === "POST", ); - await page.goto(`chrome-extension://${extensionId}/optionsPage.html`); + await page.goto(`chrome-extension://${extensionId}/options.html`); // Sleep so options.js can update the html with values from local storage. await new Promise((r) => setTimeout(r, 1000)); await page.fill("#filter", ".*"); @@ -60,7 +60,7 @@ test.describe("Userale extension", () => { const postData = request.postData(); return Boolean(postData && postData.includes("testUser")); }); - await page.goto(`chrome-extension://${extensionId}/optionsPage.html`); + await page.goto(`chrome-extension://${extensionId}/options.html`); await page.waitForLoadState("load"); await page.fill("#user", id); await page.click("#submitOptions"); @@ -87,7 +87,7 @@ test.describe("Userale extension", () => { const postData = request.postData(); return Boolean(postData && postData.includes(description)); }); - await page.goto(`chrome-extension://${extensionId}/optionsPage.html`); + await page.goto(`chrome-extension://${extensionId}/browserAction.html`); await page.waitForLoadState("load"); await page.fill("#issueDescription", description); await page.click("#submitIssue");