| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Implementation of the various actions performed on the filters. | 19 * Implementation of the various actions performed on the filters. |
| 20 * @class | 20 * @class |
| 21 */ | 21 */ |
| 22 var FilterActions = | 22 var FilterActions = |
| 23 { | 23 { |
| 24 /** | 24 /** |
| 25 * Initializes filter actions. | 25 * Initializes filter actions. |
| 26 */ | 26 */ |
| 27 init: function() | 27 init: function() |
| 28 { | 28 { |
| 29 let me = this; | 29 this.treeElement.parentNode.addEventListener("keydown", this.keyDown.bind(th
is), true); |
| 30 this.treeElement.parentNode.addEventListener("keypress", function(event) | |
| 31 { | |
| 32 me.keyPress(event); | |
| 33 }, true); | |
| 34 this.treeElement.view = FilterView; | 30 this.treeElement.view = FilterView; |
| 35 | 31 |
| 36 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=777832, don't | 32 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=777832, don't |
| 37 // allow the tree to receive keypress/keydown events triggered by cursor | 33 // allow the tree to receive keypress/keydown events triggered by cursor |
| 38 // keys pressed in the editor, it will call preventDefault() on them. | 34 // keys pressed in the editor, it will call preventDefault() on them. |
| 39 let propagationStopper = function(event) | 35 let propagationStopper = function(event) |
| 40 { | 36 { |
| 41 if (event.keyCode >= event.DOM_VK_PAGE_UP && event.keyCode <= event.DOM_VK
_DOWN) | 37 if (event.keyCode >= event.DOM_VK_PAGE_UP && event.keyCode <= event.DOM_VK
_DOWN) |
| 42 event.stopPropagation(); | 38 event.stopPropagation(); |
| 43 }; | 39 }; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 E("tooltip-additional").textContent = item.filter.reason; | 362 E("tooltip-additional").textContent = item.filter.reason; |
| 367 else if (item.filter instanceof RegExpFilter && defaultMatcher.isSlowFilter(
item.filter)) | 363 else if (item.filter instanceof RegExpFilter && defaultMatcher.isSlowFilter(
item.filter)) |
| 368 E("tooltip-additional").textContent = Utils.getString("filter_regexp_toolt
ip"); | 364 E("tooltip-additional").textContent = Utils.getString("filter_regexp_toolt
ip"); |
| 369 else | 365 else |
| 370 E("tooltip-additional").hidden = true; | 366 E("tooltip-additional").hidden = true; |
| 371 }, | 367 }, |
| 372 | 368 |
| 373 /** | 369 /** |
| 374 * Called whenever a key is pressed on the list. | 370 * Called whenever a key is pressed on the list. |
| 375 */ | 371 */ |
| 376 keyPress: function(/**Event*/ event) | 372 keyDown: function(/**Event*/ event) |
| 377 { | 373 { |
| 378 if (event.target != E("filtersTree")) | 374 if (event.target != E("filtersTree")) |
| 379 return; | 375 return; |
| 380 | 376 |
| 381 let modifiers = 0; | 377 let modifiers = 0; |
| 382 if (event.altKey) | 378 if (event.altKey) |
| 383 modifiers |= SubscriptionActions._altMask; | 379 modifiers |= SubscriptionActions._altMask; |
| 384 if (event.ctrlKey) | 380 if (event.ctrlKey) |
| 385 modifiers |= SubscriptionActions._ctrlMask; | 381 modifiers |= SubscriptionActions._ctrlMask; |
| 386 if (event.metaKey) | 382 if (event.metaKey) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 return; | 548 return; |
| 553 | 549 |
| 554 this.deleteItems(this.dragItems); | 550 this.deleteItems(this.dragItems); |
| 555 } | 551 } |
| 556 }; | 552 }; |
| 557 | 553 |
| 558 window.addEventListener("load", function() | 554 window.addEventListener("load", function() |
| 559 { | 555 { |
| 560 FilterActions.init(); | 556 FilterActions.init(); |
| 561 }, false); | 557 }, false); |
| OLD | NEW |