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

5 lines
1.2 KiB
JavaScript

function inputFacebookSubject(a,b){this.subject_id=a;this.store_button=b}inputFacebookSubject.prototype={store_button:this.store_button,subject_id:this.subject_id,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});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;console.groupEnd()};
inputFacebookSubject.prototype.attach=function(a){function b(a){c.fieldsToStorage();c.handler(!0);c.storageToFields()}console.group("[facebook.subject] attaching events");lsi.createDataset("f_subject");lsi.createDataset("f_friends");this.handler=a;var c=this;this.store_button.addEventListener("click",b,!1);this.subject_id.addEventListener("blur",b,!1);this.storageToFields();console.groupEnd()};