Add OpenScript.button popup actions and release 1.0.6

Scripts can register buttons at runtime with OpenScript.button(label, onClick).
The popup lists buttons from scripts running in the active tab via
chrome.userScripts.execute in each script's world, and clicking one runs
the handler in the page before closing the popup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 07:14:51 -07:00
co-authored by Claude Opus 5.5
parent 1883a63ccd
commit 9b80284519
8 changed files with 192 additions and 8 deletions
+16
View File
@@ -86,6 +86,22 @@ const data = await response.json();
`OpenScript.fetch(url, options)` returns a native `Response` instance supporting `.json()`, `.text()`, `.arrayBuffer()`, `.blob()`, `.status`, `.ok`, and `.headers`. See the [Cross-origin fetch guide](docs/fetch.md) for full options and examples.
### Popup buttons
Scripts can add buttons under their entry in the popup's Scripts tab, for example to open a settings panel or trigger an action on the current page:
```javascript
OpenScript.button('Settings', () => openSettingsPanel());
if (location.pathname.startsWith('/issues'))
OpenScript.button('Export issues', exportIssues);
const remove = OpenScript.button('One-time action', doThing);
remove(); // takes the button away again
```
Buttons are registered at runtime, so they show only for scripts running on the active tab. A script that matches `*://*/*` therefore shows its buttons on any regular web page, but not on pages where Chrome blocks user scripts, such as `chrome://` pages and the Chrome Web Store. Clicking a button runs its handler inside the page in the script's world, then closes the popup.
### External libraries
Use `@require` to cache libraries when a script is saved: