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

Delta Between Two Patch Sets: options.js

Issue 29339395: Noissue - Make the options page respond to subscription title and homepage changes (Closed)
Left Patch Set: Created April 5, 2016, 7:05 p.m.
Right Patch Set: Addressed comments Created April 6, 2016, 5:25 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 | « messageResponder.js ('k') | no next file » | 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 Object.observe(subscription, onObjectChanged); 437 Object.observe(subscription, onObjectChanged);
438 } 438 }
439 } 439 }
440 440
441 function updateSubscription(subscription) 441 function updateSubscription(subscription)
442 { 442 {
443 var subscriptionUrl = subscription.url; 443 var subscriptionUrl = subscription.url;
444 var knownSubscription = subscriptionsMap[subscriptionUrl]; 444 var knownSubscription = subscriptionsMap[subscriptionUrl];
445 if (knownSubscription) 445 if (knownSubscription)
446 { 446 {
447 for (var property in subscription) 447 for (var property in subscription)
Thomas Greiner 2016/04/06 13:51:18 Detail: I know that this is valid JavaScript and I
Sebastian Noack 2016/04/06 17:26:29 Done.
448 if (property == "title" && subscription.url in recommendationsMap) 448 {
Thomas Greiner 2016/04/06 13:51:18 Detail: I noticed that there's a variable `subscri
Sebastian Noack 2016/04/06 17:26:29 Done.
449 if (property == "title" && subscriptionUrl in recommendationsMap)
449 knownSubscription.originalTitle = subscription.title; 450 knownSubscription.originalTitle = subscription.title;
450 else 451 else
451 knownSubscription[property] = subscription[property]; 452 knownSubscription[property] = subscription[property];
453 }
452 } 454 }
453 else 455 else
454 { 456 {
455 observeSubscription(subscription); 457 observeSubscription(subscription);
456 getAcceptableAdsURL(function(acceptableAdsUrl) 458 getAcceptableAdsURL(function(acceptableAdsUrl)
457 { 459 {
458 var collection = null; 460 var collection = null;
459 if (subscriptionUrl in recommendationsMap) 461 if (subscriptionUrl in recommendationsMap)
460 { 462 {
461 var recommendation = recommendationsMap[subscriptionUrl]; 463 var recommendation = recommendationsMap[subscriptionUrl];
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 { 909 {
908 var customFilterItems = collections.customFilters.items; 910 var customFilterItems = collections.customFilters.items;
909 var filterTexts = []; 911 var filterTexts = [];
910 for (var i = 0; i < customFilterItems.length; i++) 912 for (var i = 0; i < customFilterItems.length; i++)
911 filterTexts.push(customFilterItems[i].text); 913 filterTexts.push(customFilterItems[i].text);
912 E("custom-filters-raw").value = filterTexts.join("\n"); 914 E("custom-filters-raw").value = filterTexts.join("\n");
913 } 915 }
914 916
915 function getAcceptableAdsURL(callback) 917 function getAcceptableAdsURL(callback)
916 { 918 {
917 getPref("subscriptions_exceptionsurl", callback); 919 getPref("subscriptions_exceptionsurl", function(value)
Sebastian Noack 2016/04/06 17:26:30 Please ignore this change. It's not part of the pa
920 {
921 getAcceptableAdsURL = function(callback)
922 {
923 callback(value);
924 };
925 getAcceptableAdsURL(callback);
926 });
918 } 927 }
919 928
920 function addEnableSubscription(url, title, homepage) 929 function addEnableSubscription(url, title, homepage)
921 { 930 {
922 var messageType = null; 931 var messageType = null;
923 var knownSubscription = subscriptionsMap[url]; 932 var knownSubscription = subscriptionsMap[url];
924 if (knownSubscription && knownSubscription.disabled == true) 933 if (knownSubscription && knownSubscription.disabled == true)
925 messageType = "subscriptions.toggle" 934 messageType = "subscriptions.toggle"
926 else 935 else
927 messageType = "subscriptions.add" 936 messageType = "subscriptions.add"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 }); 1167 });
1159 ext.backgroundPage.sendMessage( 1168 ext.backgroundPage.sendMessage(
1160 { 1169 {
1161 type: "subscriptions.listen", 1170 type: "subscriptions.listen",
1162 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1171 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1163 "title", "downloadStatus", "downloading"] 1172 "title", "downloadStatus", "downloading"]
1164 }); 1173 });
1165 1174
1166 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1175 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1167 })(); 1176 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld