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

Side by Side Diff: firstRun.js

Issue 4731979438227456: Issue 1663 - Emulate background page and implement proper message responder (Closed)
Patch Set: Rebased and addressed comments Created Dec. 18, 2014, 9:52 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 | « ext/content.js ('k') | messageResponder.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 function updateToggleButtons() 251 function updateToggleButtons()
252 { 252 {
253 ext.backgroundPage.sendMessage({ 253 ext.backgroundPage.sendMessage({
254 type: "subscriptions.get", 254 type: "subscriptions.get",
255 downloadable: true, 255 downloadable: true,
256 ignoreDisabled: true 256 ignoreDisabled: true
257 }, function(subscriptions) 257 }, function(subscriptions)
258 { 258 {
259 var known = Object.create(null);
260 for (var i = 0; i < subscriptions.length; i++)
261 known[subscriptions[i].url] = true;
259 for (var i = 0; i < featureSubscriptions.length; i++) 262 for (var i = 0; i < featureSubscriptions.length; i++)
260 { 263 {
261 var featureSubscription = featureSubscriptions[i]; 264 var featureSubscription = featureSubscriptions[i];
262 updateToggleButton(featureSubscription.feature, subscriptions.indexOf(fe atureSubscription.url) >= 0); 265 updateToggleButton(featureSubscription.feature, featureSubscription.url in known);
263 } 266 }
264 }); 267 });
265 } 268 }
266 269
267 function updateToggleButton(feature, isEnabled) 270 function updateToggleButton(feature, isEnabled)
268 { 271 {
269 var button = E("toggle-" + feature); 272 var button = E("toggle-" + feature);
270 if (isEnabled) 273 if (isEnabled)
271 button.classList.remove("off"); 274 button.classList.remove("off");
272 else 275 else
273 button.classList.add("off"); 276 button.classList.add("off");
274 } 277 }
275 278
276 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); 279 document.addEventListener("DOMContentLoaded", onDOMLoaded, false);
277 })(); 280 })();
OLDNEW
« no previous file with comments | « ext/content.js ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld