| 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-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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 461 | 461 | 
| 462   filtersMap[filter.text] = filter; | 462   filtersMap[filter.text] = filter; | 
| 463 } | 463 } | 
| 464 | 464 | 
| 465 function loadCustomFilters(filters) | 465 function loadCustomFilters(filters) | 
| 466 { | 466 { | 
| 467   for (let filter of filters) | 467   for (let filter of filters) | 
| 468     updateFilter(filter); | 468     updateFilter(filter); | 
| 469 | 469 | 
| 470   setCustomFiltersView("read"); | 470   setCustomFiltersView("read"); | 
| 471   isCustomFiltersLoaded = true; |  | 
| 472 } | 471 } | 
| 473 | 472 | 
| 474 function removeCustomFilter(text) | 473 function removeCustomFilter(text) | 
| 475 { | 474 { | 
| 476   let index = customFilters.indexOf(text); | 475   let index = customFilters.indexOf(text); | 
| 477   if (index >= 0) | 476   if (index >= 0) | 
| 478     customFilters.splice(index, 1); | 477     customFilters.splice(index, 1); | 
| 479 | 478 | 
| 480   updateCustomFiltersUi(); | 479   updateCustomFiltersUi(); | 
| 481 } | 480 } | 
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1140   for (let property in collections) | 1139   for (let property in collections) | 
| 1141     collections[property].clearAll(); | 1140     collections[property].clearAll(); | 
| 1142 | 1141 | 
| 1143   setCustomFiltersView("empty"); | 1142   setCustomFiltersView("empty"); | 
| 1144   browser.runtime.sendMessage({ | 1143   browser.runtime.sendMessage({ | 
| 1145     type: "subscriptions.get", | 1144     type: "subscriptions.get", | 
| 1146     special: true | 1145     special: true | 
| 1147   }, | 1146   }, | 
| 1148   (subscriptions) => | 1147   (subscriptions) => | 
| 1149   { | 1148   { | 
| 1150     // Load filters | 1149     let customFilterPromises = subscriptions.map(getSubscriptionFilters); | 
| 1151     for (let subscription of subscriptions) | 1150     Promise.all(customFilterPromises).then((filters) => | 
| 1152     { | 1151     { | 
| 1153       browser.runtime.sendMessage({ | 1152       loadCustomFilters([].concat(...filters)); | 
| 1154         type: "filters.get", | 1153       isCustomFiltersLoaded = true; | 
| 1155         subscriptionUrl: subscription.url | 1154     }); | 
| 1156       }, |  | 
| 1157       (filters) => |  | 
| 1158       { |  | 
| 1159         loadCustomFilters(filters); |  | 
| 1160       }); |  | 
| 1161     } |  | 
| 1162   }); | 1155   }); | 
| 1163   loadRecommendations(); | 1156   loadRecommendations(); | 
| 1164   browser.runtime.sendMessage({ | 1157   browser.runtime.sendMessage({ | 
| 1165     type: "prefs.get", | 1158     type: "prefs.get", | 
| 1166     key: "subscriptions_exceptionsurl" | 1159     key: "subscriptions_exceptionsurl" | 
| 1167   }, | 1160   }, | 
| 1168   (url) => | 1161   (url) => | 
| 1169   { | 1162   { | 
| 1170     acceptableAdsUrl = url; | 1163     acceptableAdsUrl = url; | 
| 1171 | 1164 | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1328           collections.more.removeItem(subscription); | 1321           collections.more.removeItem(subscription); | 
| 1329         } | 1322         } | 
| 1330       } | 1323       } | 
| 1331 | 1324 | 
| 1332       collections.filterLists.removeItem(subscription); | 1325       collections.filterLists.removeItem(subscription); | 
| 1333       setPrivacyConflict(); | 1326       setPrivacyConflict(); | 
| 1334       break; | 1327       break; | 
| 1335   } | 1328   } | 
| 1336 } | 1329 } | 
| 1337 | 1330 | 
|  | 1331 function getSubscriptionFilters(subscription) | 
|  | 1332 { | 
|  | 1333   return browser.runtime.sendMessage({ | 
|  | 1334     type: "filters.get", | 
|  | 1335     subscriptionUrl: subscription.url}); | 
|  | 1336 } | 
|  | 1337 | 
| 1338 function hidePref(key, value) | 1338 function hidePref(key, value) | 
| 1339 { | 1339 { | 
| 1340   let element = document.querySelector("[data-pref='" + key + "']"); | 1340   let element = document.querySelector("[data-pref='" + key + "']"); | 
| 1341   if (element) | 1341   if (element) | 
| 1342     element.setAttribute("aria-hidden", value); | 1342     element.setAttribute("aria-hidden", value); | 
| 1343 } | 1343 } | 
| 1344 | 1344 | 
| 1345 function getPref(key, callback) | 1345 function getPref(key, callback) | 
| 1346 { | 1346 { | 
| 1347   let checkPref = getPref.checks[key] || getPref.checkNone; | 1347   let checkPref = getPref.checks[key] || getPref.checkNone; | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1465            "ui_warn_tracking"] | 1465            "ui_warn_tracking"] | 
| 1466 }); | 1466 }); | 
| 1467 browser.runtime.sendMessage({ | 1467 browser.runtime.sendMessage({ | 
| 1468   type: "subscriptions.listen", | 1468   type: "subscriptions.listen", | 
| 1469   filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1469   filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 
| 1470            "title", "downloadStatus", "downloading"] | 1470            "title", "downloadStatus", "downloading"] | 
| 1471 }); | 1471 }); | 
| 1472 | 1472 | 
| 1473 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1473 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 
| 1474 window.addEventListener("hashchange", onHashChange, false); | 1474 window.addEventListener("hashchange", onHashChange, false); | 
| OLD | NEW | 
|---|