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

Delta Between Two Patch Sets: desktop-options.js

Issue 29578574: Issue 5632 - Use checkboxes for toggling acceptable ads (Closed)
Left Patch Set: Addressed Thomas Comments Created Oct. 20, 2017, 4:39 p.m.
Right Patch Set: Fixed the duplication Created Oct. 20, 2017, 6:56 p.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 | « desktop-options.html ('k') | skin/desktop-options.css » ('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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 { 651 {
652 setCustomFiltersView("read"); 652 setCustomFiltersView("read");
653 }); 653 });
654 break; 654 break;
655 case "show-more-filters-section": 655 case "show-more-filters-section":
656 E("more-filters").setAttribute("aria-hidden", false); 656 E("more-filters").setAttribute("aria-hidden", false);
657 break; 657 break;
658 case "switch-acceptable-ads": 658 case "switch-acceptable-ads":
659 let value = element.value || element.dataset.value; 659 let value = element.value || element.dataset.value;
660 // User check the checkbox 660 // User check the checkbox
661 let isCheck = element.getAttribute("aria-checked") != "true"; 661 let shouldCheck = element.getAttribute("aria-checked") != "true";
662 662 let installAcceptableAds = false;
663 let installAcceptableAdsPrivacy = false;
663 // Acceptable Ads checkbox clicked 664 // Acceptable Ads checkbox clicked
664 if (value == "ads") 665 if (value == "ads")
665 { 666 {
666 browser.runtime.sendMessage({ 667 installAcceptableAds = shouldCheck;
667 type: isCheck ? "subscriptions.add" : 668 }
668 "subscriptions.remove", 669 // Privacy Friendly Acceptable Ads checkbox clicked
669 url: acceptableAdsUrl 670 else
670 }); 671 {
671 browser.runtime.sendMessage({ 672 installAcceptableAdsPrivacy = shouldCheck;
672 type: "subscriptions.remove", 673 installAcceptableAds = !shouldCheck;
673 url: acceptableAdsPrivacyUrl 674 }
674 }); 675
675 } 676 browser.runtime.sendMessage({
676 else // Privacy Friendly Acceptable Ads checkbox clicked 677 type: installAcceptableAds ? "subscriptions.add" :
677 { 678 "subscriptions.remove",
678 browser.runtime.sendMessage({ 679 url: acceptableAdsUrl
679 type: isCheck ? "subscriptions.add" : 680 });
680 "subscriptions.remove", 681 browser.runtime.sendMessage({
681 url: acceptableAdsPrivacyUrl 682 type: installAcceptableAdsPrivacy ? "subscriptions.add" :
682 }); 683 "subscriptions.remove",
683 browser.runtime.sendMessage({ 684 url: acceptableAdsPrivacyUrl
684 type: isCheck ? "subscriptions.remove" : 685 });
685 "subscriptions.add",
686 url: acceptableAdsUrl
687 });
688 }
689 break; 686 break;
690 case "switch-tab": 687 case "switch-tab":
691 switchTab(element.getAttribute("href").substr(1)); 688 switchTab(element.getAttribute("href").substr(1));
692 break; 689 break;
693 case "toggle-disable-subscription": 690 case "toggle-disable-subscription":
694 browser.runtime.sendMessage({ 691 browser.runtime.sendMessage({
695 type: "subscriptions.toggle", 692 type: "subscriptions.toggle",
696 keepInstalled: true, 693 keepInstalled: true,
697 url: findParentData(element, "access", false) 694 url: findParentData(element, "access", false)
698 }); 695 });
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 }); 1417 });
1421 browser.runtime.sendMessage({ 1418 browser.runtime.sendMessage({
1422 type: "subscriptions.listen", 1419 type: "subscriptions.listen",
1423 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1420 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1424 "title", "downloadStatus", "downloading"] 1421 "title", "downloadStatus", "downloading"]
1425 }); 1422 });
1426 1423
1427 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1424 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1428 window.addEventListener("hashchange", onHashChange, false); 1425 window.addEventListener("hashchange", onHashChange, false);
1429 } 1426 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld