diff --git a/bun.lockb b/bun.lockb
index 29b270a..2a4543e 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index 4df69ce..3fa12f3 100644
--- a/package.json
+++ b/package.json
@@ -21,10 +21,8 @@
"test": "vitest run",
"test:watch": "vitest",
"test:cov": "vitest run --coverage",
- "dev": "run-p -rl vite:watch serve:firefox",
- "vite:site": "vite",
- "vite:watch": "vite build --watch --mode development --minify false",
- "build": "tsc && vite build",
+ "dev": "run-p -rl 'vite build --watch --mode development --minify false' serve:firefox",
+ "build": "vite build",
"serve:firefox": "web-ext run -s dist",
"serve:chromium": "web-ext run -t chromium -s dist",
"bundle": "web-ext build -s dist -a out --overwrite-dest -n replace_maps.zip",
@@ -39,7 +37,6 @@
"prettier": "^3.3.2",
"release-it": "^17.4.0",
"release-it-changelogen": "^0.1.0",
- "typescript": "^5.5.2",
"vite": "^5.3.2",
"vite-plugin-static-copy": "^1.0.5",
"vitest": "^1.6.0",
diff --git a/src/bg.html b/src/bg.html
index 33b9947..3c545d4 100644
--- a/src/bg.html
+++ b/src/bg.html
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/src/bg/action.ts b/src/bg/action.js
similarity index 84%
rename from src/bg/action.ts
rename to src/bg/action.js
index 15251ce..f8295ef 100644
--- a/src/bg/action.ts
+++ b/src/bg/action.js
@@ -1,4 +1,4 @@
-import { browserAction, /*webNavigation,*/ type Tabs, tabs } from 'webextension-polyfill'
+import { browserAction, /*webNavigation,*/ Tabs, tabs } from 'webextension-polyfill'
import { getHostname, invertHostState } from './utils/storage'
//import { matcher as mapsUrlMatcher, runtimeMapUrl } from './bg';
@@ -10,9 +10,9 @@ import { getHostname, invertHostState } from './utils/storage'
*
* Requests all frames from the current tab, filters them for extension Leaflet frames and Maps frames.
* Reloads the full tab on extension Leaflet or Maps frame match.
- * @param tab Currently active tab
+ * @param {Tabs.Tab} tab Currently active tab
*/
-async function actionClick(tab: Tabs.Tab): Promise {
+async function actionClick(tab) {
if (!tab.url || !tab.id) return
let hostname = getHostname(tab.url)
diff --git a/src/bg/bg.ts b/src/bg/bg.js
similarity index 77%
rename from src/bg/bg.ts
rename to src/bg/bg.js
index 7df1b44..1e14453 100644
--- a/src/bg/bg.ts
+++ b/src/bg/bg.js
@@ -1,10 +1,10 @@
-import { runtime, tabs, windows, webRequest, type WebRequest } from 'webextension-polyfill'
+import { runtime, tabs, windows, webRequest, WebRequest } from 'webextension-polyfill'
import { disabledHosts, getHostname } from './utils/storage'
import { updateActiveTabIcon } from './utils/actionIcon'
import { domainEnds } from './utils/domainEnds'
-const gLocales: string = domainEnds.join('|') // TODO: collect more locales
-export const matcher: RegExp = new RegExp(
+const gLocales = domainEnds.join('|') // TODO: collect more locales
+export const matcher = new RegExp(
// TODO: fix regex to fit more patterns
`^(https?:\/\/)?(maps\.google\.(${gLocales})\/maps.*\?.*output=embed|(www\.)?google\.(${gLocales})\/maps\/embed.*\?)`
)
@@ -14,10 +14,10 @@ export const runtimeMapUrl = runtime.getURL('map.html')
* Checks if `frames` send a request to Maps.
* If they do and the extension isn't disabled for the current site, then the request is redirected to the extension leaflet map with all URL search params.
* Else the request is'nt blocked.
- * @param req Web Request from frame
- * @returns Redirect to extension map or pass through if extension disabled for website
+ * @param {WebRequest.OnBeforeRequestDetailsType} req Web Request from frame
+ * @returns {WebRequest.BlockingResponse} Redirect to extension map or pass through if extension disabled for website
*/
-function redirect(req: WebRequest.OnBeforeRequestDetailsType): WebRequest.BlockingResponse {
+function redirect(req) {
// TODO: check if originUrl always matches current tab url -> e.g. in frames with subframes
if (req.originUrl && req.url.match(matcher)) {
if (!disabledHosts.includes(getHostname(req.originUrl))) {
diff --git a/src/bg/utils/actionIcon.ts b/src/bg/utils/actionIcon.js
similarity index 83%
rename from src/bg/utils/actionIcon.ts
rename to src/bg/utils/actionIcon.js
index 542518e..e400188 100644
--- a/src/bg/utils/actionIcon.ts
+++ b/src/bg/utils/actionIcon.js
@@ -3,9 +3,9 @@ import { disabledHosts, getHostname } from './storage'
/**
* Updates the action icon
- * @param hostname Hostname
+ * @param {string} hostname Hostname
*/
-export function updateIcon(hostname: string): void {
+export function updateIcon(hostname) {
let disabled = disabledHosts.includes(hostname)
browserAction.setIcon({
@@ -24,7 +24,7 @@ export function updateIcon(hostname: string): void {
/**
* Async function to update the icon of the currently active tab. Uses `updateIcon` internally
*/
-export async function updateActiveTabIcon(): Promise {
+export async function updateActiveTabIcon() {
let browserTabs = await tabs.query({ active: true, currentWindow: true })
let tab = browserTabs[0]
diff --git a/src/bg/utils/domainEnds.ts b/src/bg/utils/domainEnds.js
similarity index 98%
rename from src/bg/utils/domainEnds.ts
rename to src/bg/utils/domainEnds.js
index 6eba323..3903313 100644
--- a/src/bg/utils/domainEnds.ts
+++ b/src/bg/utils/domainEnds.js
@@ -1,5 +1,5 @@
// Domain ends of google
-export const domainEnds: string[] = [
+export const domainEnds = [
'com',
'ac',
'ad',
diff --git a/src/bg/utils/storage.ts b/src/bg/utils/storage.js
similarity index 72%
rename from src/bg/utils/storage.ts
rename to src/bg/utils/storage.js
index c9eeaf9..2613880 100644
--- a/src/bg/utils/storage.ts
+++ b/src/bg/utils/storage.js
@@ -4,7 +4,8 @@ import { updateIcon } from './actionIcon'
export const KEY_DISABLED_HOSTS = 'disabled_hosts'
// Listens to changes on the storage. Updates disabled hosts list, if stored list changes
-export let disabledHosts: string[] = await getDisabledHosts()
+/** @type {string[]} */
+export let disabledHosts = await getDisabledHosts()
storage.local.onChanged.addListener((changes) => {
if (KEY_DISABLED_HOSTS in changes) {
disabledHosts = changes[KEY_DISABLED_HOSTS].newValue ?? []
@@ -13,18 +14,18 @@ storage.local.onChanged.addListener((changes) => {
/**
* Async function to get the list of disabled hostnames
- * @returns List of disabled hostnames
+ * @returns {Promise} List of disabled hostnames
*/
-async function getDisabledHosts(): Promise {
+async function getDisabledHosts() {
return (await storage.local.get(KEY_DISABLED_HOSTS))[KEY_DISABLED_HOSTS] ?? []
}
/**
* Async function to invert the state of a hostname.
* Adds new entry if not disabled, removes entry, if already disabled
- * @param hostname Hostname to invert the state of
+ * @param {string} hostname Hostname to invert the state of
*/
-export async function invertHostState(hostname: string): Promise {
+export async function invertHostState(hostname) {
if (disabledHosts.includes(hostname)) {
disabledHosts.splice(disabledHosts.indexOf(hostname), 1)
} else {
@@ -40,10 +41,10 @@ export async function invertHostState(hostname: string): Promise {
/**
* Retrieves the hostname from a URL
- * @param url Full URL string
- * @returns Hostname string
+ * @param {string} url Full URL string
+ * @returns {string} Hostname string
*/
-export function getHostname(url: string): string {
+export function getHostname(url) {
url = url.replace(/^\w+:\/\//, '')
url = url.split(/[\/#\?]/, 1)[0]
return url
diff --git a/src/map.html b/src/map.html
index 1f49292..7ac0c16 100644
--- a/src/map.html
+++ b/src/map.html
@@ -12,6 +12,6 @@
-
+