NxTIC/js/includes/input-phone-subject-min.js

4 lines
1.2 KiB
JavaScript
Raw Normal View History

function inputPhoneSubject(a,b,c,d){this.tmp_id=a;this.number=c;this.subject_id=b;this.store_button=d}inputPhoneSubject.prototype={store_button:this.store_button,tmp_id:this.tmp_id,number:this.number,subject_id:this.subject_id};inputPhoneSubject.prototype.check=function(){return 0<this.number.value.length&&0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};
inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("p_subject",0,{tmp_id:this.tmp_id.value,number:this.number.value,subject_id:this.subject_id.value})};inputPhoneSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("p_subject",0);null==a&&(a={tmp_id:"",number:"",subject_id:""});this.tmp_id.value=a.tmp_id;this.number.value=a.number;this.subject_id.value=a.subject_id};
inputPhoneSubject.prototype.attach=function(){function a(a){b.fieldsToStorage()&&b.storageToFields()}console.log("SUBJECT: ATTACH");lsi.createDataset("p_subject");var b=this;this.store_button.addEventListener("click",a,!1);this.number.addEventListener("blur",a,!1);this.subject_id.addEventListener("blur",a,!1);this.storageToFields()};