5 lines
1.3 KiB
JavaScript
5 lines
1.3 KiB
JavaScript
function inputFacebookSubject(a,c,b){this.subject_id=a;this.coords=c;this.store_button=b}inputFacebookSubject.prototype={store_button:this.store_button,subject_id:this.subject_id,coords:this.coords,handler:null};inputFacebookSubject.prototype.check=function(){return 0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};
|
|
inputFacebookSubject.prototype.fieldsToStorage=function(){console.group("[facebook.subject] fields to storage");if(!this.check())return!1;if(0<lsi.keys("f_contacts").length)return Notification.warning("Attention","Vous devez effacer le formulaire pour changer de sujet"),!1;lsi.set("f_subject",0,{subject_id:this.subject_id.value,coords:this.coords.value});console.groupEnd()};
|
|
inputFacebookSubject.prototype.storageToFields=function(){console.group("[facebook.subject] storage to fields");var a=lsi.get("f_subject",0);null==a&&(a={subject_id:""});this.subject_id.value=a.subject_id;this.coords.value=a.subject_id;console.groupEnd()};
|
|
inputFacebookSubject.prototype.attach=function(a){function c(a){b.fieldsToStorage();b.handler(!0);b.storageToFields()}console.group("[facebook.subject] attaching events");lsi.createDataset("f_subject");lsi.createDataset("f_friends");this.handler=a;var b=this;this.store_button.addEventListener("click",c,!1);this.subject_id.addEventListener("blur",c,!1);this.storageToFields();console.groupEnd()};
|