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

Unified Diff: new-options.js

Issue 29549891: Issue 5706 - Finish custom filter list dialog (Closed)
Patch Set: Created Sept. 19, 2017, 6:43 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: new-options.js
===================================================================
--- a/new-options.js
+++ b/new-options.js
@@ -677,6 +677,16 @@
url: findParentData(element, "access", false)
});
break;
+ case "validate-import-subscription":
+ let form = findParentData(element, "validation", true);
+ if (form && form.checkValidity())
+ {
+ addEnableSubscription(E("import-list-url").value,
+ E("import-list-title").value);
+ form.reset();
+ closeDialog();
+ }
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
+ break;
}
}
@@ -832,6 +842,22 @@
// Initialize interactive UI elements
document.body.addEventListener("click", onClick, false);
document.body.addEventListener("keyup", onKeyUp, false);
+ 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.
+ {
+ e.preventDefault();
+ }, false);
+
+ // Overwrite form input validation
+ let forms = document.querySelectorAll("[data-validation]");
+ for (let form of forms)
+ {
+ form.addEventListener("invalid", (e) =>
+ {
+ e.preventDefault();
+ 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.
+ }, true);
+ }
+
let exampleValue = getMessage("options_whitelist_placeholder_example",
["www.example.com"]);
E("whitelisting-textbox").setAttribute("placeholder", exampleValue);

Powered by Google App Engine
This is Rietveld