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-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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 break; | 586 break; |
582 } | 587 } |
583 } | 588 } |
584 break; | 589 break; |
585 case "close-dialog": | 590 case "close-dialog": |
586 closeDialog(); | 591 closeDialog(); |
587 break; | 592 break; |
588 case "edit-custom-filters": | 593 case "edit-custom-filters": |
589 setCustomFiltersView("write"); | 594 setCustomFiltersView("write"); |
590 break; | 595 break; |
596 case "hide-notification": | |
597 hideNotification(); | |
598 break; | |
591 case "import-subscription": { | 599 case "import-subscription": { |
592 let url = E("blockingList-textbox").value; | 600 let url = E("blockingList-textbox").value; |
593 addEnableSubscription(url); | 601 addEnableSubscription(url); |
594 closeDialog(); | 602 closeDialog(); |
595 break; | 603 break; |
596 } | 604 } |
597 case "open-context-menu": { | 605 case "open-context-menu": { |
598 let listItem = findParentData(element, "access", true); | 606 let listItem = findParentData(element, "access", true); |
599 if (listItem && !listItem.classList.contains("show-context-menu")) | 607 if (listItem && !listItem.classList.contains("show-context-menu")) |
600 listItem.classList.add("show-context-menu"); | 608 listItem.classList.add("show-context-menu"); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 | 994 |
987 function closeDialog() | 995 function closeDialog() |
988 { | 996 { |
989 let dialog = E("dialog"); | 997 let dialog = E("dialog"); |
990 dialog.setAttribute("aria-hidden", true); | 998 dialog.setAttribute("aria-hidden", true); |
991 dialog.removeAttribute("aria-labelledby"); | 999 dialog.removeAttribute("aria-labelledby"); |
992 document.body.removeAttribute("data-dialog"); | 1000 document.body.removeAttribute("data-dialog"); |
993 focusedBeforeDialog.focus(); | 1001 focusedBeforeDialog.focus(); |
994 } | 1002 } |
995 | 1003 |
1004 function showNotification(text) | |
1005 { | |
1006 E("notification").setAttribute("aria-hidden", false); | |
ire
2017/08/24 10:08:44
The aria-live attribute could also be relevant her
saroyanm
2017/08/24 14:18:25
Agree
saroyanm
2017/08/24 18:40:54
Done.
| |
1007 E("notification-text").textContent = text; | |
1008 setTimeout(hideNotification, 3000); | |
ire
2017/08/24 10:08:43
(Personal Opinion) I think 3 seconds is too short
saroyanm
2017/08/24 14:18:26
That's specified in the specs, let's be consistent
ire
2017/08/25 09:59:44
Acknowledged.
| |
1009 } | |
1010 | |
1011 function hideNotification() | |
1012 { | |
1013 E("notification").setAttribute("aria-hidden", true); | |
ire
2017/08/24 10:08:44
NIT: Clear the textContent as well?
saroyanm
2017/08/24 14:18:26
Yes, I'll update that.
saroyanm
2017/08/24 18:40:54
Done.
| |
1014 } | |
1015 | |
996 function setAcceptableAds() | 1016 function setAcceptableAds() |
997 { | 1017 { |
998 let option = "none"; | 1018 let option = "none"; |
999 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); | 1019 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); |
1000 if (acceptableAdsUrl in subscriptionsMap) | 1020 if (acceptableAdsUrl in subscriptionsMap) |
1001 { | 1021 { |
1002 option = "ads"; | 1022 option = "ads"; |
1003 } | 1023 } |
1004 else if (acceptableAdsPrivacyUrl in subscriptionsMap) | 1024 else if (acceptableAdsPrivacyUrl in subscriptionsMap) |
1005 { | 1025 { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1367 }); | 1387 }); |
1368 ext.backgroundPage.sendMessage({ | 1388 ext.backgroundPage.sendMessage({ |
1369 type: "subscriptions.listen", | 1389 type: "subscriptions.listen", |
1370 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1390 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1371 "title", "downloadStatus", "downloading"] | 1391 "title", "downloadStatus", "downloading"] |
1372 }); | 1392 }); |
1373 | 1393 |
1374 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1394 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1375 window.addEventListener("hashchange", onHashChange, false); | 1395 window.addEventListener("hashchange", onHashChange, false); |
1376 } | 1396 } |
OLD | NEW |