| 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-present eyeo GmbH |   3  * Copyright (C) 2006-present 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 /** @module cssInjection */ |  18 /** @module cssInjection */ | 
|  19  |  19  | 
|  20 "use strict"; |  20 "use strict"; | 
|  21  |  21  | 
|  22 const {RegExpFilter} = require("filterClasses"); |  22 const {RegExpFilter} = require("filterClasses"); | 
|  23 const {ElemHide} = require("elemHide"); |  23 const {ElemHide} = require("elemHide"); | 
|  24 const {ElemHideEmulation} = require("elemHideEmulation"); |  24 const {ElemHideEmulation} = require("elemHideEmulation"); | 
|  25 const {checkWhitelisted} = require("whitelisting"); |  25 const {checkWhitelisted} = require("whitelisting"); | 
|  26 const {extractHostFromFrame} = require("url"); |  26 const {extractHostFromFrame} = require("url"); | 
|  27 const {port} = require("messaging"); |  27 const {port} = require("messaging"); | 
|  28 const devtools = require("devtools"); |  28 const devtools = require("devtools"); | 
|  29  |  29  | 
|  30 const userStyleSheetsSupported = "extensionTypes" in chrome && |  30 const userStyleSheetsSupported = "extensionTypes" in browser && | 
|  31                                  "CSSOrigin" in chrome.extensionTypes; |  31                                  "CSSOrigin" in browser.extensionTypes; | 
|  32  |  32  | 
|  33 function hideElements(tabId, frameId, selectors) |  33 function hideElements(tabId, frameId, selectors) | 
|  34 { |  34 { | 
|  35   chrome.tabs.insertCSS(tabId, { |  35   browser.tabs.insertCSS(tabId, { | 
|  36     code: selectors.join(", ") + "{display: none !important;}", |  36     code: selectors.join(", ") + "{display: none !important;}", | 
|  37     cssOrigin: "user", |  37     cssOrigin: "user", | 
|  38     frameId, |  38     frameId, | 
|  39     matchAboutBlank: true, |  39     matchAboutBlank: true, | 
|  40     runAt: "document_start" |  40     runAt: "document_start" | 
|  41   }); |  41   }); | 
|  42 } |  42 } | 
|  43  |  43  | 
|  44 port.on("elemhide.getSelectors", (msg, sender) => |  44 port.on("elemhide.getSelectors", (msg, sender) => | 
|  45 { |  45 { | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  72   if (trace || inject) |  72   if (trace || inject) | 
|  73     response.selectors = selectors; |  73     response.selectors = selectors; | 
|  74  |  74  | 
|  75   return response; |  75   return response; | 
|  76 }); |  76 }); | 
|  77  |  77  | 
|  78 port.on("elemhide.injectSelectors", (msg, sender) => |  78 port.on("elemhide.injectSelectors", (msg, sender) => | 
|  79 { |  79 { | 
|  80   hideElements(sender.page.id, sender.frame.id, msg.selectors); |  80   hideElements(sender.page.id, sender.frame.id, msg.selectors); | 
|  81 }); |  81 }); | 
| OLD | NEW |