5 lines
1.4 KiB
JavaScript
5 lines
1.4 KiB
JavaScript
function inputPhoneSubject(a,b,c,d,e){this.number=a;this.username=b;this.firstname=c;this.lastname=d;this.store_button=e}inputPhoneSubject.prototype={store_button:this.store_button,number:this.number,username:this.username,firstname:this.firstname,lastname:this.lastname};inputPhoneSubject.prototype.check=function(){var a=0<this.number.value.length;return a=a&&0<this.username.value.length+this.firstname.value.length+this.lastname.value.length};
|
|
inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("subject",0,{number:this.number.value,username:this.username.value,firstname:this.firstname.value,lastname:this.lastname.value})};
|
|
inputPhoneSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("subject",0);null==a&&(a={number:"",username:"",firstname:"",lastname:""});this.number.value=a.number;this.username.value=a.username;this.firstname.value=a.firstname;this.lastname.value=a.lastname};
|
|
inputPhoneSubject.prototype.attach=function(){function a(a){b.fieldsToStorage()&&b.storageToFields()}console.log("SUBJECT: ATTACH");lsi.createDataset("subject");var b=this;this.store_button.addEventListener("click",a,!1);this.number.addEventListener("blur",a,!1);this.username.addEventListener("blur",a,!1);this.firstname.addEventListener("blur",a,!1);this.lastname.addEventListener("blur",a,!1);this.storageToFields()};
|