Left: | ||
Right: |
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 |
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 // Click-to-hide stuff | 18 // Click-to-hide stuff |
19 var clickHide_activated = false; | 19 var clickHide_activated = false; |
20 var clickHide_filters = null; | 20 var clickHide_filters = null; |
21 var currentElement = null; | 21 var currentElement = null; |
22 var clickHideFilters = null; | |
23 var highlightedElementsSelector = null; | 22 var highlightedElementsSelector = null; |
24 var clickHideFiltersDialog = null; | 23 var clickHideFiltersDialog = null; |
25 var lastRightClickEvent = null; | 24 var lastRightClickEvent = null; |
26 | 25 |
27 function escapeChar(chr) | 26 function escapeChar(chr) |
28 { | 27 { |
29 var code = chr.charCodeAt(0); | 28 var code = chr.charCodeAt(0); |
30 | 29 |
31 // Control characters and leading digits must be escaped based on | 30 // Control characters and leading digits must be escaped based on |
32 // their char code in CSS. Moreover, curly brackets aren't allowed | 31 // their char code in CSS. Moreover, curly brackets aren't allowed |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 document.removeEventListener("click", clickHide_mouseClick, true); | 387 document.removeEventListener("click", clickHide_mouseClick, true); |
389 document.removeEventListener("keydown", clickHide_keyDown, true); | 388 document.removeEventListener("keydown", clickHide_keyDown, true); |
390 | 389 |
391 if (!keepOverlays) | 390 if (!keepOverlays) |
392 { | 391 { |
393 if (currentElement) { | 392 if (currentElement) { |
394 currentElement.removeEventListener("contextmenu", clickHide_elementClickH andler, true); | 393 currentElement.removeEventListener("contextmenu", clickHide_elementClickH andler, true); |
395 unhighlightElements(); | 394 unhighlightElements(); |
396 unhighlightElement(currentElement); | 395 unhighlightElement(currentElement); |
397 currentElement = null; | 396 currentElement = null; |
398 clickHideFilters = null; | |
399 } | 397 } |
400 unhighlightElements(); | 398 unhighlightElements(); |
401 | 399 |
402 var overlays = document.getElementsByClassName("__adblockplus__overlay"); | 400 var overlays = document.getElementsByClassName("__adblockplus__overlay"); |
403 while (overlays.length > 0) | 401 while (overlays.length > 0) |
404 overlays[0].parentNode.removeChild(overlays[0]); | 402 overlays[0].parentNode.removeChild(overlays[0]); |
405 } | 403 } |
406 } | 404 } |
407 | 405 |
408 function clickHide_elementClickHandler(ev) { | 406 function clickHide_elementClickHandler(ev) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 // popup asks for them. | 465 // popup asks for them. |
468 function clickHide_mouseClick(e) | 466 function clickHide_mouseClick(e) |
469 { | 467 { |
470 if (!currentElement || !clickHide_activated) | 468 if (!currentElement || !clickHide_activated) |
471 return; | 469 return; |
472 | 470 |
473 var elt = currentElement; | 471 var elt = currentElement; |
474 if (currentElement.classList.contains("__adblockplus__overlay")) | 472 if (currentElement.classList.contains("__adblockplus__overlay")) |
475 elt = currentElement.prisoner; | 473 elt = currentElement.prisoner; |
476 | 474 |
477 clickHideFilters = new Array(); | 475 var clickHideFilters = new Array(); |
Sebastian Noack
2015/01/16 20:59:15
While changing those lines, mind using array liter
kzar
2015/01/16 21:04:27
Done.
| |
478 selectorList = new Array(); | 476 var selectorList = new Array(); |
479 | 477 |
480 var addSelector = function(selector) | 478 var addSelector = function(selector) |
481 { | 479 { |
482 if (selectorList.indexOf(selector) != -1) | 480 if (selectorList.indexOf(selector) != -1) |
483 return; | 481 return; |
484 | 482 |
485 clickHideFilters.push(document.domain + "##" + selector); | 483 clickHideFilters.push(document.domain + "##" + selector); |
486 selectorList.push(selector); | 484 selectorList.push(selector); |
487 }; | 485 }; |
488 | 486 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 element.parentNode.removeChild(element); | 689 element.parentNode.removeChild(element); |
692 } | 690 } |
693 clickHide_deactivate(); | 691 clickHide_deactivate(); |
694 break; | 692 break; |
695 } | 693 } |
696 }); | 694 }); |
697 | 695 |
698 if (window == window.top) | 696 if (window == window.top) |
699 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 697 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
700 } | 698 } |
OLD | NEW |