| 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 28 matching lines...) Expand all Loading... |
| 39 this.stringifyURL = stringifyURL; | 39 this.stringifyURL = stringifyURL; |
| 40 this.isThirdParty = isThirdParty; | 40 this.isThirdParty = isThirdParty; |
| 41 this.extractHostFromFrame = extractHostFromFrame; | 41 this.extractHostFromFrame = extractHostFromFrame; |
| 42 } | 42 } |
| 43 with(require("icon")) | 43 with(require("icon")) |
| 44 { | 44 { |
| 45 this.updateIcon = updateIcon; | 45 this.updateIcon = updateIcon; |
| 46 this.startIconAnimation = startIconAnimation; | 46 this.startIconAnimation = startIconAnimation; |
| 47 this.stopIconAnimation = stopIconAnimation; | 47 this.stopIconAnimation = stopIconAnimation; |
| 48 } | 48 } |
| 49 with(require("devtools")) |
| 50 { |
| 51 this.hasDevToolsPanel = hasDevToolsPanel; |
| 52 this.logHiddenElements = logHiddenElements; |
| 53 } |
| 49 var FilterStorage = require("filterStorage").FilterStorage; | 54 var FilterStorage = require("filterStorage").FilterStorage; |
| 50 var ElemHide = require("elemHide").ElemHide; | 55 var ElemHide = require("elemHide").ElemHide; |
| 51 var defaultMatcher = require("matcher").defaultMatcher; | 56 var defaultMatcher = require("matcher").defaultMatcher; |
| 52 var Prefs = require("prefs").Prefs; | 57 var Prefs = require("prefs").Prefs; |
| 53 var Synchronizer = require("synchronizer").Synchronizer; | 58 var Synchronizer = require("synchronizer").Synchronizer; |
| 54 var Utils = require("utils").Utils; | 59 var Utils = require("utils").Utils; |
| 55 var NotificationStorage = require("notification").Notification; | 60 var NotificationStorage = require("notification").Notification; |
| 56 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; | 61 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; |
| 57 var parseFilters = require("filterValidation").parseFilters; | 62 var parseFilters = require("filterValidation").parseFilters; |
| 58 var composeFilters = require("filterComposer").composeFilters; | 63 var composeFilters = require("filterComposer").composeFilters; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 selectors = ElemHide.getSelectorsForDomain(host, false); | 485 selectors = ElemHide.getSelectorsForDomain(host, false); |
| 481 if (noStyleRules) | 486 if (noStyleRules) |
| 482 { | 487 { |
| 483 selectors = selectors.filter(function(s) | 488 selectors = selectors.filter(function(s) |
| 484 { | 489 { |
| 485 return !/\[style[\^\$]?=/.test(s); | 490 return !/\[style[\^\$]?=/.test(s); |
| 486 }); | 491 }); |
| 487 } | 492 } |
| 488 } | 493 } |
| 489 | 494 |
| 490 sendResponse(selectors); | 495 sendResponse({selectors: selectors, trace: hasDevToolsPanel(sender.page)})
; |
| 491 break; | 496 break; |
| 492 case "should-collapse": | 497 case "should-collapse": |
| 493 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) | 498 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) |
| 494 { | 499 { |
| 495 sendResponse(false); | 500 sendResponse(false); |
| 496 break; | 501 break; |
| 497 } | 502 } |
| 498 | 503 |
| 499 var url = new URL(msg.url); | 504 var url = new URL(msg.url); |
| 500 var documentHost = extractHostFromFrame(sender.frame); | 505 var documentHost = extractHostFromFrame(sender.frame); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 src: msg.src, | 564 src: msg.src, |
| 560 style: msg.style, | 565 style: msg.style, |
| 561 classes: msg.classes, | 566 classes: msg.classes, |
| 562 urls: msg.urls, | 567 urls: msg.urls, |
| 563 type: msg.mediatype, | 568 type: msg.mediatype, |
| 564 baseURL: msg.baseURL, | 569 baseURL: msg.baseURL, |
| 565 page: sender.page, | 570 page: sender.page, |
| 566 frame: sender.frame | 571 frame: sender.frame |
| 567 })); | 572 })); |
| 568 break; | 573 break; |
| 574 case "trace-elemhide": |
| 575 logHiddenElements(sender.page, msg.selectors, extractHostFromFrame(sender.
frame)); |
| 576 break; |
| 569 case "forward": | 577 case "forward": |
| 570 if (sender.page) | 578 if (sender.page) |
| 571 { | 579 { |
| 572 if (msg.expectsResponse) | 580 if (msg.expectsResponse) |
| 573 { | 581 { |
| 574 sender.page.sendMessage(msg.payload, sendResponse); | 582 sender.page.sendMessage(msg.payload, sendResponse); |
| 575 return true; | 583 return true; |
| 576 } | 584 } |
| 577 | 585 |
| 578 sender.page.sendMessage(msg.payload); | 586 sender.page.sendMessage(msg.payload); |
| 579 } | 587 } |
| 580 break; | 588 break; |
| 581 } | 589 } |
| 582 }); | 590 }); |
| 583 | 591 |
| 584 // update icon when page changes location | 592 // update icon when page changes location |
| 585 ext.pages.onLoading.addListener(function(page) | 593 ext.pages.onLoading.addListener(function(page) |
| 586 { | 594 { |
| 587 page.sendMessage({type: "clickhide-deactivate"}); | 595 page.sendMessage({type: "clickhide-deactivate"}); |
| 588 refreshIconAndContextMenu(page); | 596 refreshIconAndContextMenu(page); |
| 589 }); | 597 }); |
| 590 | 598 |
| 591 setTimeout(function() | 599 setTimeout(function() |
| 592 { | 600 { |
| 593 var notificationToShow = NotificationStorage.getNextToShow(); | 601 var notificationToShow = NotificationStorage.getNextToShow(); |
| 594 if (notificationToShow) | 602 if (notificationToShow) |
| 595 showNotification(notificationToShow); | 603 showNotification(notificationToShow); |
| 596 }, 3 * 60 * 1000); | 604 }, 3 * 60 * 1000); |
| OLD | NEW |