| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 function updateFilter(filter) | 428 function updateFilter(filter) |
| 429 { | 429 { |
| 430 let match = filter.text.match(whitelistedDomainRegexp); | 430 let match = filter.text.match(whitelistedDomainRegexp); |
| 431 if (match && !filtersMap[filter.text]) | 431 if (match && !filtersMap[filter.text]) |
| 432 { | 432 { |
| 433 filter.title = match[1]; | 433 filter.title = match[1]; |
| 434 collections.whitelist.addItem(filter); | 434 collections.whitelist.addItem(filter); |
| 435 if (isCustomFiltersLoaded) |
| 436 { |
| 437 let text = getMessage("options_whitelist_notification", [filter.title]); |
| 438 showNotification(text); |
| 439 } |
| 435 } | 440 } |
| 436 else | 441 else |
| 437 { | 442 { |
| 438 customFilters.push(filter.text); | 443 customFilters.push(filter.text); |
| 439 if (isCustomFiltersLoaded) | 444 if (isCustomFiltersLoaded) |
| 440 updateCustomFiltersUi(); | 445 updateCustomFiltersUi(); |
| 441 } | 446 } |
| 442 | 447 |
| 443 filtersMap[filter.text] = filter; | 448 filtersMap[filter.text] = filter; |
| 444 } | 449 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 break; | 583 break; |
| 579 } | 584 } |
| 580 } | 585 } |
| 581 break; | 586 break; |
| 582 case "close-dialog": | 587 case "close-dialog": |
| 583 closeDialog(); | 588 closeDialog(); |
| 584 break; | 589 break; |
| 585 case "edit-custom-filters": | 590 case "edit-custom-filters": |
| 586 setCustomFiltersView("write"); | 591 setCustomFiltersView("write"); |
| 587 break; | 592 break; |
| 593 case "hide-notification": |
| 594 hideNotification(); |
| 595 break; |
| 588 case "import-subscription": { | 596 case "import-subscription": { |
| 589 let url = E("blockingList-textbox").value; | 597 let url = E("blockingList-textbox").value; |
| 590 addEnableSubscription(url); | 598 addEnableSubscription(url); |
| 591 closeDialog(); | 599 closeDialog(); |
| 592 break; | 600 break; |
| 593 } | 601 } |
| 594 case "open-context-menu": { | 602 case "open-context-menu": { |
| 595 let listItem = findParentData(element, "access", true); | 603 let listItem = findParentData(element, "access", true); |
| 596 if (listItem && !listItem.classList.contains("show-context-menu")) | 604 if (listItem && !listItem.classList.contains("show-context-menu")) |
| 597 listItem.classList.add("show-context-menu"); | 605 listItem.classList.add("show-context-menu"); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 | 976 |
| 969 function closeDialog() | 977 function closeDialog() |
| 970 { | 978 { |
| 971 let dialog = E("dialog"); | 979 let dialog = E("dialog"); |
| 972 dialog.setAttribute("aria-hidden", true); | 980 dialog.setAttribute("aria-hidden", true); |
| 973 dialog.removeAttribute("aria-labelledby"); | 981 dialog.removeAttribute("aria-labelledby"); |
| 974 document.body.removeAttribute("data-dialog"); | 982 document.body.removeAttribute("data-dialog"); |
| 975 focusedBeforeDialog.focus(); | 983 focusedBeforeDialog.focus(); |
| 976 } | 984 } |
| 977 | 985 |
| 986 function showNotification(text) |
| 987 { |
| 988 E("notification").setAttribute("aria-hidden", false); |
| 989 E("notification-text").textContent = text; |
| 990 setTimeout(hideNotification, 3000); |
| 991 } |
| 992 |
| 993 function hideNotification() |
| 994 { |
| 995 E("notification").setAttribute("aria-hidden", true); |
| 996 E("notification-text").textContent = ""; |
| 997 } |
| 998 |
| 978 function setAcceptableAds() | 999 function setAcceptableAds() |
| 979 { | 1000 { |
| 980 let option = "none"; | 1001 let option = "none"; |
| 981 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); | 1002 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); |
| 982 if (acceptableAdsUrl in subscriptionsMap) | 1003 if (acceptableAdsUrl in subscriptionsMap) |
| 983 { | 1004 { |
| 984 option = "ads"; | 1005 option = "ads"; |
| 985 } | 1006 } |
| 986 else if (acceptableAdsPrivacyUrl in subscriptionsMap) | 1007 else if (acceptableAdsPrivacyUrl in subscriptionsMap) |
| 987 { | 1008 { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 }); | 1370 }); |
| 1350 ext.backgroundPage.sendMessage({ | 1371 ext.backgroundPage.sendMessage({ |
| 1351 type: "subscriptions.listen", | 1372 type: "subscriptions.listen", |
| 1352 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1373 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1353 "title", "downloadStatus", "downloading"] | 1374 "title", "downloadStatus", "downloading"] |
| 1354 }); | 1375 }); |
| 1355 | 1376 |
| 1356 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1377 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1357 window.addEventListener("hashchange", onHashChange, false); | 1378 window.addEventListener("hashchange", onHashChange, false); |
| 1358 } | 1379 } |
| OLD | NEW |