diff --git a/js/includes/input-phone-contact-min.js b/js/includes/input-phone-contact-min.js index e36b72e..09f2278 100644 --- a/js/includes/input-phone-contact-min.js +++ b/js/includes/input-phone-contact-min.js @@ -1,9 +1,8 @@ function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:1,handler:null}; inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$("article.contact-panel .new-contact"),c=0;c=a.length&&this.add({uid:a.length,number:"",firstname:"",lastname:"",username:"",call:-1,sms:-1,countcall:0,countsms:0});this.updateNavBar()}; +inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.firstname=null!=a.firstname?a.firstname:"";a.lastname=null!=a.lastname?a.lastname:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;this.container.innerHTML+=contactBuilder.build(a);a=$$("article.contact-panel .new-contact"); +for(var c=this,b=0;b=a.length&&this.add({uid:a.length});this.updateNavBar()}; inputPhoneContact.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.getData("n"))||"nav-contact"!=a.parentNode.id)return!1;for(var c=$$("#nav-contact > span.active"),b=0;b'+(1+c/10)+""}this.nav(this.nav_container.children[this.selected-1])}; inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("contacts");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)}; diff --git a/js/includes/input-phone-contact.js b/js/includes/input-phone-contact.js index cbccba7..ca7fa91 100644 --- a/js/includes/input-phone-contact.js +++ b/js/includes/input-phone-contact.js @@ -82,7 +82,7 @@ inputPhoneContact.prototype.add = function(objectData){ console.log('CONTACTS: ADD'); // Si pas d'uid, on quitte - if( objectData == null || objectData.uid == null || isNaN('number') ) + if( objectData == null || objectData.uid == null || isNaN(objectData.uid) ) return false // {0} On formatte l'object // @@ -141,7 +141,7 @@ inputPhoneContact.prototype.storageToFields = function(){ // On ajoute un champ de plus à remplir si c'est la dernière page if( max >= contactKeys.length ) - this.add({uid: contactKeys.length, number:'', firstname:'', lastname:'', username:'', call:-1, sms:-1, countcall: 0, countsms: 0}); + this.add({uid: contactKeys.length}); /* (3) On met à jour la barre de navigation */ this.updateNavBar();