| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 }); | 672 }); |
| 673 break; | 673 break; |
| 674 case "update-subscription": | 674 case "update-subscription": |
| 675 ext.backgroundPage.sendMessage({ | 675 ext.backgroundPage.sendMessage({ |
| 676 type: "subscriptions.update", | 676 type: "subscriptions.update", |
| 677 url: findParentData(element, "access", false) | 677 url: findParentData(element, "access", false) |
| 678 }); | 678 }); |
| 679 break; | 679 break; |
| 680 case "validate-import-subscription": | 680 case "validate-import-subscription": |
| 681 let form = findParentData(element, "validation", true); | 681 let form = findParentData(element, "validation", true); |
| 682 if (form && form.checkValidity()) | 682 if (!form) |
| 683 { | 683 return; |
| 684 addEnableSubscription(E("import-list-url").value, | 684 |
| 685 if (form.checkValidity()) | |
| 686 { | |
| 687 addEnableSubscription(E("import-list-url").value, | |
| 685 E("import-list-title").value); | 688 E("import-list-title").value); |
| 686 form.reset(); | 689 form.reset(); |
| 687 closeDialog(); | 690 closeDialog(); |
| 691 } | |
| 692 else | |
| 693 { | |
| 694 form.querySelector(":invalid").focus(); | |
| 688 } | 695 } |
|
ire
2017/09/20 14:53:12
I'm not sure why we need the eventListener on the
saroyanm
2017/09/21 19:07:54
You are absolutely right. The reason was because I
ire
2017/09/22 08:28:53
Got it :)
As long as the button will be changed t
| |
| 689 break; | 696 break; |
| 690 } | 697 } |
| 691 } | 698 } |
| 692 | 699 |
| 693 function setCustomFiltersView(mode) | 700 function setCustomFiltersView(mode) |
| 694 { | 701 { |
| 695 let customFiltersElement = E("custom-filters-raw"); | 702 let customFiltersElement = E("custom-filters-raw"); |
| 696 updateCustomFiltersUi(); | 703 updateCustomFiltersUi(); |
| 697 if (mode == "read") | 704 if (mode == "read") |
| 698 { | 705 { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 { | 842 { |
| 836 E("abp-version").textContent = getMessage("options_dialog_about_version", | 843 E("abp-version").textContent = getMessage("options_dialog_about_version", |
| 837 [addonVersion]); | 844 [addonVersion]); |
| 838 }); | 845 }); |
| 839 | 846 |
| 840 updateTooltips(); | 847 updateTooltips(); |
| 841 | 848 |
| 842 // Initialize interactive UI elements | 849 // Initialize interactive UI elements |
| 843 document.body.addEventListener("click", onClick, false); | 850 document.body.addEventListener("click", onClick, false); |
| 844 document.body.addEventListener("keyup", onKeyUp, false); | 851 document.body.addEventListener("keyup", onKeyUp, false); |
| 845 document.body.addEventListener("submit", (e) => | |
|
ire
2017/09/20 14:53:13
The "submit" event listener is only relevant to fo
saroyanm
2017/09/21 19:07:54
Well spotted, I Forgot to delete this.
Done.
| |
| 846 { | |
| 847 e.preventDefault(); | |
| 848 }, false); | |
| 849 | |
| 850 // Overwrite form input validation | |
| 851 let forms = document.querySelectorAll("[data-validation]"); | |
| 852 for (let form of forms) | |
| 853 { | |
| 854 form.addEventListener("invalid", (e) => | |
| 855 { | |
| 856 e.preventDefault(); | |
| 857 form.querySelector(":invalid").focus(); | |
|
saroyanm
2017/09/19 18:53:02
I need to select first invalid input
ire
2017/09/20 14:53:13
Acknowledged.
| |
| 858 }, true); | |
| 859 } | |
| 860 | |
| 861 let exampleValue = getMessage("options_whitelist_placeholder_example", | 852 let exampleValue = getMessage("options_whitelist_placeholder_example", |
| 862 ["www.example.com"]); | 853 ["www.example.com"]); |
| 863 E("whitelisting-textbox").setAttribute("placeholder", exampleValue); | 854 E("whitelisting-textbox").setAttribute("placeholder", exampleValue); |
| 864 E("whitelisting-textbox").addEventListener("keyup", (e) => | 855 E("whitelisting-textbox").addEventListener("keyup", (e) => |
| 865 { | 856 { |
| 866 E("whitelisting-add-button").disabled = !e.target.value; | 857 E("whitelisting-add-button").disabled = !e.target.value; |
| 867 }, false); | 858 }, false); |
| 868 | 859 |
| 869 | 860 |
| 870 getDocLink("contribute", (link) => | 861 getDocLink("contribute", (link) => |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1359 }); | 1350 }); |
| 1360 ext.backgroundPage.sendMessage({ | 1351 ext.backgroundPage.sendMessage({ |
| 1361 type: "subscriptions.listen", | 1352 type: "subscriptions.listen", |
| 1362 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1353 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1363 "title", "downloadStatus", "downloading"] | 1354 "title", "downloadStatus", "downloading"] |
| 1364 }); | 1355 }); |
| 1365 | 1356 |
| 1366 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1357 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1367 window.addEventListener("hashchange", onHashChange, false); | 1358 window.addEventListener("hashchange", onHashChange, false); |
| 1368 } | 1359 } |
| LEFT | RIGHT |