| 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // See http://crbug.com/68705. | 47 // See http://crbug.com/68705. |
| 48 var noStyleRulesHosts = ["mail.google.com", "mail.yahoo.com", "www.google.com"]; | 48 var noStyleRulesHosts = ["mail.google.com", "mail.yahoo.com", "www.google.com"]; |
| 49 | 49 |
| 50 var htmlPages = new ext.PageMap(); | 50 var htmlPages = new ext.PageMap(); |
| 51 | 51 |
| 52 var contextMenuItem = { | 52 var contextMenuItem = { |
| 53 title: ext.i18n.getMessage("block_element"), | 53 title: ext.i18n.getMessage("block_element"), |
| 54 contexts: ["image", "video", "audio"], | 54 contexts: ["image", "video", "audio"], |
| 55 onclick: function(page) | 55 onclick: function(page) |
| 56 { | 56 { |
| 57 page.sendMessage({type: "blockelement-context-menu-clicked"}); | 57 page.sendMessage({type: "composer.content.contextMenuClicked"}); |
| 58 } | 58 } |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Adds or removes browser action icon according to options. | 61 // Adds or removes browser action icon according to options. |
| 62 function refreshIconAndContextMenu(page) | 62 function refreshIconAndContextMenu(page) |
| 63 { | 63 { |
| 64 var whitelisted = !!checkWhitelisted(page); | 64 var whitelisted = !!checkWhitelisted(page); |
| 65 updateIcon(page, whitelisted); | 65 updateIcon(page, whitelisted); |
| 66 | 66 |
| 67 // show or hide the context menu entry dependent on whether | 67 // show or hide the context menu entry dependent on whether |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (filter.collapse != null) | 183 if (filter.collapse != null) |
| 184 return filter.collapse; | 184 return filter.collapse; |
| 185 | 185 |
| 186 blocked = true; | 186 blocked = true; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 return blocked && Prefs.hidePlaceholders; | 190 return blocked && Prefs.hidePlaceholders; |
| 191 }); | 191 }); |
| 192 | 192 |
| 193 port.on("get-domain-enabled-state", function(msg, sender) | |
| 194 { | |
| 195 return {enabled: !checkWhitelisted(sender.page)}; | |
| 196 }); | |
| 197 | |
| 198 port.on("forward", function(msg, sender) | 193 port.on("forward", function(msg, sender) |
| 199 { | 194 { |
| 200 var targetPage; | 195 var targetPage; |
| 201 if (msg.targetPageId) | 196 if (msg.targetPageId) |
| 202 targetPage = ext.getPage(msg.targetPageId); | 197 targetPage = ext.getPage(msg.targetPageId); |
| 203 else | 198 else |
| 204 targetPage = sender.page; | 199 targetPage = sender.page; |
| 205 | 200 |
| 206 if (targetPage) | 201 if (targetPage) |
| 207 { | 202 { |
| 208 msg.payload.sender = sender.page.id; | 203 msg.payload.sender = sender.page.id; |
| 209 if (msg.expectsResponse) | 204 if (msg.expectsResponse) |
| 210 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); | 205 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); |
| 211 targetPage.sendMessage(msg.payload); | 206 targetPage.sendMessage(msg.payload); |
| 212 } | 207 } |
| 213 }); | 208 }); |
| 214 | 209 |
| 215 // update icon when page changes location | 210 // update icon when page changes location |
| 216 ext.pages.onLoading.addListener(function(page) | 211 ext.pages.onLoading.addListener(function(page) |
| 217 { | 212 { |
| 218 page.sendMessage({type: "blockelement-finished"}); | 213 page.sendMessage({type: "composer.content.finished"}); |
| 219 refreshIconAndContextMenu(page); | 214 refreshIconAndContextMenu(page); |
| 220 showNextNotificationForUrl(page.url); | 215 showNextNotificationForUrl(page.url); |
| 221 }); | 216 }); |
| LEFT | RIGHT |