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

Side by Side Diff: lib/filterComposer.js

Issue 29511561: Issue 5347 - Check for contextMenus API support (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Minimize changes and add comments Created Aug. 16, 2017, 12:07 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« ext/background.js ('K') | « ext/background.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 title: ext.i18n.getMessage("block_element"), 169 title: ext.i18n.getMessage("block_element"),
170 contexts: ["image", "video", "audio"], 170 contexts: ["image", "video", "audio"],
171 onclick(page) 171 onclick(page)
172 { 172 {
173 page.sendMessage({type: "composer.content.contextMenuClicked"}); 173 page.sendMessage({type: "composer.content.contextMenuClicked"});
174 } 174 }
175 }; 175 };
176 176
177 function updateContextMenu(page, filter) 177 function updateContextMenu(page, filter)
178 { 178 {
179 // Firefox for Android does not support context menus.
180 // https://bugzilla.mozilla.org/show_bug.cgi?id=1269062
181 if (!("contextMenus" in chrome))
182 return;
Wladimir Palant 2017/08/16 13:21:56 This change won't be necessary any more if my prev
Manish Jethani 2017/08/16 19:39:09 Done.
183
179 page.contextMenus.remove(contextMenuItem); 184 page.contextMenus.remove(contextMenuItem);
180 185
181 if (typeof filter == "undefined") 186 if (typeof filter == "undefined")
182 filter = checkWhitelisted(page); 187 filter = checkWhitelisted(page);
183 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page)) 188 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
184 page.contextMenus.create(contextMenuItem); 189 page.contextMenus.create(contextMenuItem);
185 } 190 }
186 191
187 FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu); 192 FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu);
188 193
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 256
252 port.on("composer.quoteCSS", (message, sender) => 257 port.on("composer.quoteCSS", (message, sender) =>
253 { 258 {
254 return quoteCSS(message.CSS); 259 return quoteCSS(message.CSS);
255 }); 260 });
256 261
257 ext.pages.onLoading.addListener(page => 262 ext.pages.onLoading.addListener(page =>
258 { 263 {
259 page.sendMessage({type: "composer.content.finished"}); 264 page.sendMessage({type: "composer.content.finished"});
260 }); 265 });
OLDNEW
« ext/background.js ('K') | « ext/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld