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: Properly convert Subscription objects as notification arguments Created Dec. 17, 2014, 10:15 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
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 function openFilters() 246 function openFilters()
247 { 247 {
248 ext.backgroundPage.sendMessage({type: "app.options"}); 248 ext.backgroundPage.sendMessage({type: "app.options"});
249 } 249 }
250 250
251 function updateToggleButtons() 251 function updateToggleButtons()
252 { 252 {
253 ext.backgroundPage.sendMessage({type: "subscriptions.get"}, function(subscri ptions) 253 ext.backgroundPage.sendMessage({type: "subscriptions.get"}, function(subscri ptions)
254 { 254 {
255 var known = Object.create(null);
256 for (var i = 0; i < subscriptions.length; i++)
257 known[subscriptions[i].url] = true;
255 for (var i = 0; i < featureSubscriptions.length; i++) 258 for (var i = 0; i < featureSubscriptions.length; i++)
256 { 259 {
257 var featureSubscription = featureSubscriptions[i]; 260 var featureSubscription = featureSubscriptions[i];
258 updateToggleButton(featureSubscription.feature, subscriptions.indexOf(fe atureSubscription.url) >= 0); 261 updateToggleButton(featureSubscription.feature, featureSubscription.url in known);
259 } 262 }
260 }); 263 });
261 } 264 }
262 265
263 function updateToggleButton(feature, isEnabled) 266 function updateToggleButton(feature, isEnabled)
264 { 267 {
265 var button = E("toggle-" + feature); 268 var button = E("toggle-" + feature);
266 if (isEnabled) 269 if (isEnabled)
267 button.classList.remove("off"); 270 button.classList.remove("off");
268 else 271 else
269 button.classList.add("off"); 272 button.classList.add("off");
270 } 273 }
271 274
272 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); 275 document.addEventListener("DOMContentLoaded", onDOMLoaded, false);
273 })(); 276 })();
OLDNEW
« ext/content.js ('K') | « ext/content.js ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld