All Projects → CanisLupus → Swift Selection Search

CanisLupus / Swift Selection Search

Licence: mit
Swift Selection Search (SSS) is a simple Firefox add-on that lets you quickly search for some text in a page using your favorite search engines.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Swift Selection Search

Vertical Tabs Reloaded
Firefox add-on for arranging tabs vertically
Stars: ✭ 115 (-8%)
Mutual labels:  addon, browser, firefox, webextension
Livemarks
Extension that restores RSS Feed Livemarks in Firefox.
Stars: ✭ 137 (+9.6%)
Mutual labels:  addon, firefox, webextension
yet-another-pinboard-extension
Manage your Pinboard bookmarks in your browser.
Stars: ✭ 27 (-78.4%)
Mutual labels:  firefox, addon, webextension
Extension Create
Create modern cross-browser extensions with no build configuration.
Stars: ✭ 167 (+33.6%)
Mutual labels:  browser, firefox, webextension
drop-feeds
Drop Feeds is a Sage / Sage++ like addon (webextension) for Firefox Quantum
Stars: ✭ 18 (-85.6%)
Mutual labels:  firefox, addon, webextension
mute-sites-by-default
WebExtension that mutes all sites by default and remembers unmuted sites
Stars: ✭ 19 (-84.8%)
Mutual labels:  firefox, addon, webextension
Context Search
A Firefox WebExtension that displays a context menu, that searches for the selected text.
Stars: ✭ 26 (-79.2%)
Mutual labels:  addon, firefox, webextension
Librefox
License: Mozilla Public License 2.0
Stars: ✭ 1,574 (+1159.2%)
Mutual labels:  addon, browser, firefox
Owl
A Mozilla Firefox add-on to make online reading comfortable.
Stars: ✭ 58 (-53.6%)
Mutual labels:  addon, firefox
Cyberfox
cyberfox code repository
Stars: ✭ 66 (-47.2%)
Mutual labels:  browser, firefox
Vimperator Labs
Vimperator
Stars: ✭ 1,184 (+847.2%)
Mutual labels:  browser, firefox
Is Empty
Check whether a value is empty.
Stars: ✭ 47 (-62.4%)
Mutual labels:  utility, browser
Webpack Webextension Plugin
Webpack plugin that compiles WebExtension manifest.json files and adds smart auto reload
Stars: ✭ 47 (-62.4%)
Mutual labels:  firefox, webextension
Multipletab
Multiple Tab Handler, Provides feature to close multiple tabs.
Stars: ✭ 67 (-46.4%)
Mutual labels:  addon, firefox
Cookie Autodelete
Firefox and Chrome WebExtension that deletes cookies and other browsing site data as soon as the tab closes, domain changes, browser restarts, or a combination of those events.
Stars: ✭ 1,015 (+712%)
Mutual labels:  firefox, webextension
Bookmarks Organizer
With the Bookmarks Organizer it's easy to put order in your bookmarks. The Bookmarks Organizer finds no longer working bookmarks, redirects, duplicates and more!
Stars: ✭ 90 (-28%)
Mutual labels:  firefox, webextension
Newtaboverride
New Tab Override allows you to set the page that shows whenever you open a new tab.
Stars: ✭ 120 (-4%)
Mutual labels:  firefox, webextension
Github Awesome Autocomplete
Add instant search capabilities to GitHub's search bar
Stars: ✭ 1,015 (+712%)
Mutual labels:  search-engine, firefox
Downloadstar
Download all items in a webpage that match a pattern
Stars: ✭ 81 (-35.2%)
Mutual labels:  addon, firefox
Kdeconnect Chrome Extension
A browser extension to send pages and content from your browser to connected KDE Connect devices.
Stars: ✭ 124 (-0.8%)
Mutual labels:  browser, firefox

Swift Selection Search


⚠ NOTE: Development is on an indefinite break (Sorry!) ⚠

  • Please use the issues page only to report very problematic bugs you may find.
  • This project is not accepting pull requests.
  • I do encourage you to work on your own version of SSS and publish it as an improved addon. Even for other browsers!

You can read more about this here.


Description

Swift Selection Search (SSS) is a Firefox add-on for quickly searching for some text in a page using your favorite search engines.

Select text on a page and a small popup box with search engines will appear above your cursor. Press one and you'll automatically search for the selected text using that engine!

SSS is configurable. You can define which search engines appear on the popup, the appearance of the icons, what happens when you click them, where the popup appears, whether or not to hide it when the page scrolls, if you want to auto copy text on selection, and many more options.

You also get an optional context menu for searching with any of your engines. You can disable this extra menu in the options if you want. You also have the option of disabling the popup itself and leaving only this context menu. Your choice. :)

