The Velocity API is exposed through the Velocity
global object.
getTabs
- Returns an array of all open tabsgetBookmarks
- Returns an array of all bookmarksgetProtocol
- Returns an array of all protocols
URL
- A string representing the URL to opensetActive
- A boolean value to focus the newly opened tab
goBack
- Navigate backwards in historygoForward
- Navigate forwards in historyreload
- Reload the tabstop
- Stop the tab from loading any furthernavigate
- Navigate to a new URLURL
- A string representing where to navigate to
close
- Close the tabbookmark
- Bookmark the tab as it isexecuteScript
- Evaluate JavaScript inside the tab scopesetDevTools
- Open/close Eruda dev toolsisOpen
- A boolean value representing the dev tool open status
TODO
new Tab("about:newTab", true); // Open a new tab
options
name
- Display name for bookmarkurl
- Bookmark URLicon
- URL to bookmark iconid?
- Optional ID feild
delete
- Delete the bookmark
new Bookmark({
name: "Radon Games",
url: "https://radon.games/",
icon: "https://radon.games/favicon.ico"
});
prefix
- Prefix to use for the protocol
register
- Register a new domaindomain
- A string representing the domain ("*" for wildcard)URL
- A string URL to map the domain to
const proto = new Protocol("rd");
proto.register("*", "https://radon.games/");
options
separator?
- Boolean value to consider item a separatortext?
- Text value of the context buttononClick?
- A function that is executed when a user clicks the button
element.addEventListener("contextmenu", (event) => {
event.data = event.data ?? [];
event.data.push(
new ContextItem({
text: "Click me!",
onClick: () => {
alert("You clicked me!");
}
})
);
});
options
name
- Name of keybinddescription
- Description of keybindkey
- Non case sensitive keyctrl?
- Boolean to require ctrlshift?
- Boolean to require shiftalt?
- Boolean to require altmeta?
- Boolean to require metacallback
- Callback when keybind is runevent
- Keyboard event
toString
- Return the keybind as a readable string
new Keybind({
name: "Find",
description: "Find text in page",
key: "f",
ctrl: true,
callback(event) {
// do something
alert("You ran the keybind!");
}
});
add
- Async function to add or modify history entriesget
- Async function to get all entriestab?
- theTab
object to add or modify in history
delete
- Async function to delete an entryid
- the history object id<Tab>.historyId
clear
- Async function clear all entries
await history.clear();