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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 { | 1148 { |
1150 // Load filters | 1149 // Load filters |
1151 for (let subscription of subscriptions) | 1150 for (let subscription of subscriptions) |
1152 { | 1151 { |
1153 browser.runtime.sendMessage({ | 1152 browser.runtime.sendMessage({ |
1154 type: "filters.get", | 1153 type: "filters.get", |
1155 subscriptionUrl: subscription.url | 1154 subscriptionUrl: subscription.url |
1156 }, | 1155 }, |
1157 (filters) => | 1156 (filters) => |
1158 { | 1157 { |
| 1158 // Reset each time as there might be several custom filters |
| 1159 if (isCustomFiltersLoaded) |
| 1160 isCustomFiltersLoaded = false; |
| 1161 |
1159 loadCustomFilters(filters); | 1162 loadCustomFilters(filters); |
| 1163 isCustomFiltersLoaded = true; |
1160 }); | 1164 }); |
1161 } | 1165 } |
1162 }); | 1166 }); |
1163 loadRecommendations(); | 1167 loadRecommendations(); |
1164 browser.runtime.sendMessage({ | 1168 browser.runtime.sendMessage({ |
1165 type: "prefs.get", | 1169 type: "prefs.get", |
1166 key: "subscriptions_exceptionsurl" | 1170 key: "subscriptions_exceptionsurl" |
1167 }, | 1171 }, |
1168 (url) => | 1172 (url) => |
1169 { | 1173 { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 "ui_warn_tracking"] | 1469 "ui_warn_tracking"] |
1466 }); | 1470 }); |
1467 browser.runtime.sendMessage({ | 1471 browser.runtime.sendMessage({ |
1468 type: "subscriptions.listen", | 1472 type: "subscriptions.listen", |
1469 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1473 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1470 "title", "downloadStatus", "downloading"] | 1474 "title", "downloadStatus", "downloading"] |
1471 }); | 1475 }); |
1472 | 1476 |
1473 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1477 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1474 window.addEventListener("hashchange", onHashChange, false); | 1478 window.addEventListener("hashchange", onHashChange, false); |
OLD | NEW |