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

Delta Between Two Patch Sets: options.js

Issue 29340571: Issue 3687 - Add experimental support for Safari content blockers (Closed)
Left Patch Set: Remove onChange logic for checkboxes Created May 18, 2016, 10:43 a.m.
Right Patch Set: Addressed Nits Created May 18, 2016, 11:30 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « options.html ('k') | popup.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 clearListBox("userFiltersBox"); 238 clearListBox("userFiltersBox");
239 clearListBox("excludedDomainsBox"); 239 clearListBox("excludedDomainsBox");
240 240
241 for (var i = 0; i < subscriptions.length; i++) 241 for (var i = 0; i < subscriptions.length; i++)
242 convertSpecialSubscription(subscriptions[i]); 242 convertSpecialSubscription(subscriptions[i]);
243 }); 243 });
244 } 244 }
245 245
246 function initCheckbox(id, key) 246 function initCheckbox(id, key)
247 { 247 {
248 key = key || id; 248 key = key || id;
Sebastian Noack 2016/05/18 11:16:32 Note that when we retrieve the checkbox later in o
kzar 2016/05/18 11:32:07 Actually onPrefMessage already handles that, chang
Sebastian Noack 2016/05/18 11:36:45 Hm, seems that logic could be simplified altogethe
249 var checkbox = document.getElementById(id); 249 var checkbox = document.getElementById(id);
250 250
251 getPref(key, function(value) 251 getPref(key, function(value)
252 { 252 {
253 onPrefMessage(key, value); 253 onPrefMessage(key, value);
254 }); 254 });
255 255
256 checkbox.addEventListener("click", function() 256 checkbox.addEventListener("click", function()
257 { 257 {
258 togglePref(key); 258 togglePref(key);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 value = value.indexOf("*") == -1; 503 value = value.indexOf("*") == -1;
504 break; 504 break;
505 case "safariContentBlocker": 505 case "safariContentBlocker":
506 var restartMessage = document.getElementById("restart-safari"); 506 var restartMessage = document.getElementById("restart-safari");
507 restartMessage.hidden = true; 507 restartMessage.hidden = true;
508 // When the user has chosen to use the legacy APIs but Safari has disabled 508 // When the user has chosen to use the legacy APIs but Safari has disabled
509 // them we need to show a "Please restart Safari" message. 509 // them we need to show a "Please restart Safari" message.
510 if (!value) 510 if (!value)
511 { 511 {
512 ext.backgroundPage.sendMessage({type: "safari.contentBlockingActive"}, 512 ext.backgroundPage.sendMessage({type: "safari.contentBlockingActive"},
513 function (contentBlockingActive) 513 function(contentBlockingActive)
Sebastian Noack 2016/05/18 11:16:32 Nit: Redundant space before arguments list.
kzar 2016/05/18 11:32:07 Done.
514 { 514 {
515 if (contentBlockingActive) 515 if (contentBlockingActive)
516 restartMessage.hidden = false; 516 restartMessage.hidden = false;
517 }); 517 });
518 } 518 }
519 } 519 }
520 var checkbox = document.getElementById(key); 520 var checkbox = document.getElementById(key);
521 if (checkbox) 521 if (checkbox)
522 checkbox.checked = value; 522 checkbox.checked = value;
523 } 523 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 onFilterMessage(message.action, message.args[0]); 762 onFilterMessage(message.action, message.args[0]);
763 break; 763 break;
764 case "prefs.respond": 764 case "prefs.respond":
765 onPrefMessage(message.action, message.args[0]); 765 onPrefMessage(message.action, message.args[0]);
766 break; 766 break;
767 case "subscriptions.respond": 767 case "subscriptions.respond":
768 onSubscriptionMessage(message.action, message.args[0]); 768 onSubscriptionMessage(message.action, message.args[0]);
769 break; 769 break;
770 } 770 }
771 }); 771 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld