| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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") | 448 if (property == "title" && subscription.url in recommendationsMap) |
|
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 knownSubscription.originalTitle = subscription.title; | |
| 450 else | |
| 449 knownSubscription[property] = subscription[property]; | 451 knownSubscription[property] = subscription[property]; |
| 450 } | 452 } |
| 451 else | 453 else |
| 452 { | 454 { |
| 453 observeSubscription(subscription); | 455 observeSubscription(subscription); |
| 454 getAcceptableAdsURL(function(acceptableAdsUrl) | 456 getAcceptableAdsURL(function(acceptableAdsUrl) |
| 455 { | 457 { |
| 456 var collection = null; | 458 var collection = null; |
| 457 if (subscriptionUrl in recommendationsMap) | 459 if (subscriptionUrl in recommendationsMap) |
| 458 { | 460 { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 var knownSubscription = subscriptionsMap[subscription.url]; | 970 var knownSubscription = subscriptionsMap[subscription.url]; |
| 969 if (knownSubscription) | 971 if (knownSubscription) |
| 970 collections.filterLists.addItems(knownSubscription); | 972 collections.filterLists.addItems(knownSubscription); |
| 971 else | 973 else |
| 972 collections.filterLists.addItems(subscription); | 974 collections.filterLists.addItems(subscription); |
| 973 break; | 975 break; |
| 974 case "disabled": | 976 case "disabled": |
| 975 updateSubscription(subscription); | 977 updateSubscription(subscription); |
| 976 updateShareLink(); | 978 updateShareLink(); |
| 977 break; | 979 break; |
| 978 case "lastDownload": | |
| 979 case "downloadStatus": | |
| 980 case "downloading": | |
| 981 updateSubscription(subscription); | |
| 982 break; | |
| 983 case "homepage": | |
| 984 // TODO: NYI | |
| 985 break; | |
| 986 case "removed": | 980 case "removed": |
| 987 var knownSubscription = subscriptionsMap[subscription.url]; | 981 var knownSubscription = subscriptionsMap[subscription.url]; |
| 988 getAcceptableAdsURL(function(acceptableAdsUrl) | 982 getAcceptableAdsURL(function(acceptableAdsUrl) |
| 989 { | 983 { |
| 990 if (subscription.url == acceptableAdsUrl) | 984 if (subscription.url == acceptableAdsUrl) |
| 991 { | 985 { |
| 992 subscription.disabled = true; | 986 subscription.disabled = true; |
| 993 updateSubscription(subscription); | 987 updateSubscription(subscription); |
| 994 } | 988 } |
| 995 else | 989 else |
| 996 { | 990 { |
| 997 if (subscription.url in recommendationsMap) | 991 if (subscription.url in recommendationsMap) |
| 998 knownSubscription.disabled = true; | 992 knownSubscription.disabled = true; |
| 999 else | 993 else |
| 1000 { | 994 { |
| 1001 collections.custom.removeItem(knownSubscription); | 995 collections.custom.removeItem(knownSubscription); |
| 1002 delete subscriptionsMap[subscription.url]; | 996 delete subscriptionsMap[subscription.url]; |
| 1003 } | 997 } |
| 1004 } | 998 } |
| 1005 updateShareLink(); | 999 updateShareLink(); |
| 1006 collections.filterLists.removeItem(knownSubscription); | 1000 collections.filterLists.removeItem(knownSubscription); |
| 1007 }); | 1001 }); |
| 1008 break; | 1002 break; |
| 1009 case "title": | 1003 default: |
| 1010 // TODO: NYI | 1004 updateSubscription(subscription); |
| 1011 break; | 1005 break; |
| 1012 } | 1006 } |
| 1013 } | 1007 } |
| 1014 | 1008 |
| 1015 function hidePref(key, value) | 1009 function hidePref(key, value) |
| 1016 { | 1010 { |
| 1017 var element = document.querySelector("[data-pref='" + key + "']"); | 1011 var element = document.querySelector("[data-pref='" + key + "']"); |
| 1018 if (element) | 1012 if (element) |
| 1019 element.setAttribute("aria-hidden", value); | 1013 element.setAttribute("aria-hidden", value); |
| 1020 } | 1014 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1164 }); | 1158 }); |
| 1165 ext.backgroundPage.sendMessage( | 1159 ext.backgroundPage.sendMessage( |
| 1166 { | 1160 { |
| 1167 type: "subscriptions.listen", | 1161 type: "subscriptions.listen", |
| 1168 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1162 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1169 "title", "downloadStatus", "downloading"] | 1163 "title", "downloadStatus", "downloading"] |
| 1170 }); | 1164 }); |
| 1171 | 1165 |
| 1172 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1166 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1173 })(); | 1167 })(); |
| OLD | NEW |