_______ __ _ __ __ _ __ __ _ __
/_ __(_)__ / /_____ ____ _ __(_) /_/ / | | /| / /__ / / ___ (_) /____ ___
/ / / / _ \/ \_/ -_) __/ | |/|/ / / __/ _ \ | |/ |/ / -_) _ \(_-</ / __/ -_|_-<
/_/ /_/_//_/_/\_\\__/_/ |__,__/_/\__/_//_/ |__/|__/\__/_.__/___/_/\__/\__/___/
Shortlet is a framework to configure and launch small hacks for the web. Ease your day-to-day by:
- Create keyboard shortcuts
- Multiple actions with one click
- Webpage manipulation without coding
Shortlet comes as a Chrome and Firefox extension, providing automatic webpage injection, a command palette and a settings UI.
Contents
- ❧ -
- Install from Firefox Add-ons or download and load the folder src as an unpacked extension in Chrome.
- Open Shortlet settings by clicking on the extension icon, or trigger the Shortlet command palette with the default shortcut
ctrl+space
. - Add your first shortlet and save the settings.
- Navigate to, or reload, the webpage and launch the shortlet.
- ❧ -
A simple shortlet to click a button, added within the shortlets wrapper object.
{
"shortlets": [
{
"id": "example_click_button",
"title": "Click a button",
"conditions": {
"url": "example.com"
},
"shortcut": "ctrl+g",
"actions": [
{
"do": "click",
"on": "div.button"
}
]
}
]
}
A shortlet with several actions. Start with "blur" to exit possible input fields, check all checkboxes, click save, what half a second and then return the the previous page.
{
"shortlets": [
{ "id": "example_click_button", "title": "Click a button", "conditions": { "url": "example.com" }, "shortcut": "ctrl+g", "actions": [{ "do": "click", "on": "div.button" }] },
{
"id": "exmaple_check_all_checkboxes",
"title": "Check all checkboxes and go back",
"conditions": {
"url": "example.com"
},
"actions": [
{
"do": "blur"
},
{
"do": "check",
"for": "each",
"on": "input[type=checkbox]",
"value": true
},
{
"do": "click",
"on": "button",
"text": "save"
},
{
"do": "goto",
"history": "back",
"delay": 500
}
]
}
]
}
A shortlet activating a delete dialog and click confirm, repeated 5 times.
{
"id": "example_delete_multiple",
"title": "Delete 5 objects ⚠️",
"conditions": {
"url": "example.com"
},
"shortcut": "shift+alt+backspace",
"repeat": 5,
"actions": [
{
"do": "blur",
"delay": 900
},
{
"do": "keypress",
"key": "Backspace",
"options": {
"altKey": true
}
},
{
"do": "click",
"on": "button.confirm-delete"
}
]
}
- ❧ -
A shortlet is a custom command. You configure it to perform the hack you desire. Each shortlet contains one or more actions, conditions and other properties. Shortlets are run from the command palette aka. the launcher.
An action is a predefined piece of code that is performed when you run the shortlet. It has a set of defined input values. There are different types of actions, most of them does something with the DOM.
Conditions decide if a shortlet should be available for a certain webpage. Currently, only URL conditions are supported.
Other shortlet properties are id, title, shortcut, and repeat.
- ❧ -
Each action is written as a JSON object with the following key-value pairs:
"do": "action code"
What action to run. Mandatory.
"on": "selector"
Almost always needed. Defines the list of elements to apply the action to by running querySelectorAll with the provided selector, then filter by text, if, and for."text": "regex"
Filters the selected list of elements by the value of their property innerText."if": "in view|frontmost"
Filters the list of selected elements by one/both of "in view" and "frontmost". Useful to avoid manipulating elements not currently visible."for": "FIRST|last|each|but_last|but_first|random"
Applied last, selecting elements based on position in the remaining list.
"delay": 123
Wait the given amount of milliseconds before running the action.
See each action below.
- ❧ -
Most actions require one or several elements to be selected, see Element selection properties on/text/if/for
above.
Action | Description | Properties |
---|---|---|
click | Click on the selected elements |
|
blur | Remove focus from all elements |
|
focus | Focus the selected elements |
|
select | Select the selected elements |
|
copy | Copy the selected elements' innerText to the clipboard, joined by a delimiter |
|
set_text alias: write |
Change the innerText of the selected elements |
|
append | Not yet implemented | |
replace | Not yet implemented | regex, all/one, only in inputs, on full page, always traverse children |
set_attribute alias: set |
Change the selected elements HTML attribute |
|
Action | Description | Properties |
---|---|---|
show | Show the selected elements by changing the display and opacity properties |
|
hide | Hide the selected elements with display:none |
|
toggle | Toggle visibility for the selected elements. Visible is achieved by changing the display property |
|
Action | Description | Properties |
---|---|---|
style | Change the selected elements style property |
|
add_class | Add a list of space separated classes to the selected elements |
|
remove_class | Remove a list of space separated classes from the selected elements |
|
toggle_class | Toggle a list of space separated classes on the selected elements |
|
stylesheet | Add the given css code to the page in a style tag |
|
Action | Description | Properties |
---|---|---|
input | Input a value into the selected elements. By default, trying to trigger data-binding code. Alternatively use simple assignment. |
|
check | Change the selected checkbox elements. By default, trying to trigger data-binding code. Alternatively use simple assignment. |
|
input_from | Add the selected elements matching innerText to the selected inputs. |
|
Action | Description | Properties |
---|---|---|
duplicate | Clone the selected elements and add new after them themselves. Optionally append the new elements id with a code. |
|
reveal_data | Create span elements with the matching text from the selected elements dataset attribute. Optionally style the span and define a target parent for the span. |
|
reveal_attribute alias: reveal |
Create span elements with the matching text from the selected elements html attribute. Optionally style the span and define a target parent for the span. |
|
tooltip | Not yet implemented. |
Action | Description | Properties |
---|---|---|
dispatch aliases: trigger, keypress, mouse |
Trigger an event on the selected elements. |
|
listen | Add an event listener to the selected elements and run the shortlet's actions when it is triggered. |
|
Action | Description | Properties |
---|---|---|
goto | Navigate to an url, append the current url or go back/forward in the browser history. |
|
scroll | Scroll to the selected element into view, by a delta, or to a fixed position. |
|
Action | Description | Properties |
---|---|---|
wait | Wait the given amount of milliseconds. |
|
log | Print selected elements in console.log. |
|
highlight | Not yet implemented. |
- ❧ -
Keyboard shortcut to show the shortlet launcher command palette. command-pal uses the hotkeys-js package to capture keyboard input. hotkeys-js documentation explains what keys you can use for this setting.
The JSON object where you define your shortlets.
- Trigger in inputs: If keyboard shortcuts should be triggered within input, textarea and select elements.
- Developer mode: Add 'Developer tools' to the command palette and activate logging.
Not yet implemented.
- ❧ -
Exposes the shortlet actions described in the section Actions. In addition, there are internal functions doing the heavy lifting.
Allows you to setup and run a list of actions, one at a time. Supports queuing, start and delay between steps.
A slightly modified copy of the command-pal project.
The main injection script that bootstraps Shortlet by fetching the shortlets from settings and loading them into CommandPal. Also, when needed, keeps track of elements inside and outside of the viewport.
The extension backend, handling local storage and open the settings page.
Provide the extension settings page with HTML/CSS and code to access the persistant storage of the settings.
- ❧ -
Nothing exists in vaccum. Shortlet is built from ideas I got when using the brilliant Shortkeys browser extension. Alfred app has been an inspiration for the command palette interface. ASCII art from patorjk.com
Queues are cool, use natural language, have fun.
Pontus Sundén, 2025 - [email protected]