FindBar Tweak

Anything between simple tweaks such as placing the findbar in the top corner, to the powerful "Find in All Tabs" tool, FindBar Tweak will make your find toolbar "just right"!

About this Add-on
Contact Info: For reporting problems and bugs, or if you have comments or suggestions, please either send me an email (name at domain) or go to https://github.com/Quicksaver/FindBar-Tweak/issues and create an issue, this is so I have a way to communicate with you if I need to.

This add-on was inspired by Find Toolbar Tweaks and Scrollbar Search Highlighter, all code rewritten and upon which it builds and improves.

All find features are fully compatible with pdf documents, opened through the Firefox PDF.JS native reader or the PDF Viewer extension; Adobe Reader isn't supported.

Main features:
- Move Findbar to the top of the window, it will be displayed above the webpage, either on the left or on the right (like Google Chrome)

- Override the default global Findbar (default in Firefox 24 and below) behavior with:
-- (Disable all three below options to use the global Findbar)
-- Close the findbar when clicking somewhere in the webpage (when it loses focus)
-- Findbar starts closed in new tabs (default in Firefox 25 and above)
-- Remember the Findbar's opened/closed state on startup

- Ctrl+F (Command+F on Mac) toggles the FindBar (close it too)
-- Optionally only close it if the search value in the Findbar is the same as the selected text if there is any

- Toolbar Button to open and close the FindBar.
-- Drag it from the toolbar customization window and place it in a toolbar to use it, just like any other toolbar button.

- Hide Findbar close button, button labels and 'Find:' label

- Resize the find text field by dragging its border (right border when the Findbar is on the left, left border when the Findbar is on the right)
-- Double-click on the border to immediately resize to the maximum/minimum width possible.

- Enable/Disable QuickFind so you can search for text immediately by typing anywhere in the webpage
-- Show buttons in QuickFindbar
-- Set QuickFindbar auto-close timeout
-- Option to always open the QuickFind bar through the keyboard shortcut or the toolbar button

- Total matches found counter and current match indicator in the findbar

Highlights tweaks:
- 'Highlight all' by default (?)
- Hit Esc on a page to remove its highlights
- Also highlight on 'Find Again' - F3 or clicking the Next or Previous buttons (?)
- Delay the highlights if the search term is shorter than a defined number of characters (default is 3) to improve performance
- Change the highlights color and the current search hit color
-- It's recommended to keep the default contrast color for the current search hit, as to not interfere with normal text selection colors, which are based on your current operating system settings. If you uncheck this box, the contrast color will be automatically calculated based on your color choice (black for light colors, white for dark colors) and it will also be applied to normal text selection.

Find in All Tabs: find the current search term in all opened tabs
- Click on an item to immediatelly focus that hit. If it is on another tab or window, it will be brought up automatically.
- Finds also in View Source windows!
- The lists can optionally be opened in their own dedicated window, separate from the main browser; this will always be the case when opening the lists from any View Source window.
- Filter results by finding only in a specific tab group, in pinned tabs or in view source windows.
- When the find term exceeds 1000 hits, the lists will not be built, as it would severely slow down the browser!
- Some punctuation may be a bit off in text strings with mixed direction (both left-to-right and right-to-left).
- Quickly open/update the lists by hitting Alt+F3 (Option+F3 on Mac)
- Find in All Tabs is not accessible through the Quickfind bar.

Focus Sights on the current search hit
- Easily lets you know where in the page is the current search hit
- "Sights on All Highlights" will place focus sights on all highlighted hits as you scroll the page
-- Use "Sights on All Highlights" with caution! With a large amount of highlights, rendering sights on all of them can be very resource intensive and page scrolling can become slow!

Highlights grid in the scrollbar
- If highlights are found in frames or editable elements (like the google search box), the frames or editable elements themselves will be shown in the grid with a distinct pattern; with frames, the actual highlights will appear in a grid in the scrollbar of the frame they are in.
- The position and size of the grid can be adjusted in the preferences dialog; positive values mean the grid will be larger and further away from the window border, negative values mean it will be thinner and closer to the margin.
- In pdf documents, matches will initally show up with a pattern in the grid, representing the pages they're in rather than the matches themselves. This is because PDF.JS renders the pages as they are shown on screen. As the page is scrolled (and the matches are physically rendered) the grid will be updated accordingly.
- If the opened tab is the selected tab in the Find in All Tabs lists, when moving the mouse over a search hit item, the grid will show the position of that hit as well.

A note about the placement of the highlights in the grid relatively to the position of the scrollbar: For increasingly long pages the highlights placement corresponds less and less to the position of the scrollbar. It's mathematically impossible to place a line in the grid and fix it to a position that corresponds exactly to the position of the scrollbar when you need to scroll the page some 2000 lines to move the scrollbar by one pixel.

So for long pages, don't think of the grid as a place of "reference to where you should move the scrollbar" but rather as a place that shows where the highlights are in the webpage.

Other tweaks:
- Set whether opening the findbar fills it with the selected text or not
- Selecting text on a webpage immediately copies the selected text to the findbar and searches for it
-- When used together with "Highlight all by default", it will highlight all matches of the selected text, even if the findbar is closed.
-- Show the QuickFind bar (it will open in normal mode if "Always use normal Findbar" is enabled) when using selected text.

The add-on should handle all firefox native preferences automatically, by reverting any changes made to these when the add-on is disabled or removed. However, if you experience some error and those changes are not reverted, for example the highlights color remains changed after you disable the add-on, you can always reset all changed native preferences from within the preferences dialog.

I also recommend Find Suggest for added functionality and Rainbowpicker for a higher control of the highlights color.

Known incompatibilities:
There is a problem when using the Fast Video Download add-on (more specifically its SearchMenu component) and FindBar Tweak at the same time. The matches counter and maybe the highlights themselves may not work as expected. Fixing this incompatibility on my end would demand a lot of time from me which I currently don't have, and frankly I don't want to fix this because from my research I found SearchMenu's very intrusive behavior borders on ad-ware. In short, fixing this incompatibility is not very high on my priority list, especially since there are (better) alternatives to FVD.


Screenshots

FindBar Tweak
FindBar Tweak