Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterComposer.js

Issue 29370947: Issue 3138 - Improve how context menu "block element" handles iframes (Closed)
Patch Set: Addressed feedback Created Jan. 12, 2017, 7:14 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « composer.postload.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, info) =>
160 { 160 {
161 page.sendMessage({type: "composer.content.contextMenuClicked"}); 161 page.sendMessage(
162 {type: "composer.content.contextMenuClicked"}, undefined, info.frameId
163 );
162 } 164 }
163 }; 165 };
164 166
165 function updateContextMenu(page, filter) 167 function updateContextMenu(page, filter)
166 { 168 {
167 page.contextMenus.remove(contextMenuItem); 169 page.contextMenus.remove(contextMenuItem);
168 170
169 if (typeof filter == "undefined") 171 if (typeof filter == "undefined")
170 filter = checkWhitelisted(page); 172 filter = checkWhitelisted(page);
171 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page)) 173 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 baseURL: message.baseURL, 236 baseURL: message.baseURL,
235 page: sender.page, 237 page: sender.page,
236 frame: sender.frame 238 frame: sender.frame
237 }); 239 });
238 }); 240 });
239 241
240 ext.pages.onLoading.addListener(page => 242 ext.pages.onLoading.addListener(page =>
241 { 243 {
242 page.sendMessage({type: "composer.content.finished"}); 244 page.sendMessage({type: "composer.content.finished"});
243 }); 245 });
OLDNEW
« no previous file with comments | « composer.postload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld