starting on the extension

This commit is contained in:
Oliver Atkinson 2024-12-12 15:32:04 -07:00
parent 298ad39a79
commit 611a1e923b
10 changed files with 86 additions and 0 deletions

BIN
browser/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

5
browser/jsconfig.json Normal file
View File

@ -0,0 +1,5 @@
{
"typeAcquisition": {
"include": ["firefox-webext-browser"]
}
}

16
browser/main/main.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>Here is some text</p>
<p id="changeme">old</p>
<script src="script.js" async defer></script>
</body>
</html>

5
browser/main/script.js Normal file
View File

@ -0,0 +1,5 @@
document.getElementById("changeme").innerText = "newer"
window.fetch("http://127.0.0.1:9001").then((e) => {
console.log(e)
})

4
browser/main/style.css Normal file
View File

@ -0,0 +1,4 @@
html {
background: black;
color: white;
}

14
browser/manifest.json Normal file
View File

@ -0,0 +1,14 @@
{
"manifest_version": 2,
"name": "Viewer",
"version": "0.1",
"description": "Adds a red border to all webpages matching mozilla.org.",
"permissions": [
"activeTab"
],
"browser_action": {
"default_icon": "icon.png",
"default_title": "Click me!",
"default_popup": "popup/popup.html"
}
}

18
browser/popup/popup.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button id="newtab">Open Historical Pages</button>
<p id="tim"></p>
<script src="popup.js"></script>
</body>
<style>
html {
background: black;
color: white;
}
</style>
</html>

3
browser/popup/popup.js Normal file
View File

@ -0,0 +1,3 @@
document.getElementById("newtab").addEventListener('click', async function(e) {
await browser.tabs.create({ url: "/main/main.html" })
})

5
browser/popup/runner.js Normal file
View File

@ -0,0 +1,5 @@
document.body.textContent = "";
let header = document.createElement("h1");
header.textContent = "This page has been eaten";
document.body.appendChild(header);

16
jsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"target": "ES2022",
"jsx": "react",
"allowImportingTsExtensions": true,
"strictNullChecks": true,
"strictFunctionTypes": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
],
"typeAcquisition": {"include": ["firefox-webext-browser"]}
}