Skip to content

Latest commit

 

History

History
120 lines (86 loc) · 5.07 KB

README.md

File metadata and controls

120 lines (86 loc) · 5.07 KB

TabsToFile - Firefox Addon

Firefox Add-on Mozilla Add-on Mozilla Add-on Rating GitHub license GitHub release (latest by date) Made with JavaScript

TabsToFile is a Firefox add-on that allows you to quickly save a selection of tabs. You can export the URLs of tabs that are marked with the cursor, selected through search terms, or simply every tab that's currently open. The exported URLs will first be displayed on a new page and can then be saved as an HTML or TXT document.

✨ Features

  • Export Selected Tabs: Export the URLs of tabs that are currently highlighted.
  • Export All Tabs in Current Window: Export the URLs of all tabs in the current window.
  • Export Tabs by Search Term: Export the URLs of tabs whose titles or URLs contain a specified search term.

On the gutted example.com export page, you can:

  • Dark Mode Toggle: Switch between dark and light mode for the export page, if exported to HTML, the selected configuration will be adopted.
  • Download as HTML or TXT: Save the exported URLs as an HTML or TXT file.

⚙️ Installation

You can install the latest version of the add-on from the Releases section of this repository.

Alternatively, you can install it from the Firefox Add-ons page.

🛠️ Usage

  1. Right-click on any tab to open the context menu.
  2. Choose one of the following options:
    • Export selected Tabs' URLs: Export the URLs of the highlighted tabs.
    • Export all Tabs in Current Window: Export the URLs of all tabs in the current window.
    • Export all Tabs whose titles or URLs contain search term: Open a popup to enter a search term and export the URLs of tabs that match the search term.

🔒 Permissions

The extension requires the following permissions:

  • tabs: To access the URLs of the tabs.
  • menus: To create context menu items.
  • storage: To store user preferences.
  • contextMenus: To add items to the context menu.
  • activeTab: To access the active tab.
  • <all_urls>: To access all URLs.

Note

There should be a more elegant way without requesting these sketchy permissions. I plan to look into it.

📝 Development

Prerequisites

  • Node.js
  • npm

🚀 Running in Development Mode

  1. Open Firefox and go to about:debugging.
  2. Click on "This Firefox". (Should redirect you to about:debugging#/runtime/this-firefox)
  3. Click on "Load Temporary Add-on".
  4. Select the manifest.json file from the src directory.

🏗️ Building the Add-on

To obtain an installer module you can either zip the folder and rename it to .xpi ('cause that's all they are) like a cheap-ass

Or you can follow Mozilla's official guide and use web-ext, their Node.js CLI tool, for optimized packaging (eg excluding artifacts like .git or node_modules)

Prerequisites:

  • Node.js
  • npm
  • an instance of FireFox
  1. Clone the repository:

    git clone https://github.com/grn-x/TabsToFiles-FirefoxAddon.git
    cd TabsToFiles-FirefoxAddon
  2. Install the web-ext tool:

    npm install --global web-ext
    web-ext --version
  3. Run the add-on:

    web-ext run

Note

Press r in the web-ext terminal, to trigger an extension reload

  1. Build the extension:
    web-ext build

The resulting file can then be tested locally, or submitted to addons.mozilla.org to be signed

Refer to the official documentation on web-ext and signing and publishing for more information.

File Structure

  • src/background.js: Contains the main logic for exporting tabs and creating the context menu.
  • src/popup.js: Handles the popup for entering the search term.
  • src/popup.html: The HTML for the popup window.
  • src/manifest.json: The manifest file for the add-on.

Contributing

Everything from bug reports to feature requests or even direct code contributions are welcome. Please open an issue or submit a pull request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.