SSS is available at the Mozilla Add-ons website, here:

https://addons.mozilla.org/firefox/addon/swift-selection-search

How to build

Firstly, since WebExtensions are made in JavaScript, we need to be able to convert TypeScript to JavaScript, preferrably in a way that is as automatic as possible.

  1. Install npm. Download Node.js from https://nodejs.org and you will get npm alongside it.

  2. In the project's folder, run this in the command line:

    npm install

    This will install the project's TypeScript dependencies locally in the folder node_modules.

  3. To transpile all .ts scripts to .js (on Windows):

    "node_modules/.bin/tsc.cmd" --watch -p tsconfig.json

    The command will stay alive and automatically re-transpile code after any changes to .ts files, which is useful while developing.

Now you have .js files, so you can use SSS as a WebExtension. Yay!

  • For short development or just curiosity, the simpler way to try SSS is the about:debugging#addons page in Firefox. Press the "Load Temporary Add-on" button, select a file in the Swift Selection Search "src" directory (for example manifest.json), and it will load the add-on until the browser is closed. Changes to most code require reloading the add-on again.

  • For more prolonged development and/or packaging, such as auto reloading after each change, please follow Mozilla's instructions here to install and use the web-ext tool.

How to contribute code to SSS

Preparation

  1. Fork the repository on GitHub and clone it to your computer.

  2. Follow the instructions above for How to build.

    In the end you should have a script that automatically transpiles code from TypeScript to JavaScript, and should know how to run your version of SSS on Firefox.

  3. Learn that SSS has 3 main branches:

    • master - Final versions that are published to Mozilla Add-ons. "master" will usually point to a commit where the SSS version changes, since those are the ones published (commonly, there's a commit just to update the version).
    • develop - Where development happens and where new features will be merged to. Less stable but shouldn't have incomplete features.
    • addon-sdk - Can be ignored, since it's the code for SSS before it was a WebExtension. Essentially an archive.
  4. Read the code guidelines below.

Code guidelines

  • Tabs for indentation, please! ;) (Spaces can be used to align things.)
  • No whitespace at the end of lines. Settings like VSCode's "files.trimTrailingWhitespace" help with this.
  • Try to follow the style you see in the existing code. If you think it's inconsistent in some places, feel free to do your own thing. It will be reviewed anyway. ;)
  • SSS currently supports Firefox 63 onward, which means that you must take extra care when using an WebExtensions API. Make sure it exists in Firefox 63, or at least that the code doesn't run and crash on older versions. Ideally, install Firefox 63 separately on your computer (having a different Firefox profile for that helps greatly) and disable its auto updates.

Collaboration

  1. Find an issue you'd like to solve in the issues list.

  2. Ask if anyone is working on it already. Additionally, if it's missing details on how to implement or if you want to know of possible approaches, feel free to ask!

  3. Create a new Git branch for the new feature or bug fix you are trying to implement. Create this branch from "develop", to simplify the merge later on (since "master" may not have all current changes).

  4. Implement and commit/push the changes to the branch, possibly in multiple commits.

  5. Finally create a pull request to merge your changes to the original repository. It will be subject to code review, discussion and possibly changes if needed.

    Thanks!

TypeScript considerations and warnings

SSS was ported at some point from JavaScript to TypeScript to get the benefits of type annotations, since many errors can be caught by the type checker. However, it should be noted that the interaction of WebExtensions with TypeScript is finicky at best, since TypeScript assumes that scripts can import code/data from other scripts, when in reality the WebExtensions environment has sandboxing and rarely allows that.

Content scripts don't see code from the background script, or vice-versa, and the only way multiple content scripts can even see each other's code is if all of them are injected on the same page by the background script, similarly to how they would if they were included in an HTML page as scripts. TypeScript has no idea that this is how WebExtensions work, so just because something transpiles to JavaScript correctly it doesn't mean the WebExtension will work.

An example that works is that we can declare types/classes in the background script and reference them in other scripts, since only the type checker cares about them. We get type checking and it's fine.

However, if we try adding to those classes some methods, variable assignments, etc, then content scripts or options page scripts won't see these. When transpiling to JavaScript, they will be left as a reference to code in another script, which can't be referenced at runtime due to WebExtensions sandboxing. This is also true of enums (which have concrete values, so "data") UNLESS we declare them as "const enum", in which case TypeScript copies their values to where they are used instead of creating JavaScript objects.

So, if you see a class fully or partially declared in more than one script in this project (for example in both background script and page script), the above is why.

Another thing that may fail is using instanceof to check if an object is of a certain class. Don't do this for custom created classes since it may fail due to the sandboxing.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].