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

5 lines
1.2 KiB
JavaScript
Raw Normal View History

function inputPhoneSubject(a,b){this.subject_id=a;this.store_button=b}inputPhoneSubject.prototype={store_button:this.store_button,subject_id:this.subject_id,handler:null};inputPhoneSubject.prototype.check=function(){return 0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};
inputPhoneSubject.prototype.fieldsToStorage=function(){console.group("[phone.subject] fields to storage");if(!this.check())return!1;if(0<lsi.keys("p_contacts").length)return Notification.warning("Attention","Vous devez effacer le formulaire pour changer de sujet"),!1;lsi.set("p_subject",0,{subject_id:this.subject_id.value});console.groupEnd()};
inputPhoneSubject.prototype.storageToFields=function(){console.group("[phone.subject] storage to fields");var a=lsi.get("p_subject",0),a=a||{subject_id:""};this.subject_id.value=a.subject_id;console.groupEnd()};
inputPhoneSubject.prototype.attach=function(a){console.group("[phone.subject] attaching events");lsi.createDataset("p_subject");lsi.createDataset("p_friends");this.handler=a;a=function(a){this.fieldsToStorage();this.handler(!0);this.storageToFields()}.bind(this);this.store_button.addEventListener("click",a,!1);this.storageToFields();console.groupEnd()};