function inputPhoneFiche(a,c){this.container=a;this.nav_container=c;this.top_size=10}inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"2",age:".",job:".",famsit:"0",studies:"0",reltype:"0",reltypeSpecial:"",city:"",quartier:"",cp:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["4","9","14","19","24"],connect:"1 3 5 7 9 11".split(" "),connectSpecial:["",""],timestamp:0,valid:!1}}; inputPhoneFiche.prototype.fieldsToStorage=function(){console.group("[phone.fiche] fields to storage");for(var a=$$('[data-sublink="phone"] article.relation-panel .fiche-relation'),c=0;c FICHE UPDATE"),b.timestamp=Date.now()):void 0==d.timestamp&&(b.timestamp=this.defaultData.timestamp);lsi.set("p_fiches",b.uid,b)}}console.groupEnd()}; inputPhoneFiche.prototype.add=function(a){if(null==a.uid||isNaN(a.uid)||null==a.contact||isNaN(a.contact))return!1;a.city=null!=a.city?a.city:this.defaultData.city;a.quartier=null!=a.quartier?a.quartier:this.defaultData.quartier;a.cp=null!=a.cp?a.cp:this.defaultData.cp;a.duration[0]=null!=a.duration[0]?a.duration[0]:this.defaultData.duration[0];a.duration[1]=null!=a.duration[1]?a.duration[1]:this.defaultData.duration[1];a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial; a.contextSpecial[0]=null!=a.contextSpecial[0]?a.contextSpecial[0]:this.defaultData.contextSpecial[0];a.contextSpecial[1]=null!=a.contextSpecial[1]?a.contextSpecial[1]:this.defaultData.contextSpecial[1];a.contextSpecial[2]=null!=a.contextSpecial[2]?a.contextSpecial[2]:this.defaultData.contextSpecial[2];a.connectSpecial[0]=null!=a.connectSpecial[0]?a.connectSpecial[0]:this.defaultData.connectSpecial[0];a.connectSpecial[1]=null!=a.connectSpecial[1]?a.connectSpecial[1]:this.defaultData.connectSpecial[1]; a.job=null!=a.job?a.job:this.defaultData.job;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.famsit=null!=a.famsit?a.famsit:this.defaultData.famsit;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.context=null!=a.context?a.context:this.defaultData.context;a.freq=null!=a.freq?a.freq:this.defaultData.freq;a.connect=null!=a.connect?a.connect: this.defaultData.connect;var c=lsi.get("p_contacts",a.contact);if(!1===c)return!1;var b="";isNaN(c.existing)||(b=lsi.get("p_friends",c.existing),c.username=b.name,a.age=b.age,a.sexe=b.sexe,a.loc=b.dist,isNaN(b.reltype)?(a.reltype=10,a.reltypeSpecial=b.reltype):(a.reltype=b.reltype,a.reltypeSpecial=""),null!=b.studies2?(a.studies=b.studies2,a.job=b.job,a.famsit=b.famsit,a.city=b.city,a.cp=b.cp,a.quartier=b.quartier,a.duration[0]=b.duration[0],a.duration[1]=b.duration[1],a.context=b.context,a.contextSpecial= b.contextExtra,a.connect=b.connect,a.connectSpecial=b.connectExtra,a.freq=b.freq,b="Contact import\u00e9: non modifiable!"):b="Contact import\u00e9 (incomplet): modifiable partiellement!");this.container.innerHTML+=pFicheBuilder.build({importedfiche:b,name:c.username,countcall:c.countcall,countsms:c.countsms,uid:a.uid,contact:a.contact,city:a.city,quartier:a.quartier,cp:a.cp,duration0:a.duration[0],duration1:a.duration[1],reltypespecial:a.reltypeSpecial,contextspecial0:a.contextSpecial[0],contextspecial1:a.contextSpecial[1], contextspecial2:a.contextSpecial[2],connectspecial0:a.connectSpecial[0],connectspecial1:a.connectSpecial[1]});c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=c&&c.setAttribute("selected", "selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=c&&c.setAttribute("selected","selected");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;cinput[type="radio"][data-name="famsit"]');for(c=0;cinput[type="radio"][data-name="reltype"]');for(c=0;cinput[type="radio"][data-name="loc"]');for(c=0;cinput[type="radio"][data-name="context"]');for(c=0;cinput[type="radio"][data-name="freq"]');for(c=0;cinput[type="radio"][data-name="connect"]');for(c=0;c=d)break}var a=lsi["export"]("p_fiches"),c=lsi["export"]("p_mini-fiches"), g;for(g in c){var h=lsi.get("p_contacts",c[g].contact);if(h){d=[];for(e in a)b=lsi.get("p_contacts",a[e].contact),e!=g&&b&&(k=0h[e];b=h.indexOf(Math.max.apply(Math,h));if(f)for(e in d)console.warn("copying mini#"+c[g].uid+" to fiche#"+ d[e].uid,k-global_start_timestamp,h[e]-global_start_timestamp),f=d[e],f.age=c[g].age,f.sexe=c[g].sexe,f.loc=c[g].loc,f.reltype=c[g].reltype,f.reltypeSpecial=c[g].reltypeSpecial,console.warn(f),lsi.set("p_fiches",f.uid,f);else if(-1 span.active'),b=0;bAPPELS");20>e&&b'+(e%20+1)+"  ":(20==e&&(this.nav_container.innerHTML+='
   SMS   '),this.nav_container.innerHTML+=''+(e%20+1)+"")}for(var d in a)c=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=c&&(!0===a[d].valid?c.addClass("done"):c.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))}; inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0a.reltypeSpecial.length|| "11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&2>a.contextSpecial[2].length?!1:!0};inputPhoneFiche.prototype.attach=function(a){console.group("[phone.fiche] attaching events");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;this.nav_container.addEventListener("click",function(a){this.nav(a.target);this.handler(a.target)}.bind(this),!1);console.groupEnd()};