Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: new-options.js

Issue 29549891: Issue 5706 - Finish custom filter list dialog (Closed)
Patch Set: Created Sept. 19, 2017, 6:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 ext.backgroundPage.sendMessage({ 670 ext.backgroundPage.sendMessage({
671 type: "subscriptions.update" 671 type: "subscriptions.update"
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":
681 let form = findParentData(element, "validation", true);
682 if (form && form.checkValidity())
683 {
684 addEnableSubscription(E("import-list-url").value,
685 E("import-list-title").value);
686 form.reset();
687 closeDialog();
688 }
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;
680 } 690 }
681 } 691 }
682 692
683 function setCustomFiltersView(mode) 693 function setCustomFiltersView(mode)
684 { 694 {
685 let customFiltersElement = E("custom-filters-raw"); 695 let customFiltersElement = E("custom-filters-raw");
686 updateCustomFiltersUi(); 696 updateCustomFiltersUi();
687 if (mode == "read") 697 if (mode == "read")
688 { 698 {
689 customFiltersElement.disabled = true; 699 customFiltersElement.disabled = true;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 { 835 {
826 E("abp-version").textContent = getMessage("options_dialog_about_version", 836 E("abp-version").textContent = getMessage("options_dialog_about_version",
827 [addonVersion]); 837 [addonVersion]);
828 }); 838 });
829 839
830 updateTooltips(); 840 updateTooltips();
831 841
832 // Initialize interactive UI elements 842 // Initialize interactive UI elements
833 document.body.addEventListener("click", onClick, false); 843 document.body.addEventListener("click", onClick, false);
834 document.body.addEventListener("keyup", onKeyUp, false); 844 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
835 let exampleValue = getMessage("options_whitelist_placeholder_example", 861 let exampleValue = getMessage("options_whitelist_placeholder_example",
836 ["www.example.com"]); 862 ["www.example.com"]);
837 E("whitelisting-textbox").setAttribute("placeholder", exampleValue); 863 E("whitelisting-textbox").setAttribute("placeholder", exampleValue);
838 E("whitelisting-textbox").addEventListener("keyup", (e) => 864 E("whitelisting-textbox").addEventListener("keyup", (e) =>
839 { 865 {
840 E("whitelisting-add-button").disabled = !e.target.value; 866 E("whitelisting-add-button").disabled = !e.target.value;
841 }, false); 867 }, false);
842 868
843 869
844 getDocLink("contribute", (link) => 870 getDocLink("contribute", (link) =>
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 }); 1359 });
1334 ext.backgroundPage.sendMessage({ 1360 ext.backgroundPage.sendMessage({
1335 type: "subscriptions.listen", 1361 type: "subscriptions.listen",
1336 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1362 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1337 "title", "downloadStatus", "downloading"] 1363 "title", "downloadStatus", "downloading"]
1338 }); 1364 });
1339 1365
1340 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1366 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1341 window.addEventListener("hashchange", onHashChange, false); 1367 window.addEventListener("hashchange", onHashChange, false);
1342 } 1368 }
OLDNEW

Powered by Google App Engine
This is Rietveld