An extension for Firefox that gets all links from a page and shows them in an interactively filterable list.
Find a file
Dirk 64497dafb8
delete empty Dutch translation file
The file was added but no translator ever translated anything.
2024-12-21 13:51:49 +01:00
extra add Weblate button (Codeberg Translate) 2024-04-04 18:58:08 +02:00
gib_links version bump to 0.0.5 2024-08-31 19:23:58 +02:00
workshop delete empty Dutch translation file 2024-12-21 13:51:49 +01:00
.gitignore add multiple new contents 2024-03-29 01:19:17 +01:00
create-workshop-data add link output to workshop data creation script 2024-04-07 00:55:41 +02:00
LICENSE.txt initial commit 2024-03-29 00:37:34 +01:00
README.md add Weblate button (Codeberg Translate) 2024-04-04 18:58:08 +02:00

Gib Links! Get links from the current tab

This extension implements an easy to use dialog that lists all links from the currently shown page in the active tab and offers a way to filter the links list using simple Javascript regular expressions.

Light mode view Dark mode view

The extension has a small footprint and does not need any “critical” permissions. It also does not reinvents the wheel. Just get the list of links, filter it, and copy it to the clipboard.

Get the addon Help translating

Usage

On a page where you want to get the links, click the extensions button. A modal dialog opens, showing the collected links fromn that page. To close the dialog, simply click the button again, press Escape, or click the “close” button in the dialog.

In the dialog you can simply click individual links to copy them to the clipboard. When clicking the “copy all” button, all currently listed links are copied to the clipboard, as a line-by-line list with one link per line. It is made sure that there are no duplicate links in the list (determined by link target, i.e. the shown URL). The list is ordered by appearance of the link on the website.

For filtering the list you can use Javascript regular expressions (regex). The filter works in the “contains mode”, that means, you do not need to add .* before and after the string to match substrings. Here are some examples:

  • threads?$ this finds all links that end with either thread or threads
  • post/[^1] all links that contain post/ followed by anything except a 1
  • https://(docs\.|git\.)?example.com all HTTPS links to either docs.example.com or git.example.com
  • \.(png|jpe?g)$ all links to jpg, jpeg, or png files
  • MyCoolUsername links that contain “MyCoolUsername”

The searches are case sensitive, so FOOBAR only finds links that contain “FOOBAR” but not “foobar”.

After filtering the list as wanted, simply click the “copy” button and all currently listed links are copied to the clipboard. You can also unfocus the filter input field and press Ctrl+A and Ctrl+C top copy the links. It is made sure that only the links text content is selected with Ctrl+A.

The extensions settings area allows for setting the base size (defaults to 16px, which is the default font size in Firefox) which is used as font size as well as for calculations of other sizes and distances. You can also add a standard filter which is automatically added as filter string when opening the dialog. The realtime filter enables instant filtering of the list when you enter something in the filter input. This can cause performance issues on very long link lists.

About the needed permissions

This extension uses the least possible amount of permissions

  • activeTab This is needed in order to get access to the currently active tab and its contents.

  • scripting For injecting the necessary code into the currently shown page in the currently active tab. The code injected fetches all link elements of the page, processes them into an unsable list, and thenm adds the code that is needed to show the filter dialog. This is also needed for injecting the styling information so the dialog can look like it looks.

  • clipboardWrite When an extension wants to access the clipboard, this permission is needed. The extension cannot read the clipboard, it can only write. This is used to copy the links to the clipboard.

  • storage For locally storing and reading the extensions settings browser.storage.local is used. For using this API, the respective permission is needed. The extension cannot read other extensions settings or any browser settings.

Possible style inconsistencies

Because the filter dialog is technically a part of the page shown in the currently active tab, it might inherit some formatting from the page. The extension was tested with several stylistic complex pages in light mode and in dark mode to make sure to maintain an uniform look across all pages. Feel free to drop me a note if you find anything that makes the dialog look different from other pages.

When the browser is in dark mode, the settings area seems to ignore that. This looks like to be standard behavior and is not changeable by extensions.