SearchWidgetTracker
- class SearchWidgetTracker()
Updates persisted widths when the search bar is removed from any customizable area and put into the palette. Also automatically removes the search bar if it has not been used in a long time.
type: boolean
True if the search bar is currently in the navigation toolbar area.
- static SearchWidgetTracker._updateSearchBarVisibilityBasedOnUsage()
If the search bar is in the navigation toolbar, this method will check the lastUsed preference to see when the last time the search bar was actually used. If the number of days since it was last used exceeds a certain threshold, the widget is moved back into the customization palette.
- static SearchWidgetTracker.init()
Main entrypoint to initializing the SearchWidgetTracker.
- static SearchWidgetTracker.onWidgetAfterDOMChange(node, _nextNode, _container, wasRemoval)
The callback for when a widget is moved via CustomizableUI. We use this to detect movement of the search bar.
- Arguments:
node (Element) – The DOM node that was acted upon.
_nextNode (Element|null) – The DOM node (if any) that the widget was inserted before.
_container (Element) – The actual DOM container for the widget (could be an overflow panel in case of an overflowable toolbar).
wasRemoval (boolean) – True iff the action that happened was the removal of the DOM node.
- static SearchWidgetTracker.removePersistedWidths()
Removes any widget customization on the search bar (which can be created with the resizer that appears if the search bar is placed immediately after the URL bar). Goes through each open browser window and removes the width property / style on each existant search bar.