Gestion des noms par référence dans [phone.matrice]
This commit is contained in:
parent
7c2fdcaa48
commit
9eb7c9dfaf
|
@ -27,7 +27,7 @@ inputFacebookContact.prototype.check = function(deflated){
|
|||
/* [3] Gestion de l'enregistrement des formulaires de contact
|
||||
=========================================================*/
|
||||
inputFacebookContact.prototype.fieldsToStorage = function(){
|
||||
console.log('CONTACTS: FIELDS TO STORAGE');
|
||||
console.group('[facebook.contact] fields to storage');
|
||||
|
||||
// {1} Pour chaque formulaire de contact présent //
|
||||
var visibleContacts = $$('[data-sublink="facebook"] article.contact-panel .new-contact');
|
||||
|
@ -60,6 +60,8 @@ inputFacebookContact.prototype.fieldsToStorage = function(){
|
|||
|
||||
}
|
||||
|
||||
console.groupEnd();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,7 +80,6 @@ inputFacebookContact.prototype.fieldsToStorage = function(){
|
|||
*
|
||||
*/
|
||||
inputFacebookContact.prototype.add = function(objectData){
|
||||
console.log('CONTACTS: ADD');
|
||||
|
||||
// Si pas d'uid, on quitte
|
||||
if( objectData == null || objectData.uid == null || isNaN(objectData.uid) )
|
||||
|
@ -129,7 +130,7 @@ inputFacebookContact.prototype.add = function(objectData){
|
|||
/* [5] Gestion de l'affichage depuis le 'localStorage'
|
||||
=========================================================*/
|
||||
inputFacebookContact.prototype.storageToFields = function(){
|
||||
console.log('CONTACTS: STORAGE TO FIELDS');
|
||||
console.group('[facebook.contact] storage to fields');
|
||||
|
||||
// {1} Pour chaque contact du 'localStorage' //
|
||||
var contactKeys = lsi.keys('f_contacts');
|
||||
|
@ -152,6 +153,7 @@ inputFacebookContact.prototype.storageToFields = function(){
|
|||
/* (3) On met à jour la barre de navigation */
|
||||
this.updateNavBar();
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -217,7 +219,7 @@ inputFacebookContact.prototype.updateNavBar = function(){
|
|||
/* [8] Point d'amorçage de la gestion des contacts
|
||||
=========================================================*/
|
||||
inputFacebookContact.prototype.attach = function(handler){
|
||||
console.log('CONTACTS: ATTACH');
|
||||
console.group('[facebook.contact] attaching events');
|
||||
|
||||
/* (1) On initialise le jeu de données */
|
||||
lsi.createDataset('f_contacts');
|
||||
|
@ -238,4 +240,5 @@ inputFacebookContact.prototype.attach = function(handler){
|
|||
ptr.handler(e.target);
|
||||
}, false);
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ inputFacebookFiche.prototype = {
|
|||
/* [2] Gestion de l'enregistrement des formulaires fiche fiches relation
|
||||
=========================================================*/
|
||||
inputFacebookFiche.prototype.fieldsToStorage = function(){
|
||||
console.log('FICHE: FIELDS TO STORAGE');
|
||||
console.group('[facebook.fiche] fields to storage');
|
||||
|
||||
// {1} Pour chaque formulaire de contact présent //
|
||||
var existingFiches = $$('[data-sublink="facebook"] article.relation-panel .fiche-relation');
|
||||
|
@ -108,6 +108,8 @@ inputFacebookFiche.prototype.fieldsToStorage = function(){
|
|||
/* (7) On enregistre les données dans le 'localStorage' */
|
||||
lsi.set('f_fiches', obj.uid, obj);
|
||||
}
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -126,7 +128,6 @@ inputFacebookFiche.prototype.fieldsToStorage = function(){
|
|||
*
|
||||
*/
|
||||
inputFacebookFiche.prototype.add = function(objectData){
|
||||
console.log('FICHE: ADD');
|
||||
|
||||
// Si pas d'UID ou d'UID de contact, on retourne une erreur
|
||||
if( objectData.uid == null || isNaN(objectData.uid) || objectData.contact == null || isNaN(objectData.contact) )
|
||||
|
@ -310,7 +311,7 @@ inputFacebookFiche.prototype.add = function(objectData){
|
|||
/* [4] Gestion de l'affichage depuis le 'localStorage'
|
||||
=========================================================*/
|
||||
inputFacebookFiche.prototype.storageToFields = function(){
|
||||
console.log('FICHE: STORAGE TO FIELDS');
|
||||
console.group('[facebook.fiche] storage to fields');
|
||||
|
||||
// {1} Pour chaque contact du 'localStorage' //
|
||||
var ficheData = lsi.export('f_fiches');
|
||||
|
@ -326,6 +327,7 @@ inputFacebookFiche.prototype.storageToFields = function(){
|
|||
// {4} On met à jour la navigation //
|
||||
this.updateNavBar();
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -341,7 +343,7 @@ inputFacebookFiche.prototype.storageToFields = function(){
|
|||
/* [5] Synchronisation des CONTACT vers les MINI fiches
|
||||
=========================================================*/
|
||||
inputFacebookFiche.prototype.sync = function(){
|
||||
console.log('FICHE: SYNC');
|
||||
console.group('[facebook.fiche] synchronisation');
|
||||
|
||||
/* (1) Mise à jour en fonction des contacts Top 20
|
||||
---------------------------------------------------------*/
|
||||
|
@ -427,6 +429,7 @@ inputFacebookFiche.prototype.sync = function(){
|
|||
|
||||
}
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -602,7 +605,7 @@ inputFacebookFiche.prototype.check = function(ficheData){
|
|||
/* [9] Point d'amorçage de la gestion des contacts
|
||||
=========================================================*/
|
||||
inputFacebookFiche.prototype.attach = function(handler){
|
||||
console.log('FICHE: ATTACH');
|
||||
console.group('[facebook.fiche] attaching events');
|
||||
|
||||
/* (1) On initialise le jeu de données */
|
||||
lsi.createDataset('f_fiches');
|
||||
|
@ -624,4 +627,5 @@ inputFacebookFiche.prototype.attach = function(handler){
|
|||
ptr.handler(e.target);
|
||||
}, false);
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ inputFacebookMatrice.prototype = {
|
|||
/* [2] Gestion de l'enregistrement de la matrice
|
||||
=========================================================*/
|
||||
inputFacebookMatrice.prototype.fieldsToStorage = function(){
|
||||
console.log('MATRICE: FIELDS TO STORAGE');
|
||||
console.group('[facebook.matrice] fields to storage');
|
||||
|
||||
|
||||
// {1} On initialise notre deflater pour récupérer les valeurs //
|
||||
|
@ -59,6 +59,8 @@ inputFacebookMatrice.prototype.fieldsToStorage = function(){
|
|||
// idB: [idX, idY], # B connait X et Y (et réciproquement)
|
||||
// ...
|
||||
//
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,7 +76,7 @@ inputFacebookMatrice.prototype.fieldsToStorage = function(){
|
|||
/* [4] Gestion de l'affichage depuis le 'localStorage'
|
||||
=========================================================*/
|
||||
inputFacebookMatrice.prototype.storageToFields = function(){
|
||||
console.log('MATRICE: STORAGE TO FIELDS');
|
||||
console.group('[facebook.matrice] storage to fields');
|
||||
|
||||
/* (1) On récupère la liste des contacts à mettre dans la matrice */
|
||||
// On récupère les fiches
|
||||
|
@ -97,21 +99,21 @@ inputFacebookMatrice.prototype.storageToFields = function(){
|
|||
|
||||
/* (2) On construit le HTML de la matrice */
|
||||
// Contiendra le HTML
|
||||
var matrice_html = "<table class='line'>";
|
||||
var matrice_html = ["<table class='line'>"];
|
||||
|
||||
// {1} Pour chaque ligne //
|
||||
for( var A = 0 ; A < contacts.length ; A++ ){
|
||||
var conA = contactData[A];
|
||||
|
||||
|
||||
matrice_html += '<tr>';
|
||||
matrice_html.push('<tr>');
|
||||
|
||||
if( A > 0 ){ // Noms sur la première ligne (abscisses)
|
||||
matrice_html += '<td style="text-align: right;">';
|
||||
matrice_html += conA.username;
|
||||
matrice_html += '</td>';
|
||||
matrice_html.push('<td style="text-align: right;">');
|
||||
matrice_html.push(conA.username);
|
||||
matrice_html.push('</td>');
|
||||
}else // Sinon,
|
||||
matrice_html += '<td></td>';
|
||||
matrice_html.push('<td></td>');
|
||||
|
||||
// {2} Pour chaque case //
|
||||
for( var B = 0 ; B < contacts.length ; B++ ){ if( B < contacts.length-1 ){
|
||||
|
@ -119,36 +121,37 @@ inputFacebookMatrice.prototype.storageToFields = function(){
|
|||
|
||||
// {3} Première colonne -> Intitulé des ordonnées //
|
||||
if( A == 0 ){
|
||||
matrice_html += '<td>';
|
||||
matrice_html += '<span style="writing-mode: vertical-lr; text-align: right;">';
|
||||
matrice_html += conB.username;
|
||||
matrice_html += '</span>';
|
||||
matrice_html.push('<td>');
|
||||
matrice_html.push('<span style="writing-mode: vertical-lr; text-align: right;">');
|
||||
matrice_html.push(conB.username);
|
||||
matrice_html.push('</span>');
|
||||
|
||||
// {4} Valeurs des relations (boutons) //
|
||||
}else if( B < A ){
|
||||
matrice_html += "<td>";
|
||||
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='f_matrice_"+conA.uid+"_"+conB.uid+"'";
|
||||
matrice_html.push("<td>");
|
||||
matrice_html.push("<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='f_matrice_"+conA.uid+"_"+conB.uid+"'");
|
||||
// Si la relation existe, on active le bouton
|
||||
if( matriceData[A] != null && matriceData[A].indexOf(B) > -1 )
|
||||
matrice_html += " checked";
|
||||
matrice_html += " >";
|
||||
matrice_html += "<label for='f_matrice_"+conA.uid+"_"+conB.uid+"'></label>";
|
||||
matrice_html.push(" checked");
|
||||
matrice_html.push(" >");
|
||||
matrice_html.push("<label for='f_matrice_"+conA.uid+"_"+conB.uid+"'></label>");
|
||||
|
||||
// {5} Cases vides (moitié supérieure droite) //
|
||||
}else
|
||||
matrice_html += "<td class='hidden'>";
|
||||
matrice_html.push("<td class='hidden'>");
|
||||
|
||||
matrice_html += '</td>';
|
||||
matrice_html.push('</td>');
|
||||
}}
|
||||
|
||||
matrice_html += '</tr>';
|
||||
matrice_html.push('</tr>');
|
||||
}
|
||||
matrice_html += '</table>';
|
||||
matrice_html.push('</table>');
|
||||
|
||||
|
||||
/* (3) On affiche la matrice */
|
||||
this.container.innerHTML = matrice_html;
|
||||
this.container.innerHTML = matrice_html.join('');
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -156,7 +159,7 @@ inputFacebookMatrice.prototype.storageToFields = function(){
|
|||
/* [9] Point d'amorçage de la gestion des contacts
|
||||
=========================================================*/
|
||||
inputFacebookMatrice.prototype.attach = function(){
|
||||
console.log('MATRICE: ATTACH');
|
||||
console.group('[facebook.matrice] attaching events');
|
||||
|
||||
/* (1) On initialise le jeu de données */
|
||||
lsi.createDataset('f_matrice');
|
||||
|
@ -173,4 +176,6 @@ inputFacebookMatrice.prototype.attach = function(){
|
|||
setTimeout(function(){ ptr.storageToFields(); }, 500);
|
||||
|
||||
}, false);
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ inputFacebookMini.prototype = {
|
|||
/* [2] Gestion de l'enregistrement des formulaires mini fiches relation
|
||||
=========================================================*/
|
||||
inputFacebookMini.prototype.fieldsToStorage = function(){
|
||||
console.log('MINI FICHE: FIELDS TO STORAGE');
|
||||
console.group('[facebook.mini] fields to storage');
|
||||
|
||||
// {1} Pour chaque formulaire de MINI fiche à l'écran //
|
||||
var existingMiniFiches = $$('[data-sublink="facebook"] article.mini-relation-panel .mini-fiche-relation');
|
||||
|
@ -89,6 +89,8 @@ inputFacebookMini.prototype.fieldsToStorage = function(){
|
|||
lsi.set('f_mini-fiches', obj.uid, obj);
|
||||
|
||||
}
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,7 +109,6 @@ inputFacebookMini.prototype.fieldsToStorage = function(){
|
|||
*
|
||||
*/
|
||||
inputFacebookMini.prototype.add = function(objectData){
|
||||
console.log('MINI FICHE: ADD');
|
||||
|
||||
// Si pas d'UID, on retourne une erreur
|
||||
if( objectData == null || objectData.uid == null )
|
||||
|
@ -213,7 +214,7 @@ inputFacebookMini.prototype.add = function(objectData){
|
|||
/* [4] Gestion de l'affichage depuis le 'localStorage'
|
||||
=========================================================*/
|
||||
inputFacebookMini.prototype.storageToFields = function(){
|
||||
console.log('MINI FICHE: STORAGE TO FIELDS');
|
||||
console.group('[facebook.mini] storage to fields');
|
||||
|
||||
// {1} Pour chaque contact du 'localStorage' //
|
||||
var miniData = lsi.get('f_mini-fiches', this.selected);
|
||||
|
@ -233,6 +234,7 @@ inputFacebookMini.prototype.storageToFields = function(){
|
|||
// {3} On met à jour la navigation //
|
||||
this.updateNavBar();
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -248,7 +250,7 @@ inputFacebookMini.prototype.storageToFields = function(){
|
|||
/* [5] Synchronisation des CONTACT vers les MINI fiches
|
||||
=========================================================*/
|
||||
inputFacebookMini.prototype.sync = function(){
|
||||
console.log('MINI FICHE: SYNC');
|
||||
console.group('[facebook.mini] synchronisation');
|
||||
|
||||
/* (1) On récupère les clés de tous les CONTACTS */
|
||||
var contactData = lsi.export('f_contacts');
|
||||
|
@ -316,6 +318,7 @@ inputFacebookMini.prototype.sync = function(){
|
|||
|
||||
}
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -436,7 +439,7 @@ inputFacebookMini.prototype.check = function(miniData){
|
|||
/* [9] Point d'amorçage de la gestion des contacts
|
||||
=========================================================*/
|
||||
inputFacebookMini.prototype.attach = function(handler){
|
||||
console.log('MINI FICHE: ATTACH');
|
||||
console.group('[facebook.mini] attaching events');
|
||||
|
||||
/* (1) On initialise le jeu de données */
|
||||
lsi.createDataset('f_mini-fiches');
|
||||
|
@ -457,4 +460,5 @@ inputFacebookMini.prototype.attach = function(handler){
|
|||
ptr.handler(e.target);
|
||||
}, false);
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ inputFacebookSubject.prototype.check = function(){
|
|||
/* [3] Gestion de l'enregistrement des formulaires de contact
|
||||
=========================================================*/
|
||||
inputFacebookSubject.prototype.fieldsToStorage = function(){
|
||||
console.log('SUBJECT: FIELDS TO STORAGE');
|
||||
console.group('[facebook.subject] fields to storage');
|
||||
|
||||
// {1} Si le formulaire n'est pas valide, on ne l'enregistre pas //
|
||||
if( !this.check() ) return false;
|
||||
|
@ -37,6 +37,7 @@ inputFacebookSubject.prototype.fieldsToStorage = function(){
|
|||
// {3} On enregistre les données dans le 'localStorage' //
|
||||
lsi.set('f_subject', 0, obj);
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,7 +48,7 @@ inputFacebookSubject.prototype.fieldsToStorage = function(){
|
|||
/* [4] Gestion de l'affichage depuis le 'localStorage'
|
||||
=========================================================*/
|
||||
inputFacebookSubject.prototype.storageToFields = function(){
|
||||
console.log('SUBJECT: STORAGE TO FIELDS');
|
||||
console.group('[facebook.subject] storage to fields');
|
||||
|
||||
// {1} On récupère les informations du sujet //
|
||||
var subjectData = lsi.get('f_subject', 0);
|
||||
|
@ -57,6 +58,8 @@ inputFacebookSubject.prototype.storageToFields = function(){
|
|||
|
||||
// {2} On restore les valeurs //
|
||||
this.subject_id.value = subjectData.subject_id;
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
||||
|
||||
|
@ -64,7 +67,7 @@ inputFacebookSubject.prototype.storageToFields = function(){
|
|||
/* [5] Point d'amorçage de la gestion des contacts
|
||||
=========================================================*/
|
||||
inputFacebookSubject.prototype.attach = function(handler){
|
||||
console.log('SUBJECT: ATTACH');
|
||||
console.group('[facebook.subject] attaching events');
|
||||
|
||||
/* (1) On initialise le jeu de données */
|
||||
lsi.createDataset('f_subject');
|
||||
|
@ -85,4 +88,6 @@ inputFacebookSubject.prototype.attach = function(handler){
|
|||
|
||||
/* (4) On charge le sujet depuis la mémoire ('localStorage') */
|
||||
this.storageToFields();
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -353,7 +353,7 @@ inputPhoneFiche.prototype.storageToFields = function(){
|
|||
/* [5] Synchronisation des CONTACT vers les MINI fiches
|
||||
=========================================================*/
|
||||
inputPhoneFiche.prototype.sync = function(){
|
||||
console.group('[phone.fiche] Synchronisation');
|
||||
console.group('[phone.fiche] synchronisation');
|
||||
|
||||
/* (1) Initialisation
|
||||
---------------------------------------------------------*/
|
||||
|
|
|
@ -100,21 +100,21 @@ inputPhoneMatrice.prototype.storageToFields = function(){
|
|||
|
||||
/* (2) On construit le HTML de la matrice */
|
||||
// Contiendra le HTML
|
||||
var matrice_html = "<table class='line'>";
|
||||
var matrice_html = ["<table class='line'>"];
|
||||
|
||||
// {1} Pour chaque ligne //
|
||||
for( var O = 0 ; O < contacts.length ; O++ ){
|
||||
var conA = contactData[O];
|
||||
|
||||
|
||||
matrice_html += '<tr>';
|
||||
matrice_html.push( '<tr>' );
|
||||
|
||||
if( O > 0 ){ // Noms sur la première ligne (abscisses)
|
||||
matrice_html += '<td style="text-align: right;">';
|
||||
matrice_html += conA.username;
|
||||
matrice_html += '</td>';
|
||||
matrice_html.push( '<td style="text-align: right;">' );
|
||||
matrice_html.push( !isNaN(conA.existing) ? lsi.get('p_friends', conA.existing).name : conA.username );
|
||||
matrice_html.push( '</td>' );
|
||||
}else // Sinon,
|
||||
matrice_html += '<td></td>';
|
||||
matrice_html.push( '<td></td>' );
|
||||
|
||||
// {2} Pour chaque case //
|
||||
for( var B = 0 ; B < contacts.length ; B++ ){ if( B < contacts.length-1 ){
|
||||
|
@ -122,35 +122,35 @@ inputPhoneMatrice.prototype.storageToFields = function(){
|
|||
|
||||
// {3} Première colonne -> Intitulé des ordonnées //
|
||||
if( O == 0 ){
|
||||
matrice_html += '<td>';
|
||||
matrice_html += '<span style="writing-mode: vertical-lr; text-align: right;">';
|
||||
matrice_html += conB.username;
|
||||
matrice_html += '</span>';
|
||||
matrice_html.push( '<td>' );
|
||||
matrice_html.push( '<span style="writing-mode: vertical-lr; text-align: right;">' );
|
||||
matrice_html.push( !isNaN(conB.existing) ? lsi.get('p_friends', conB.existing).name : conB.username );
|
||||
matrice_html.push( '</span>' );
|
||||
|
||||
// {4} Valeurs des relations (boutons) //
|
||||
}else if( B < O ){
|
||||
matrice_html += "<td>";
|
||||
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='p_matrice_"+conA.uid+"_"+conB.uid+"'";
|
||||
matrice_html.push( "<td>" );
|
||||
matrice_html.push( "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='p_matrice_"+conA.uid+"_"+conB.uid+"'" );
|
||||
// Si la relation existe, on active le bouton
|
||||
if( matriceData[O] != null && matriceData[O].indexOf(B) > -1 )
|
||||
matrice_html += " checked";
|
||||
matrice_html += " >";
|
||||
matrice_html += "<label for='p_matrice_"+conA.uid+"_"+conB.uid+"'></label>";
|
||||
matrice_html.push( " checked" );
|
||||
matrice_html.push( " >" );
|
||||
matrice_html.push( "<label for='p_matrice_"+conA.uid+"_"+conB.uid+"'></label>" );
|
||||
|
||||
// {5} Cases vides (moitié supérieure droite) //
|
||||
}else
|
||||
matrice_html += "<td class='hidden'>";
|
||||
matrice_html.push( "<td class='hidden'>" );
|
||||
|
||||
matrice_html += '</td>';
|
||||
matrice_html.push( '</td>' );
|
||||
}}
|
||||
|
||||
matrice_html += '</tr>';
|
||||
matrice_html.push( '</tr>' );
|
||||
}
|
||||
matrice_html += '</table>';
|
||||
matrice_html.push( '</table>' );
|
||||
|
||||
|
||||
/* (3) On affiche la matrice */
|
||||
this.container.innerHTML = matrice_html;
|
||||
this.container.innerHTML = matrice_html.join('');
|
||||
|
||||
console.groupEnd();
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
function inputFacebookContact(a,c){this.container=a;this.nav_container=c}inputFacebookContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputFacebookContact.prototype.check=function(a){return!isNaN(a.existing)||0<a.username.length};
|
||||
inputFacebookContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$('[data-sublink="facebook"] article.contact-panel .new-contact'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate();if(this.check(b)){var d={uid:parseInt(b.uid),username:b.username,firstname:b.firstname,lastname:b.lastname,existing:isNaN(b.existing)?".":parseInt(b.existing)};d.hash=crc32(JSON.stringify(d));lsi.set("f_contacts",parseInt(b.uid),
|
||||
d)}}};
|
||||
inputFacebookContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.username=null!=a.username?a.username:"";a.existing=null!=a.existing?a.existing:".";var c=lsi["export"]("f_friends");a.contacts="";for(var b in c)a.contacts+="\t\t<option value='"+b+"'>"+c[b].name+"</option>\n";this.container.innerHTML+=fContactBuilder.build(a);b=$('[data-sublink="facebook"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+a.existing+
|
||||
inputFacebookContact.prototype.fieldsToStorage=function(){console.group("[facebook.contact] fields to storage");for(var a=$$('[data-sublink="facebook"] article.contact-panel .new-contact'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate();if(this.check(b)){var d={uid:parseInt(b.uid),username:b.username,firstname:b.firstname,lastname:b.lastname,existing:isNaN(b.existing)?".":parseInt(b.existing)};d.hash=crc32(JSON.stringify(d));lsi.set("f_contacts",parseInt(b.uid),
|
||||
d)}}console.groupEnd()};
|
||||
inputFacebookContact.prototype.add=function(a){if(null==a||null==a.uid||isNaN(a.uid))return!1;a.username=null!=a.username?a.username:"";a.existing=null!=a.existing?a.existing:".";var c=lsi["export"]("f_friends");a.contacts="";for(var b in c)a.contacts+="\t\t<option value='"+b+"'>"+c[b].name+"</option>\n";this.container.innerHTML+=fContactBuilder.build(a);b=$('[data-sublink="facebook"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+a.existing+
|
||||
'"]');null!=b&&b.setAttribute("selected","selected");a=$$('[data-sublink="facebook"] article.contact-panel .new-contact');var d=this;for(b=0;b<a.length;b++)a[b].removeEventListener("click",function(a){d.nav(a.target);d.handler(a.target)},!1),a[b].addEventListener("click",function(a){d.nav(a.target);d.handler(a.target)},!1)};
|
||||
inputFacebookContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("f_contacts");this.container.innerHTML="";for(var c=this.selected+10,b=this.selected;b<c&&b<a.length;b++)this.add(lsi.get("f_contacts",a[b]));c>=a.length&&this.add({uid:a.length});this.updateNavBar()};
|
||||
inputFacebookContact.prototype.storageToFields=function(){console.group("[facebook.contact] storage to fields");var a=lsi.keys("f_contacts");this.container.innerHTML="";for(var c=this.selected+10,b=this.selected;b<c&&b<a.length;b++)this.add(lsi.get("f_contacts",a[b]));c>=a.length&&this.add({uid:a.length});this.updateNavBar();console.groupEnd()};
|
||||
inputFacebookContact.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-contact"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="facebook"] #f_nav-contact > span.active'),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputFacebookContact.prototype.updateNavBar=function(){var a=lsi.keys("f_contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var c=0;c<a;c+=10)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(1+c/10)+"</span>"}this.nav($('[data-sublink="facebook"] #f_nav-contact [data-n="'+this.selected+'"]'))};
|
||||
inputFacebookContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("f_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)};
|
||||
inputFacebookContact.prototype.attach=function(a){console.group("[facebook.contact] attaching events");lsi.createDataset("f_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);console.groupEnd()};
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
function inputFacebookFiche(a,b){this.container=a;this.nav_container=b}inputFacebookFiche.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}};
|
||||
inputFacebookFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="facebook"] article.relation-panel .fiche-relation'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(c)),d=lsi.get("f_fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==e)break;c={contact:parseInt(c.contact),uid:parseInt(c.uid),sexe:c.sexe,age:c.age,job:c.job,famsit:c.famsit,studies:c.studies,reltype:c.reltype,
|
||||
reltypeSpecial:c.reltypeSpecial,city:c.city,quartier:c.quartier,cp:c.cp,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:e};c.valid=this.check(c);0<diff(d,c,["hash","valid","timestamp"]).length&&(console.log(diff(d,c,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),c.timestamp=Date.now());lsi.set("f_fiches",c.uid,c)}}};
|
||||
inputFacebookFiche.prototype.add=function(a){console.log("FICHE: ADD");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 b=lsi.get("f_contacts",a.contact);if(!1===b)return!1;if(!isNaN(b.existing)){var c=lsi.get("f_friends",b.existing);b.username=c.name;a.age=c.age;a.sexe=c.sexe;a.loc=c.dist;isNaN(c.reltype)?(a.reltype=10,a.reltypeSpecial=c.reltype):(a.reltype=c.reltype,a.reltypeSpecial="");null!=c.studies2&&(a.studies=c.studies2,a.job=c.job,a.famsit=c.famsit,a.city=c.city,a.cp=c.cp,a.quartier=c.quartier,a.duration[0]=c.duration[0],a.duration[1]=c.duration[1],
|
||||
a.context=c.context,a.contextSpecial=c.contextExtra,a.connect=c.connect,a.connectSpecial=c.connectExtra,a.freq=c.freq)}this.container.innerHTML+=fFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.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]});b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+
|
||||
inputFacebookFiche.prototype.fieldsToStorage=function(){console.group("[facebook.fiche] fields to storage");for(var a=$$('[data-sublink="facebook"] article.relation-panel .fiche-relation'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(c)),d=lsi.get("f_fiches",c.uid);if(!1!==d){if(null!=d.hash&&d.hash==e)return;c={contact:parseInt(c.contact),uid:parseInt(c.uid),sexe:c.sexe,age:c.age,job:c.job,famsit:c.famsit,studies:c.studies,reltype:c.reltype,
|
||||
reltypeSpecial:c.reltypeSpecial,city:c.city,quartier:c.quartier,cp:c.cp,loc:c.loc,duration:c.duration,context:c.context,contextSpecial:c.contextSpecial,freq:c.freq,connect:c.connect,connectSpecial:c.connectSpecial,hash:e};c.valid=this.check(c);0<diff(d,c,["hash","valid","timestamp"]).length&&(console.log(diff(d,c,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),c.timestamp=Date.now());lsi.set("f_fiches",c.uid,c)}}console.groupEnd()};
|
||||
inputFacebookFiche.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 b=lsi.get("f_contacts",a.contact);if(!1===b)return!1;if(!isNaN(b.existing)){var c=lsi.get("f_friends",b.existing);b.username=c.name;a.age=c.age;a.sexe=c.sexe;a.loc=c.dist;isNaN(c.reltype)?(a.reltype=10,a.reltypeSpecial=c.reltype):(a.reltype=c.reltype,a.reltypeSpecial="");null!=c.studies2&&(a.studies=c.studies2,a.job=c.job,a.famsit=c.famsit,a.city=c.city,a.cp=c.cp,a.quartier=c.quartier,a.duration[0]=c.duration[0],a.duration[1]=c.duration[1],a.context=c.context,a.contextSpecial=
|
||||
c.contextExtra,a.connect=c.connect,a.connectSpecial=c.connectExtra,a.freq=c.freq)}this.container.innerHTML+=fFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.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]});
|
||||
b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+
|
||||
a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=b&&b.setAttribute("selected","selected");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(b=0;b<c.length;b++)c[b].value==a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');
|
||||
for(b=0;b<c.length;b++)c[b].value==a.famsit?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(b=0;b<c.length;b++)c[b].value==a.reltype?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');
|
||||
for(b=0;b<c.length;b++)c[b].value==a.loc?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(b=0;b<c.length;b++)c[b].value==a.context?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');
|
||||
for(b=0;b<c.length;b++)-1<a.freq.indexOf(c[b].value)?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(b=0;b<c.length;b++)-1<a.connect.indexOf(c[b].value)?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};
|
||||
inputFacebookFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()};
|
||||
inputFacebookFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("f_contacts"),b=[],c=20>lsi.keys("f_contacts").length?lsi.keys("f_contacts").length:20;if(b.length<c)for(var e in a){for(var d=0;-1<b.indexOf(d)&&d<c;)d++;b.push(d);a=lsi.get("f_fiches",d);null==a&&(a=this.defaultData);a.uid=d;a.contact=parseInt(e);lsi.set("f_fiches",d,a);if(b.length>=c)break}var a=lsi["export"]("f_fiches"),f;for(f in a)b=lsi.get("f_contacts",a[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=
|
||||
10>parseInt(f)?10+b.sms:b.call,b=a[b],null==b||null==a[f]||null==b.timestamp||null==a[f].timestamp||b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("f_fiches",b.uid,c)))};inputFacebookFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="facebook"] #f_nav-fiche > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputFacebookFiche.prototype.storageToFields=function(){console.group("[facebook.fiche] storage to fields");var a=lsi["export"]("f_fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar();console.groupEnd()};
|
||||
inputFacebookFiche.prototype.sync=function(){console.group("[facebook.fiche] synchronisation");var a=lsi["export"]("f_contacts"),b=[],c=20>lsi.keys("f_contacts").length?lsi.keys("f_contacts").length:20;if(b.length<c)for(var e in a){for(var d=0;-1<b.indexOf(d)&&d<c;)d++;b.push(d);a=lsi.get("f_fiches",d);null==a&&(a=this.defaultData);a.uid=d;a.contact=parseInt(e);lsi.set("f_fiches",d,a);if(b.length>=c)break}var a=lsi["export"]("f_fiches"),f;for(f in a)b=lsi.get("f_contacts",a[f].contact),null!=b&&-1!=
|
||||
b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call,b=a[b],null==b||null==a[f]||null==b.timestamp||null==a[f].timestamp||b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("f_fiches",b.uid,c)));console.groupEnd()};
|
||||
inputFacebookFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="facebook"] #f_nav-fiche > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputFacebookFiche.prototype.updateNavBar=function(){var a=lsi["export"]("f_fiches");this.nav_container.innerHTML="";for(var b=Object.keys(a),c=0;c<b.length;c++){var e=parseInt(b[c]);0==e&&(this.nav_container.innerHTML+="<span>HISTORIQUE</span>");10>e&&c<b.length-1&&10<=b[c+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%10+1)+"</span> ":(10==e&&(this.nav_container.innerHTML+='<span class="fc">MESSENGER</span>'),this.nav_container.innerHTML+='<span data-n="'+e+'">'+
|
||||
(e%10+1)+"</span>")}for(var d in a)b=$('[data-sublink="facebook"] #f_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="facebook"] #f_nav-fiche [data-n="'+this.selected+'"]'))};
|
||||
inputFacebookFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||"."==a.age||""==a.sexe||""==a.famsit||""==a.reltype||""==a.loc||""==a.context)return!1;for(var b=0;b<a.freq.length;b++)if(""==a.freq[b])return!1;for(b=0;b<a.connect.length;b++)if(""==a.connect[b])return!1;return"10"==a.reltype&&2>a.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};inputFacebookFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("f_fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
|
||||
"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};inputFacebookFiche.prototype.attach=function(a){console.group("[facebook.fiche] attaching events");lsi.createDataset("f_fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1);console.groupEnd()};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function inputFacebookMatrice(a){this.container=a}inputFacebookMatrice.prototype={container:this.container};
|
||||
inputFacebookMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d)};
|
||||
inputFacebookMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="<table class='line'>";for(c=0;c<e.length;c++){var g=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
|
||||
a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='f_matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='f_matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
|
||||
inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1)};
|
||||
inputFacebookMatrice.prototype.fieldsToStorage=function(){console.group("[facebook.matrice] fields to storage");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d);console.groupEnd()};
|
||||
inputFacebookMatrice.prototype.storageToFields=function(){console.group("[facebook.matrice] storage to fields");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a=["<table class='line'>"];for(c=0;c<e.length;c++){var g=b[c];a.push("<tr>");0<c?(a.push('<td style="text-align: right;">'),a.push(g.username),a.push("</td>")):a.push("<td></td>");for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];
|
||||
0==c?(a.push("<td>"),a.push('<span style="writing-mode: vertical-lr; text-align: right;">'),a.push(h.username),a.push("</span>")):f<c?(a.push("<td>"),a.push("<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='f_matrice_"+g.uid+"_"+h.uid+"'"),null!=d[c]&&-1<d[c].indexOf(f)&&a.push(" checked"),a.push(" >"),a.push("<label for='f_matrice_"+g.uid+"_"+h.uid+"'></label>")):a.push("<td class='hidden'>");a.push("</td>")}a.push("</tr>")}a.push("</table>");
|
||||
this.container.innerHTML=a.join("");console.groupEnd()};inputFacebookMatrice.prototype.attach=function(){console.group("[facebook.matrice] attaching events");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1);console.groupEnd()};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function inputFacebookMini(a,c){this.container=a;this.nav_container=c}inputFacebookMini.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"2",age:".",studies:"0",loc:".",reltype:"9",unknown:!1,reltypeSpecial:"",timestamp:0,valid:!1}};
|
||||
inputFacebookMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="facebook"] article.mini-relation-panel .mini-fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),d=crc32(JSON.stringify(b)),e=lsi.get("f_mini-fiches",b.uid);if(!1!==e){if(null!=e&&null!=e.hash&&e.hash==d)break;console.warn("> MINI UPDATE");b={uid:parseInt(b.uid),sexe:b.sexe,age:b.age,studies:b.studies,reltype:b.reltype,
|
||||
reltypeSpecial:b.reltypeSpecial,loc:b.loc,unknown:null!=b.unknown,hash:d};b.valid=this.check(b);0<diff(e,b,["hash","valid","timestamp"]).length&&(console.log(diff(e,b,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),b.timestamp=Date.now());lsi.set("f_mini-fiches",b.uid,b)}}};
|
||||
inputFacebookMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;
|
||||
var c=lsi.get("f_contacts",a.uid);if(!1===c)return!1;if(!isNaN(c.existing)){var b=lsi.get("f_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.studies1&&(a.studies=b.studies1)}this.container.innerHTML+=fMiniFicheBuilder.build({name:c.username,uid:a.uid,reltypespecial:a.reltypeSpecial});c=$('[data-sublink="facebook"] article.mini-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="facebook"] article.mini-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="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;c<b.length;c++)b[c].value==
|
||||
a.sexe?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(c=0;c<b.length;c++)b[c].value==a.reltype?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(c=0;c<b.length;c++)b[c].value==
|
||||
a.loc?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");c=$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="checkbox"][data-name="unknown"]');null!=c&&a.unknown&&c.setAttribute("checked","checked")};
|
||||
inputFacebookMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi.get("f_mini-fiches",this.selected);if(null==a)return this.updateNavBar(),!1;this.container.innerHTML="";this.add(a);this.updateNavBar()};
|
||||
inputFacebookMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("f_contacts"),c=lsi["export"]("f_fiches"),b=[],d;for(d in c)-1==b.indexOf(c[d].contact)&&b.push(c[d].contact);for(var e in a)-1<b.indexOf(parseInt(e))?lsi.del("f_mini-fiches",e):(c=0==a[e].username.length?e.toString()+"-":e,d=lsi.get("f_mini-fiches",c),null==d&&(d=this.defaultData,d.valid=!1,isNaN(c)&&(d.reltype="9")),d.uid=parseInt(e),lsi.set("f_mini-fiches",c,d));d=lsi["export"]("f_mini-fiches");if(null==
|
||||
d[this.selected])for(e in d)if(!isNaN(e)){this.selected=parseInt(e);break}};inputFacebookMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-mini"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="facebook"] #f_nav-mini > span.active'),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputFacebookMini.prototype.fieldsToStorage=function(){console.group("[facebook.mini] fields to storage");for(var a=$$('[data-sublink="facebook"] article.mini-relation-panel .mini-fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),d=crc32(JSON.stringify(b)),e=lsi.get("f_mini-fiches",b.uid);if(!1!==e){if(null!=e&&null!=e.hash&&e.hash==d)return;console.warn("> MINI UPDATE");b={uid:parseInt(b.uid),sexe:b.sexe,age:b.age,studies:b.studies,reltype:b.reltype,
|
||||
reltypeSpecial:b.reltypeSpecial,loc:b.loc,unknown:null!=b.unknown,hash:d};b.valid=this.check(b);0<diff(e,b,["hash","valid","timestamp"]).length&&(console.log(diff(e,b,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),b.timestamp=Date.now());lsi.set("f_mini-fiches",b.uid,b)}}console.groupEnd()};
|
||||
inputFacebookMini.prototype.add=function(a){if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;var c=lsi.get("f_contacts",
|
||||
a.uid);if(!1===c)return!1;if(!isNaN(c.existing)){var b=lsi.get("f_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.studies1&&(a.studies=b.studies1)}this.container.innerHTML+=fMiniFicheBuilder.build({name:c.username,uid:a.uid,reltypespecial:a.reltypeSpecial});c=$('[data-sublink="facebook"] article.mini-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="facebook"] article.mini-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="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;c<b.length;c++)b[c].value==a.sexe?b[c].setAttribute("checked","checked"):
|
||||
b[c].removeAttribute("checked");b=$$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(c=0;c<b.length;c++)b[c].value==a.reltype?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(c=0;c<b.length;c++)b[c].value==a.loc?b[c].setAttribute("checked",
|
||||
"checked"):b[c].removeAttribute("checked");c=$('[data-sublink="facebook"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="checkbox"][data-name="unknown"]');null!=c&&a.unknown&&c.setAttribute("checked","checked")};
|
||||
inputFacebookMini.prototype.storageToFields=function(){console.group("[facebook.mini] storage to fields");var a=lsi.get("f_mini-fiches",this.selected);if(null==a)return this.updateNavBar(),!1;this.container.innerHTML="";this.add(a);this.updateNavBar();console.groupEnd()};
|
||||
inputFacebookMini.prototype.sync=function(){console.group("[facebook.mini] synchronisation");var a=lsi["export"]("f_contacts"),c=lsi["export"]("f_fiches"),b=[],d;for(d in c)-1==b.indexOf(c[d].contact)&&b.push(c[d].contact);for(var e in a)-1<b.indexOf(parseInt(e))?lsi.del("f_mini-fiches",e):(c=0==a[e].username.length?e.toString()+"-":e,d=lsi.get("f_mini-fiches",c),null==d&&(d=this.defaultData,d.valid=!1,isNaN(c)&&(d.reltype="9")),d.uid=parseInt(e),lsi.set("f_mini-fiches",c,d));d=lsi["export"]("f_mini-fiches");
|
||||
if(null==d[this.selected])for(e in d)if(!isNaN(e)){this.selected=parseInt(e);break}console.groupEnd()};inputFacebookMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-mini"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="facebook"] #f_nav-mini > span.active'),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputFacebookMini.prototype.updateNavBar=function(){var a=lsi["export"]("f_mini-fiches");this.nav_container.innerHTML="";var c=0,b;for(b in a)isNaN(b)||(this.nav_container.innerHTML+='<span data-n="'+b+'">'+ ++c+"</span>");for(b in a)isNaN(b)||(c=$('[data-sublink="facebook"] #f_nav-mini [data-n="'+a[b].uid+'"]'),null!=c&&(!0===a[b].valid?c.addClass("done"):c.remClass("done")));this.nav($('[data-sublink="facebook"] #f_nav-mini [data-n="'+this.selected+'"]'))};
|
||||
inputFacebookMini.prototype.check=function(a){return a.unknown?!0:""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"10"==a.reltype&&2>a.reltypeSpecial.length?!1:!0};inputFacebookMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("f_mini-fiches");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};
|
||||
inputFacebookMini.prototype.check=function(a){return a.unknown?!0:""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"10"==a.reltype&&2>a.reltypeSpecial.length?!1:!0};inputFacebookMini.prototype.attach=function(a){console.group("[facebook.mini] attaching events");lsi.createDataset("f_mini-fiches");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1);console.groupEnd()};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("f_subject",0,{subject_id:this.subject_id.value})};
|
||||
inputFacebookSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("f_subject",0);null==a&&(a={subject_id:""});this.subject_id.value=a.subject_id};
|
||||
inputFacebookSubject.prototype.attach=function(a){function b(a){c.fieldsToStorage();c.handler(!0);c.storageToFields()}console.log("SUBJECT: ATTACH");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()};
|
||||
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;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()};
|
||||
|
|
|
@ -12,7 +12,7 @@ a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');for(c=0;c<b.length;c++)
|
|||
a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(c=0;c<b.length;c++)b[c].value==a.loc?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(c=0;c<b.length;c++)b[c].value==a.context?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+
|
||||
a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');for(c=0;c<b.length;c++)-1<a.freq.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(c=0;c<b.length;c++)-1<a.connect.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked")};
|
||||
inputPhoneFiche.prototype.storageToFields=function(){console.group("[phone.fiche] storage to fields");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var c in a)a[c].uid==this.selected&&this.add(a[c]);this.updateNavBar();console.groupEnd()};
|
||||
inputPhoneFiche.prototype.sync=function(){console.group("[phone.fiche] Synchronisation");var a=lsi["export"]("p_contacts"),c=[],b,d=40>lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40,e;for(e in a){for(ficheUid=0;-1<c.indexOf(ficheUid)&&ficheUid<d;)ficheUid++;c.push(ficheUid);a=lsi.get("p_fiches",ficheUid);!a&&(a=this.defaultData);a.uid=ficheUid;a.contact=parseInt(e);lsi.set("p_fiches",ficheUid,a);if(c.length>=d)break}var a=lsi["export"]("p_fiches"),f;for(f in a)if(d=lsi.get("p_contacts",
|
||||
inputPhoneFiche.prototype.sync=function(){console.group("[phone.fiche] synchronisation");var a=lsi["export"]("p_contacts"),c=[],b,d=40>lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40,e;for(e in a){for(ficheUid=0;-1<c.indexOf(ficheUid)&&ficheUid<d;)ficheUid++;c.push(ficheUid);a=lsi.get("p_fiches",ficheUid);!a&&(a=this.defaultData);a.uid=ficheUid;a.contact=parseInt(e);lsi.set("p_fiches",ficheUid,a);if(c.length>=d)break}var a=lsi["export"]("p_fiches"),f;for(f in a)if(d=lsi.get("p_contacts",
|
||||
a[f].contact)){c=null;e=20>parseInt(a[f].uid);for(var g in a)if(!(e&&20>g||!e&&20<=g)&&(b=lsi.get("p_contacts",a[g].contact),g!=f&&b)){var h=0<b.username.length&&d.username===b.username;b=!isNaN(b.existing)&&d.existing===b.existing;(h||b)&&(c=a[g]);if(null!==c)break}null===c||c.timestamp>a[f].timestamp||(d=a[f],d.uid=c.uid,lsi.set("p_fiches",c.uid,d))}console.groupEnd()};
|
||||
inputPhoneFiche.prototype.nav=function(a){if(!(a instanceof Element&&a.getData("n"))||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_fiches");this.nav_container.innerHTML="";for(var c=Object.keys(a),b=0;b<c.length;b++){var d=parseInt(c[b]);0==d&&(this.nav_container.innerHTML+="<span>APPELS</span>");20>d&&b<c.length-1&&20<=c[b+1]?this.nav_container.innerHTML+='<span data-n="'+d+'" class="lc">'+(d%20+1)+"</span> ":(20==d&&(this.nav_container.innerHTML+='<br><span class="fc"> SMS </span>'),this.nav_container.innerHTML+='<span data-n="'+
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var inputPhoneMatrice=function(a){this.container=a};inputPhoneMatrice.prototype={container:this.container};
|
||||
inputPhoneMatrice.prototype.fieldsToStorage=function(){console.group("[phone.matrice] fields to storage");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var c={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==c[b]&&(c[b]=[]),c[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==c[b]&&(c[b]=[]),c[b].push(parseInt(a[b])));lsi.set("p_matrice",0,c);console.groupEnd()};
|
||||
inputPhoneMatrice.prototype.storageToFields=function(){console.group("[phone.matrice] storage to fields");var a=lsi["export"]("p_fiches"),c=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),e=[],d;for(d in a)-1==e.indexOf(a[d].contact)&&e.push(a[d].contact);a="<table class='line'>";for(d=0;d<e.length;d++){var g=b[d],a=a+"<tr>";0<d?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==d?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
|
||||
a+=h.username,a+="</span>"):f<d?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='p_matrice_"+g.uid+"_"+h.uid+"'",null!=c[d]&&-1<c[d].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='p_matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>";console.groupEnd()};
|
||||
inputPhoneMatrice.prototype.attach=function(){console.group("[phone.matrice] attaching events");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(c){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1);console.groupEnd()};
|
||||
inputPhoneMatrice.prototype.storageToFields=function(){console.group("[phone.matrice] storage to fields");var a=lsi["export"]("p_fiches"),c=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),e=[],d;for(d in a)-1==e.indexOf(a[d].contact)&&e.push(a[d].contact);a=["<table class='line'>"];for(d=0;d<e.length;d++){var f=b[d];a.push("<tr>");0<d?(a.push('<td style="text-align: right;">'),a.push(isNaN(f.existing)?f.username:lsi.get("p_friends",f.existing).name),a.push("</td>")):a.push("<td></td>");for(var h=
|
||||
0;h<e.length;h++)if(h<e.length-1){var g=b[h];0==d?(a.push("<td>"),a.push('<span style="writing-mode: vertical-lr; text-align: right;">'),a.push(isNaN(g.existing)?g.username:lsi.get("p_friends",g.existing).name),a.push("</span>")):h<d?(a.push("<td>"),a.push("<input type='checkbox' name='matrice_"+f.uid+"_"+g.uid+"' data-name='"+f.uid+"' value='"+g.uid+"' id='p_matrice_"+f.uid+"_"+g.uid+"'"),null!=c[d]&&-1<c[d].indexOf(h)&&a.push(" checked"),a.push(" >"),a.push("<label for='p_matrice_"+f.uid+"_"+g.uid+
|
||||
"'></label>")):a.push("<td class='hidden'>");a.push("</td>")}a.push("</tr>")}a.push("</table>");this.container.innerHTML=a.join("");console.groupEnd()};inputPhoneMatrice.prototype.attach=function(){console.group("[phone.matrice] attaching events");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(c){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1);console.groupEnd()};
|
||||
inputPhoneMatrice.prototype.parseGrid=function(){var a=$$(".matrice-panel input[data-name][value]"),c;for(c in a)if(a[c]instanceof Element){var b=a[c].getData("name"),e=a[c].value;this.sGrid[b]instanceof Array||(this.sGrid[b]=[]);this.sGrid[b][e]=a[c]}};
|
||||
|
|
|
@ -875,6 +875,7 @@ var pDynamicUpdate = function(target){
|
|||
return false;
|
||||
|
||||
|
||||
console.groupEnd(); console.groupEnd();
|
||||
console.group('[phone] Dynamic Update');
|
||||
|
||||
/* (1) On enregistre les MINI fiches relation */
|
||||
|
@ -903,8 +904,10 @@ var pDynamicUpdate = function(target){
|
|||
|
||||
api.send({ path: 'subject/getFriends', subject_id: pSubjectManager.subject_id.value }, function(response){
|
||||
// Si erreur, on quitte
|
||||
if( response.ModuleError != 0 )
|
||||
if( response.ModuleError != 0 ){
|
||||
console.groupEnd();
|
||||
return false;
|
||||
}
|
||||
|
||||
// On enregistre les contacts existants
|
||||
lsi.import('p_friends', response.subjects);
|
||||
|
@ -954,6 +957,7 @@ var fDynamicUpdate = function(target){
|
|||
if( !isSaveButton && !isNavButton && !isNavContact && target !== true )
|
||||
return false;
|
||||
|
||||
console.groupEnd(); console.groupEnd();
|
||||
console.group('[facebook] Dynamic Update');
|
||||
|
||||
/* (1) On enregistre les MINI fiches relation */
|
||||
|
@ -982,8 +986,10 @@ var fDynamicUpdate = function(target){
|
|||
|
||||
api.send({ path: 'subject/getFriends', subject_id: fSubjectManager.subject_id.value }, function(response){
|
||||
// Si erreur, on quitte
|
||||
if( response.ModuleError != 0 )
|
||||
if( response.ModuleError != 0 ){
|
||||
console.groupEnd();
|
||||
return false;
|
||||
}
|
||||
|
||||
// On enregistre les contacts existants
|
||||
lsi.import('f_friends', response.subjects);
|
||||
|
|
|
@ -20,10 +20,10 @@ a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_c
|
|||
pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention",
|
||||
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
||||
1E4);console.log(a)},!1)},!1),console.groupEnd())};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=!0;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=!0;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=!0;facebookRoutine()});include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=!0;facebookRoutine()});include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=!0;facebookRoutine()});
|
||||
var pDynamicUpdate=function(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("p_nav-mini"==a.parentNode.id||"p_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"p_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.group("[phone] Dynamic Update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();!0===a?api.send({path:"subject/getFriends",
|
||||
subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(c||b)&&pContactManager.storageToFields());console.groupEnd()},fDynamicUpdate=function(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==
|
||||
a.type,g=b&&"SPAN"==a.tagName&&("f_nav-mini"==a.parentNode.id||"f_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"f_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},function(a){if(0!=
|
||||
a.ModuleError)return!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),(c||b)&&fContactManager.storageToFields());console.groupEnd()};
|
||||
var pDynamicUpdate=function(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("p_nav-mini"==a.parentNode.id||"p_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"p_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.groupEnd();console.groupEnd();console.group("[phone] Dynamic Update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();
|
||||
pMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return console.groupEnd(),!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(c||b)&&pContactManager.storageToFields());console.groupEnd()},
|
||||
fDynamicUpdate=function(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("f_nav-mini"==a.parentNode.id||"f_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"f_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.groupEnd();console.groupEnd();console.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();
|
||||
fMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return console.groupEnd(),!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),(c||b)&&fContactManager.storageToFields());console.groupEnd()};
|
||||
function testContactsPhone(){for(var a=0;45>a;a++)0==a%20?lsi.set("p_contacts",a,{uid:a,username:"contact-x"}):lsi.set("p_contacts",a,{uid:a,username:"contact-"+a})}
|
||||
function testRoutinePhone(a){var b=lsi["export"]("p_contacts"),c=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),d=0;if(null!=a&&a)for(var f in c)isNaN(f)||(a="",null!=b[f]&&(a=b[f].username),c=$('#p_nav-mini [data-n="'+f+'"]'),c.click(),$("#unknown_min_p_"+f).checked=0==a.length,0==a.length?($("#sexeI_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=
|
||||
0,$("#reltype9_mini_p_"+f).checked=!0):(a=["H","F"][Math.floor(d%2)],$("#sexe"+a+"_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=1+d%6,a=d%10,9==a?($("#reltype10_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_p_"+f).checked=!0,d++));for(var e in g)isNaN(e)||(c=$('#p_nav-fiche [data-n="'+
|
||||
|
|
Loading…
Reference in New Issue