| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 var FilterStorage = require("filterStorage").FilterStorage; | 50 var FilterStorage = require("filterStorage").FilterStorage; |
| 51 var ElemHide = require("elemHide").ElemHide; | 51 var ElemHide = require("elemHide").ElemHide; |
| 52 var defaultMatcher = require("matcher").defaultMatcher; | 52 var defaultMatcher = require("matcher").defaultMatcher; |
| 53 var Prefs = require("prefs").Prefs; | 53 var Prefs = require("prefs").Prefs; |
| 54 var Synchronizer = require("synchronizer").Synchronizer; | 54 var Synchronizer = require("synchronizer").Synchronizer; |
| 55 var Utils = require("utils").Utils; | 55 var Utils = require("utils").Utils; |
| 56 var NotificationStorage = require("notification").Notification; | 56 var NotificationStorage = require("notification").Notification; |
| 57 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; | 57 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; |
| 58 var parseFilters = require("filterValidation").parseFilters; | 58 var parseFilters = require("filterValidation").parseFilters; |
| 59 var composeFilters = require("filterComposer").composeFilters; |
| 59 | 60 |
| 60 // Some types cannot be distinguished | 61 // Some types cannot be distinguished |
| 61 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; | 62 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; |
| 62 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT
HER; | 63 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT
HER; |
| 63 | 64 |
| 64 // Chrome on Linux does not fully support chrome.notifications until version 35 | 65 // Chrome on Linux does not fully support chrome.notifications until version 35 |
| 65 // https://code.google.com/p/chromium/issues/detail?id=291485 | 66 // https://code.google.com/p/chromium/issues/detail?id=291485 |
| 66 var canUseChromeNotifications = require("info").platform == "chromium" | 67 var canUseChromeNotifications = require("info").platform == "chromium" |
| 67 && "notifications" in chrome | 68 && "notifications" in chrome |
| 68 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl
icationVersion, 10) > 34); | 69 && (navigator.platform.indexOf("Linux") == -1 || parseInt(require("info").appl
icationVersion, 10) > 34); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 page.sendMessage(msg); | 550 page.sendMessage(msg); |
| 550 }); | 551 }); |
| 551 break; | 552 break; |
| 552 case "add-sitekey": | 553 case "add-sitekey": |
| 553 processKey(msg.token, sender.page, sender.frame); | 554 processKey(msg.token, sender.page, sender.frame); |
| 554 break; | 555 break; |
| 555 case "report-html-page": | 556 case "report-html-page": |
| 556 htmlPages.set(sender.page, null); | 557 htmlPages.set(sender.page, null); |
| 557 refreshIconAndContextMenu(sender.page); | 558 refreshIconAndContextMenu(sender.page); |
| 558 break; | 559 break; |
| 560 case "compose-filters": |
| 561 sendResponse(composeFilters( |
| 562 msg.tagName, msg.id, msg.src, msg.style, |
| 563 msg.classes, msg.urls, new URL(msg.baseURL) |
| 564 )); |
| 565 break; |
| 559 case "forward": | 566 case "forward": |
| 560 if (sender.page) | 567 if (sender.page) |
| 561 { | 568 { |
| 562 if (msg.expectsResponse) | 569 if (msg.expectsResponse) |
| 563 { | 570 { |
| 564 sender.page.sendMessage(msg.payload, sendResponse); | 571 sender.page.sendMessage(msg.payload, sendResponse); |
| 565 return true; | 572 return true; |
| 566 } | 573 } |
| 567 | 574 |
| 568 sender.page.sendMessage(msg.payload); | 575 sender.page.sendMessage(msg.payload); |
| 569 } | 576 } |
| 570 break; | 577 break; |
| 571 } | 578 } |
| 572 }); | 579 }); |
| 573 | 580 |
| 574 // update icon when page changes location | 581 // update icon when page changes location |
| 575 ext.pages.onLoading.addListener(function(page) | 582 ext.pages.onLoading.addListener(function(page) |
| 576 { | 583 { |
| 577 page.sendMessage({type: "clickhide-deactivate"}); | 584 page.sendMessage({type: "clickhide-deactivate"}); |
| 578 refreshIconAndContextMenu(page); | 585 refreshIconAndContextMenu(page); |
| 579 }); | 586 }); |
| 580 | 587 |
| 581 setTimeout(function() | 588 setTimeout(function() |
| 582 { | 589 { |
| 583 var notificationToShow = NotificationStorage.getNextToShow(); | 590 var notificationToShow = NotificationStorage.getNextToShow(); |
| 584 if (notificationToShow) | 591 if (notificationToShow) |
| 585 showNotification(notificationToShow); | 592 showNotification(notificationToShow); |
| 586 }, 3 * 60 * 1000); | 593 }, 3 * 60 * 1000); |
| OLD | NEW |