| LEFT | RIGHT |
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 filterComposer */ | 18 /** @module filterComposer */ |
| 19 | 19 |
| 20 "use strict"; | 20 "use strict"; |
| 21 | 21 |
| 22 let {defaultMatcher} = require("matcher"); | 22 const {defaultMatcher} = require("matcher"); |
| 23 let {RegExpFilter} = require("filterClasses"); | 23 const {RegExpFilter} = require("filterClasses"); |
| 24 let {FilterNotifier} = require("filterNotifier"); | 24 const {FilterNotifier} = require("filterNotifier"); |
| 25 let {Prefs} = require("prefs"); | 25 const {Prefs} = require("prefs"); |
| 26 let {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); | 26 const {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); |
| 27 let {getKey, checkWhitelisted} = require("whitelisting"); | 27 const {getKey, checkWhitelisted} = require("whitelisting"); |
| 28 let {port} = require("messaging"); | 28 const {port} = require("messaging"); |
| 29 | 29 |
| 30 let readyPages = new ext.PageMap(); | 30 let readyPages = new ext.PageMap(); |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Checks whether the given page is ready to use the filter composer | 33 * Checks whether the given page is ready to use the filter composer |
| 34 * | 34 * |
| 35 * @param {Page} page | 35 * @param {Page} page |
| 36 * @return {boolean} | 36 * @return {boolean} |
| 37 */ | 37 */ |
| 38 exports.isPageReady = page => | 38 exports.isPageReady = page => |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); | 149 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 return {filters: filters, selectors: selectors}; | 153 return {filters: filters, selectors: selectors}; |
| 154 } | 154 } |
| 155 | 155 |
| 156 let contextMenuItem = { | 156 let contextMenuItem = { |
| 157 title: ext.i18n.getMessage("block_element"), | 157 title: ext.i18n.getMessage("block_element"), |
| 158 contexts: ["image", "video", "audio"], | 158 contexts: ["image", "video", "audio"], |
| 159 onclick: page => | 159 onclick(page) |
| 160 { | 160 { |
| 161 page.sendMessage({type: "composer.content.contextMenuClicked"}); | 161 page.sendMessage({type: "composer.content.contextMenuClicked"}); |
| 162 } | 162 } |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 function updateContextMenu(page, filter) | 165 function updateContextMenu(page, filter) |
| 166 { | 166 { |
| 167 page.contextMenus.remove(contextMenuItem); | 167 page.contextMenus.remove(contextMenuItem); |
| 168 | 168 |
| 169 if (typeof filter == "undefined") | 169 if (typeof filter == "undefined") |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 baseURL: message.baseURL, | 234 baseURL: message.baseURL, |
| 235 page: sender.page, | 235 page: sender.page, |
| 236 frame: sender.frame | 236 frame: sender.frame |
| 237 }); | 237 }); |
| 238 }); | 238 }); |
| 239 | 239 |
| 240 ext.pages.onLoading.addListener(page => | 240 ext.pages.onLoading.addListener(page => |
| 241 { | 241 { |
| 242 page.sendMessage({type: "composer.content.finished"}); | 242 page.sendMessage({type: "composer.content.finished"}); |
| 243 }); | 243 }); |
| LEFT | RIGHT |