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

Delta Between Two Patch Sets: new-options.js

Issue 29519669: Issue 5539 - Implement "Acceptable Ads notification" (Closed)
Left Patch Set: Created Sept. 21, 2017, 3:26 p.m.
Right Patch Set: Addressed Thomas comment from patchset 6 Created Sept. 22, 2017, 10:28 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 | « new-options.html ('k') | skin/new-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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ]); 365 ]);
366 collections.filterLists = new Collection([ 366 collections.filterLists = new Collection([
367 { 367 {
368 id: "all-filter-lists-table", 368 id: "all-filter-lists-table",
369 useOriginalTitle: true 369 useOriginalTitle: true
370 } 370 }
371 ]); 371 ]);
372 372
373 function addSubscription(subscription) 373 function addSubscription(subscription)
374 { 374 {
375 let {disabled} = subscription; 375 let {disabled} = subscription;
saroyanm 2017/09/21 15:50:40 Note: This is part of eslint error fix. I fixed co
376 let collection = null; 376 let collection = null;
377 if (subscription.recommended) 377 if (subscription.recommended)
378 { 378 {
379 if (subscription.recommended == "ads") 379 if (subscription.recommended == "ads")
380 { 380 {
381 if (disabled == false) 381 if (disabled == false)
382 collection = collections.langs; 382 collection = collections.langs;
383 383
384 collections.allLangs.addItem(subscription); 384 collections.allLangs.addItem(subscription);
385 } 385 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 ext.backgroundPage.sendMessage({ 670 ext.backgroundPage.sendMessage({
671 type: "subscriptions.update" 671 type: "subscriptions.update"
672 }); 672 });
673 break; 673 break;
674 case "update-subscription": 674 case "update-subscription":
675 ext.backgroundPage.sendMessage({ 675 ext.backgroundPage.sendMessage({
676 type: "subscriptions.update", 676 type: "subscriptions.update",
677 url: findParentData(element, "access", false) 677 url: findParentData(element, "access", false)
678 }); 678 });
679 break; 679 break;
680 case "validate-import-subscription":
681 let form = findParentData(element, "validation", true);
682 if (!form)
683 return;
684
685 if (form.checkValidity())
686 {
687 addEnableSubscription(E("import-list-url").value,
688 E("import-list-title").value);
689 form.reset();
690 closeDialog();
691 }
692 else
693 {
694 form.querySelector(":invalid").focus();
695 }
696 break;
680 } 697 }
681 } 698 }
682 699
683 function setCustomFiltersView(mode) 700 function setCustomFiltersView(mode)
684 { 701 {
685 let customFiltersElement = E("custom-filters-raw"); 702 let customFiltersElement = E("custom-filters-raw");
686 updateCustomFiltersUi(); 703 updateCustomFiltersUi();
687 if (mode == "read") 704 if (mode == "read")
688 { 705 {
689 customFiltersElement.disabled = true; 706 customFiltersElement.disabled = true;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 updateSubscription(subscription); 1198 updateSubscription(subscription);
1182 break; 1199 break;
1183 case "downloading": 1200 case "downloading":
1184 case "downloadStatus": 1201 case "downloadStatus":
1185 case "homepage": 1202 case "homepage":
1186 case "lastDownload": 1203 case "lastDownload":
1187 case "title": 1204 case "title":
1188 updateSubscription(subscription); 1205 updateSubscription(subscription);
1189 break; 1206 break;
1190 case "added": 1207 case "added":
1191 let {url} = subscription; 1208 let {url, recommended} = subscription;
1192 if (url in subscriptionsMap) 1209 if (url in subscriptionsMap)
1193 updateSubscription(subscription); 1210 updateSubscription(subscription);
1194 else 1211 else
1195 addSubscription(subscription); 1212 addSubscription(subscription);
1196 1213
1197 if (isAcceptableAds(url)) 1214 if (isAcceptableAds(url))
1198 setAcceptableAds(); 1215 setAcceptableAds();
1199 1216
1200 if (url == acceptableAdsUrl || subscription.recommended == "privacy") 1217 if ((url == acceptableAdsUrl || recommended == "privacy") &&
1218 hasPrivacyConflict())
1201 { 1219 {
1202 getPref("ui_warn_tracking", (showTrackingWarning) => 1220 getPref("ui_warn_tracking", (showTrackingWarning) =>
saroyanm 2017/09/21 15:50:40 I'm not sure if using promise is better in this ca
Thomas Greiner 2017/09/22 10:05:43 Using a promise you could've avoided making that r
saroyanm 2017/09/22 10:33:23 I agree, done.
1203 { 1221 {
1204 if (hasPrivacyConflict() && showTrackingWarning) 1222 if (showTrackingWarning)
1205 openDialog("tracking"); 1223 openDialog("tracking");
1206 }); 1224 });
1207 } 1225 }
1208 1226
1209 collections.filterLists.addItem(subscription); 1227 collections.filterLists.addItem(subscription);
1210 break; 1228 break;
1211 case "removed": 1229 case "removed":
1212 if (subscription.recommended) 1230 if (subscription.recommended)
1213 { 1231 {
1214 subscription.disabled = true; 1232 subscription.disabled = true;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 filter: ["addSubscription", "focusSection"] 1366 filter: ["addSubscription", "focusSection"]
1349 }); 1367 });
1350 ext.backgroundPage.sendMessage({ 1368 ext.backgroundPage.sendMessage({
1351 type: "filters.listen", 1369 type: "filters.listen",
1352 filter: ["added", "loaded", "removed"] 1370 filter: ["added", "loaded", "removed"]
1353 }); 1371 });
1354 ext.backgroundPage.sendMessage({ 1372 ext.backgroundPage.sendMessage({
1355 type: "prefs.listen", 1373 type: "prefs.listen",
1356 filter: ["notifications_ignoredcategories", "notifications_showui", 1374 filter: ["notifications_ignoredcategories", "notifications_showui",
1357 "show_devtools_panel", "shouldShowBlockElementMenu", 1375 "show_devtools_panel", "shouldShowBlockElementMenu",
1358 "ui_warn_tracking"] 1376 "ui_warn_tracking"]
Thomas Greiner 2017/09/22 10:05:43 Detail: We're no longer reacting to changes for th
1359 }); 1377 });
1360 ext.backgroundPage.sendMessage({ 1378 ext.backgroundPage.sendMessage({
1361 type: "subscriptions.listen", 1379 type: "subscriptions.listen",
1362 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1380 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1363 "title", "downloadStatus", "downloading"] 1381 "title", "downloadStatus", "downloading"]
1364 }); 1382 });
1365 1383
1366 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1384 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1367 window.addEventListener("hashchange", onHashChange, false); 1385 window.addEventListener("hashchange", onHashChange, false);
1368 } 1386 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld