|
@@ -1,12 +1,25 @@
|
|
|
function Password(parent, open){
|
|
|
- this.textBox = document.createElement("input")
|
|
|
- this.textBox.setAttribute("type", "password")
|
|
|
- parent.appendChild(this.textBox)
|
|
|
- this.checkBox = document.createElement("input")
|
|
|
- this.checkBox.setAttribute("type", "checkbox")
|
|
|
- parent.appendChild(this.checkBox)
|
|
|
+ this.loginBox = document.createElement("input");
|
|
|
+ this.loginBox.setAttribute("type", "text");
|
|
|
+ parent.appendChild(this.loginBox)
|
|
|
+ this.textBox = document.createElement("input");
|
|
|
+ this.textBox.setAttribute("type", "password");
|
|
|
+ parent.appendChild(this.textBox);
|
|
|
+ this.checkBox = document.createElement("input");
|
|
|
+ this.checkBox.setAttribute("type", "checkbox");
|
|
|
+ parent.appendChild(this.checkBox);
|
|
|
+ this.sendBottom = document.createElement("button");
|
|
|
+ this.sendBottom.setAttribute("disabled", true);
|
|
|
+ this.sendBottom.innerText = "send";
|
|
|
+ this.sendOnChange = function() {
|
|
|
+ if(this.textBox.value != "" && this.loginBox.value != "") {
|
|
|
+ return this.sendBottom.removeAttribute("disabled");
|
|
|
+ } return this.sendBottom.setAttribute("disabled", true);
|
|
|
+ }
|
|
|
+
|
|
|
+ parent.appendChild(this.sendBottom)
|
|
|
|
|
|
- this.isChecked = function(checkBox, textBox) {
|
|
|
+ this.isChecked = function() {
|
|
|
if(open === false){
|
|
|
this.textBox.setAttribute("type", "password")
|
|
|
open = true;
|
|
@@ -32,12 +45,16 @@ function Password(parent, open){
|
|
|
return data;
|
|
|
|
|
|
}
|
|
|
+ this.loginBox.oninput = () => this.sendOnChange()
|
|
|
|
|
|
this.checkBox.onchange = () => {
|
|
|
this.isChecked(this.checkBox, this.textBox)
|
|
|
this.onOpenChange(this.getOpen())
|
|
|
};
|
|
|
- this.textBox.oninput = () => this.onChange(this.getValue(this.textBox));
|
|
|
+ this.textBox.oninput = () => {
|
|
|
+ this.onChange(this.getValue(this.textBox));
|
|
|
+ this.sendOnChange();
|
|
|
+ }
|
|
|
this.setOpen = function(arg) {
|
|
|
if(!arg == true){
|
|
|
this.checkBox.checked = "checked"
|
|
@@ -45,6 +62,7 @@ function Password(parent, open){
|
|
|
this.checkBox.checked = ""
|
|
|
}
|
|
|
this.isChecked()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|