Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devidw/tabgod
execute any javascript on any chromium tabs - cross-tab parallel execution
https://github.com/devidw/tabgod
browser-extension chrome-devtools-extension chrome-extension devtool devtools devtools-extension extension-chrome tabs-management
Last synced: 3 days ago
JSON representation
execute any javascript on any chromium tabs - cross-tab parallel execution
- Host: GitHub
- URL: https://github.com/devidw/tabgod
- Owner: devidw
- License: unlicense
- Created: 2024-02-06T23:03:08.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-15T21:59:43.000Z (9 months ago)
- Last Synced: 2024-10-18T21:04:30.879Z (16 days ago)
- Topics: browser-extension, chrome-devtools-extension, chrome-extension, devtool, devtools, devtools-extension, extension-chrome, tabs-management
- Language: TypeScript
- Homepage: https://chromewebstore.google.com/detail/hllgifenolhiihoihflfghkfaefpjdbg
- Size: 1.85 MB
- Stars: 157
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
tabgod
execute _any_ javascript on _any_ chromium tabs
- adds options page with `tabgod()` function
```ts
async function tabgod(
tabFilterFunc: (tab: chrome.tabs.Tab, ...args: unknown[]) => boolean,
exeFunc: (...args: unknown[]) => unknown,
options?: {
tabFilterArgs?: unknown[];
exeArgs?: unknown[];
evalAdd?: string;
},
): Promise<{ tabId: number; result: unknown }[]> {
//
}
```## examples
having chatgpt and pi talk to each other
https://github.com/devidw/tabgod/assets/68775926/d103bf67-5ed6-4e34-bb96-7b35d42f9d2d
searching same query on multiple search engines
![](./examples/search/demo.gif)
## usage
1. open extensions options page
2. open devtools console
3. use provided `tabgod()` function
1. choose execution targets by writing a filter function that will
include/excluce tabs based on defined criteria
- https://developer.chrome.com/docs/extensions/reference/api/tabs#type-Tab
2. write any js to execute in world of targeted tabs```js
tabgod(
(tab) => tab.url.includes("example.org"),
() => document.body.style.background = "pink",
);
```## notes on first release
- initial idea was to make tabgod function available in all devtools consoles
for easy and direct access for developers right from every console
- the implementation added tabgod to the global window object
- however this introduced a serious security issue, since this has made the
function available to websites also, allowing them to interact with other tabs,
destroying the idea of secure tab origins
- thanks to
[danielsmc pointing it out](https://github.com/devidw/tabgod/issues/1#issue-2124285330)
- this has been immediately addressed by moving the function only to the options
page of the extension, and not accepting external connections in the service
worker