| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return {target: event.currentTarget, name: message, data: event}; | 246 return {target: event.currentTarget, name: message, data: event}; |
| 247 return null; | 247 return null; |
| 248 }, | 248 }, |
| 249 | 249 |
| 250 addMessageListener: function(message, listener) | 250 addMessageListener: function(message, listener) |
| 251 { | 251 { |
| 252 if (!this._messageMap.hasOwnProperty(message)) | 252 if (!this._messageMap.hasOwnProperty(message)) |
| 253 return; | 253 return; |
| 254 | 254 |
| 255 if (!("_ABPHandler" in listener)) | 255 if (!("_ABPHandler" in listener)) |
| 256 listener._ABPHandler = (event) => listener.receiveMessage(this._messageF
romEvent(event)); | 256 { |
| 257 listener._ABPHandler = (event) => { |
| 258 if (event.type == "keypress") |
| 259 { |
| 260 let key = event.charCode ? String.fromCharCode(event.charCode) : nul
l; |
| 261 // Firefox manually triggers FAYT when ' or / is pressed |
| 262 // so we need to capture those |
| 263 if (key == "'" || key == "/") |
| 264 return; |
| 265 } |
| 266 listener.receiveMessage(this._messageFromEvent(event)); |
| 267 }; |
| 268 } |
| 257 | 269 |
| 258 E("filtersTree").addEventListener(this._messageMap[message], listener._ABP
Handler, false); | 270 E("filtersTree").addEventListener(this._messageMap[message], listener._ABP
Handler, false); |
| 259 }, | 271 }, |
| 260 | 272 |
| 261 removeMessageListener: function(message, listener) | 273 removeMessageListener: function(message, listener) |
| 262 { | 274 { |
| 263 if (this._messageMap.hasOwnProperty(message) && listener._ABPHandler) | 275 if (this._messageMap.hasOwnProperty(message) && listener._ABPHandler) |
| 264 E("filtersTree").removeEventListener(this._messageMap[message], listener
._ABPHandler, false); | 276 E("filtersTree").removeEventListener(this._messageMap[message], listener
._ABPHandler, false); |
| 265 }, | 277 }, |
| 266 | 278 |
| 267 sendAsyncMessage: function() {} | 279 sendAsyncMessage: function() {} |
| 268 } | 280 } |
| 269 }; | 281 }; |
| 270 | 282 |
| 271 window.addEventListener("load", function() | 283 window.addEventListener("load", function() |
| 272 { | 284 { |
| 273 FilterSearch.init(); | 285 FilterSearch.init(); |
| 274 }, false); | 286 }, false); |
| OLD | NEW |