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

Side by Side Diff: lib/filterComposer.js

Issue 29339020: Issue 3868 - Use the new FilterNotifier API (Closed)
Patch Set: Updated depdendencies and use EventEmitter.listeners() Created March 24, 2016, 3:29 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
« no previous file with comments | « lib/events.js ('k') | lib/icon.js » ('j') | 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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")
170 filter = checkWhitelisted(page); 170 filter = checkWhitelisted(page);
171 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page)) 171 if (!filter && Prefs.shouldShowBlockElementMenu && readyPages.has(page))
172 page.contextMenus.create(contextMenuItem); 172 page.contextMenus.create(contextMenuItem);
173 } 173 }
174 174
175 FilterNotifier.addListener((action, page, filter) => 175 FilterNotifier.on("page.WhitelistingStateRevalidate", updateContextMenu);
176 {
177 if (action == "page.WhitelistingStateRevalidate")
178 updateContextMenu(page, filter);
179 });
180 176
181 Prefs.on("shouldShowBlockElementMenu", () => 177 Prefs.on("shouldShowBlockElementMenu", () =>
182 { 178 {
183 ext.pages.query({}, pages => 179 ext.pages.query({}, pages =>
184 { 180 {
185 for (let page of pages) 181 for (let page of pages)
186 updateContextMenu(page); 182 updateContextMenu(page);
187 }); 183 });
188 }); 184 });
189 185
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 baseURL: message.baseURL, 235 baseURL: message.baseURL,
240 page: sender.page, 236 page: sender.page,
241 frame: sender.frame 237 frame: sender.frame
242 }); 238 });
243 }); 239 });
244 240
245 ext.pages.onLoading.addListener(page => 241 ext.pages.onLoading.addListener(page =>
246 { 242 {
247 page.sendMessage({type: "composer.content.finished"}); 243 page.sendMessage({type: "composer.content.finished"});
248 }); 244 });
OLDNEW
« no previous file with comments | « lib/events.js ('k') | lib/icon.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld