aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-08-28 21:57:35 +0200
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-08-28 21:57:35 +0200
commitdb77f995f6d7cca5b471635a393954e2bd34b65a (patch)
tree5b8bb8f039d8f51691f8add54036f6dce39f7658 /examples
parentd09f12a4c3730d9992f14b89c64ba7b117c1946e (diff)
downloadevaltool-db77f995f6d7cca5b471635a393954e2bd34b65a.tar.gz
evaltool-db77f995f6d7cca5b471635a393954e2bd34b65a.tar.bz2
evaltool-db77f995f6d7cca5b471635a393954e2bd34b65a.tar.lz
evaltool-db77f995f6d7cca5b471635a393954e2bd34b65a.zip

feat: exttool

Diffstat (limited to 'examples')
-rw-r--r--examples/breeze-wiki.ts4
-rw-r--r--examples/i2p.ts4
-rw-r--r--examples/imgur-redirect.ts4
-rw-r--r--examples/open-loopback-as-new-window.ts29
4 files changed, 35 insertions, 6 deletions
diff --git a/examples/breeze-wiki.ts b/examples/breeze-wiki.ts
index 7e0d5d6..af218a9 100644
--- a/examples/breeze-wiki.ts
+++ b/examples/breeze-wiki.ts
@@ -1,7 +1,7 @@
// This example redirects all fandom pages to breezewiki (or for minecraft.fandom.com, the minecraft wiki)
-import type Browser from 'webextension-polyfill';
-declare const browser: typeof Browser;
+import type { Browser } from 'webextension-polyfill';
+declare const browser: Browser;
// ^ above 2 lines are optional, and only useful to allow the examples directory to not complain. The extension's monaco already defines the type of the browser global.
browser.webRequest.onBeforeRequest.addListener(
diff --git a/examples/i2p.ts b/examples/i2p.ts
index b9b29c4..7a2cb14 100644
--- a/examples/i2p.ts
+++ b/examples/i2p.ts
@@ -1,7 +1,7 @@
// This example allows entering i2p eepsites into your URL bar - and assuming you're using duckduckgo, it will send you to the eepsite instead.
-import type Browser from 'webextension-polyfill';
-declare const browser: typeof Browser;
+import type { Browser } from 'webextension-polyfill';
+declare const browser: Browser;
// ^ above 2 lines are optional, and only useful to allow the examples directory to not complain. The extension's monaco already defines the type of the browser global.
browser.webRequest.onBeforeRequest.addListener(
diff --git a/examples/imgur-redirect.ts b/examples/imgur-redirect.ts
index 97d7c81..72ff7d9 100644
--- a/examples/imgur-redirect.ts
+++ b/examples/imgur-redirect.ts
@@ -1,5 +1,5 @@
-import type Browser from 'webextension-polyfill';
-declare const browser: typeof Browser;
+import type { Browser } from 'webextension-polyfill';
+declare const browser: Browser;
// ^ above 2 lines are optional, and only useful to allow the examples directory to not complain. The extension's monaco already defines the type of the browser global.
browser.webRequest.onBeforeRequest.addListener(
diff --git a/examples/open-loopback-as-new-window.ts b/examples/open-loopback-as-new-window.ts
new file mode 100644
index 0000000..5806d4c
--- /dev/null
+++ b/examples/open-loopback-as-new-window.ts
@@ -0,0 +1,29 @@
+import type { Browser } from 'webextension-polyfill';
+declare const browser: Browser;
+
+browser.webRequest.onBeforeRequest.addListener(
+ (requestDetails) => {
+ const url = new URL(requestDetails.url);
+ if (url.searchParams.has('open-tab')) {
+ url.searchParams.delete('open-tab');
+ (async () => {
+ const oldTab = await browser.tabs.get(requestDetails.tabId)
+ console.warn(url.href);
+
+ await browser.windows.create({
+ type: 'popup',
+ width: 768,
+ height: 512,
+ url: [url.href]
+ });
+
+ await browser.tabs.remove(oldTab.id!)
+ })()
+ return {
+ cancel: true
+ };
+ }
+ },
+ { urls: ['http://127.0.0.1/*', 'http://localhost/*'] },
+ ['blocking']
+);