Index: chrome/content/ui/filters-search.js |
=================================================================== |
--- a/chrome/content/ui/filters-search.js |
+++ b/chrome/content/ui/filters-search.js |
@@ -15,6 +15,8 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
+let {BrowserUtils} = Cu.import("resource://gre/modules/BrowserUtils.jsm"); |
+ |
/** |
* Implementation of the filter search functionality. |
* @class |
@@ -234,6 +236,8 @@ |
messageManager: |
{ |
+ FAYT_LINKS_KEY: "'".charCodeAt(0), |
+ FAYT_TEXT_KEY: "/".charCodeAt(0), |
_messageMap: { |
"Findbar:Mouseup": "mouseup", |
"Findbar:Keypress": "keypress" |
@@ -253,7 +257,29 @@ |
return; |
if (!("_ABPHandler" in listener)) |
- listener._ABPHandler = (event) => listener.receiveMessage(this._messageFromEvent(event)); |
+ { |
+ listener._ABPHandler = (event) => { |
+ if (event.type == "keypress") |
+ { |
+ if (event.ctrlKey || event.altKey || event.metaKey |
+ || event.defaultPrevented) |
+ return; |
+ |
+ let findbar = E("findbar"); |
+ if (findbar.findMode == findbar.FIND_NORMAL |
+ && !findbar.findAsYouType |
+ && event.charCode != this.FAYT_LINKS_KEY |
+ && event.charCode != this.FAYT_TEXT_KEY) |
+ return; |
+ |
+ let target = Services.focus.getFocusedElementForWindow(window, true, {}); |
+ if (!BrowserUtils.shouldFastFind(target, window)) |
+ return; |
+ } |
+ |
+ listener.receiveMessage(this._messageFromEvent(event)); |
+ }; |
+ } |
E("filtersTree").addEventListener(this._messageMap[message], listener._ABPHandler, false); |
}, |