Correction de 'page-manager.js' plus de bug de chargement d'une resource appellée via Ajax au lieu de la page sélectionnée => BIG FIX

This commit is contained in:
xdrm-brackets 2016-09-30 11:03:18 +02:00
parent fb93be99ea
commit 5c51989e43
8 changed files with 247 additions and 260 deletions

View File

@ -1,9 +1,8 @@
var DOM={WRAPPER:$("body > #WRAPPER"),HEADER:$("body > #WRAPPER > #HEADER"),MENUSIDE:$("body > #WRAPPER > #MENU-SIDE"),CONTAINER:$("body > #WRAPPER > #CONTAINER")},pageManager;api=new APIClass("/api/");Notification=new NotificationClass($("#notification-container"));Notification.defaultTimeout=4E3; var DOM,pageManager,api,Notification,navSubMenu=function(a){var c=$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");c=$$("#CONTAINER > section[data-sublink].active");
Notification.errorCodes={"-1":"Erreur de r\u00e9seau, veuillez recharger la page et r\u00e9essayer",0:"Erreur interne",1:"Erreur interne",2:"Erreur interne",3:"Le fichier est introuvable",4:"Erreur interne",5:"Erreur interne",6:"Erreur interne",7:"Erreur interne",8:"Erreur interne",9:"Certaines donn\u00e9es sont manquantes",10:"Erreur interne",11:"Erreur interne",12:"Erreur interne",13:"Erreur interne",14:"Erreur interne",15:"Erreur interne",16:"Vous n'avez pas la permission d'effectuer cette action", for(a=0;a<c.length;a++)c[a].remClass("active");if(null!=b)for(b.addClass("active"),c=$$('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),a=0;a<c.length;a++)c[a].addClass("active");if(!b.getData("sublink"))return!1;a=pageManager.vars[0]!=b.getData("sublink");pageManager.vars[0]=b.getData("sublink");a&&pageManager.updateURL()},navMenu=function(a){var c=$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$('#WRAPPER > #MENU-SIDE > span[data-link="'+
17:"Le t\u00e9l\u00e9chargement a \u00e9chou\u00e9",18:"Le fichier est invalide (format incorrect)"};lsi.setStorage(localStorage); a+'"]'):b,b=null==b?$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]'):b;if(null==b)return!1;null!=c&&c.remClass("active");null!=b&&b.addClass("active");b.getData("link")&&(DOM.HEADER.addClass("loading"),pageManager.setPage(b.getData("link")),pageManager.activeXHR.addEventListener("loadend",function(){1<=pageManager.vars.length&&null!=$('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=$("#MENU-SIDE > span[data-link="+
function navSubMenu(a){var c=$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");c=$$("#CONTAINER > section[data-sublink].active");for(a=0;a< pageManager.page+"] + div.sub");null!=a&&a.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1);DOM.HEADER.remClass("loading")},!1))};DOM={WRAPPER:$("body > #WRAPPER"),HEADER:$("body > #WRAPPER > #HEADER"),MENUSIDE:$("body > #WRAPPER > #MENU-SIDE"),CONTAINER:$("body > #WRAPPER > #CONTAINER")};api=new APIClass("/api/");Notification=new NotificationClass($("#notification-container"));
c.length;a++)c[a].remClass("active");if(null!=b)for(b.addClass("active"),c=$$('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),a=0;a<c.length;a++)c[a].addClass("active");if(!b.getData("sublink"))return!1;a=pageManager.vars[0]!=b.getData("sublink");pageManager.vars[0]=b.getData("sublink");a&&pageManager.updateURL()} Notification.defaultTimeout=4E3;
function navMenu(a){var c=$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$('#WRAPPER > #MENU-SIDE > span[data-link="'+a+'"]'):b,b=null==b?$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]'):b;if(null==b)return!1;null!=c&&c.remClass("active");null!=b&&b.addClass("active");b.getData("link")&&(DOM.HEADER.addClass("loading"),pageManager.setPage(b.getData("link")),pageManager.activeXHR.addEventListener("loadend", Notification.errorCodes={"-1":"Erreur de r\u00e9seau, veuillez recharger la page et r\u00e9essayer",0:"Erreur interne",1:"Erreur interne",2:"Erreur interne",3:"Le fichier est introuvable",4:"Erreur interne",5:"Erreur interne",6:"Erreur interne",7:"Erreur interne",8:"Erreur interne",9:"Certaines donn\u00e9es sont manquantes",10:"Erreur interne",11:"Erreur interne",12:"Erreur interne",13:"Erreur interne",14:"Erreur interne",15:"Erreur interne",16:"Vous n'avez pas la permission d'effectuer cette action",17:"Le t\u00e9l\u00e9chargement a \u00e9chou\u00e9",
function(){1<=pageManager.vars.length&&null!=$('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub");null!=a&&a.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1);DOM.HEADER.remClass("loading")},!1))} 18:"Le fichier est invalide (format incorrect)"};lsi.setStorage(localStorage);DOM.MENUSIDE.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);function reload(){navMenu(pageManager.page)}var LOGIN={show:document.getElementById("user-data"),hide:document.getElementById("login-close"),page:document.getElementById("LOGIN")};
DOM.MENUSIDE.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);function reload(){navMenu(pageManager.page)}var LOGIN={show:document.getElementById("user-data"),hide:document.getElementById("login-close"),page:document.getElementById("LOGIN")};LOGIN.show.addEventListener("click",function(a){LOGIN.page.className="active"},!1); LOGIN.show.addEventListener("click",function(a){LOGIN.page.className="active"},!1);LOGIN.hide.addEventListener("click",function(a){LOGIN.page.className=""},!1);api.send({path:"download/menu"},function(a){if(0==a.ModuleError){pagelist=[];for(var c=0;c<a.menu.length;c++)pagelist.push(a.menu[c].attributes["data-link"]);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,pagelist,null);navMenu(pageManager.page)}});
LOGIN.hide.addEventListener("click",function(a){LOGIN.page.className=""},!1);api.send({path:"download/menu"},function(a){if(0==a.ModuleError){pagelist=[];for(var c=0;c<a.menu.length;c++)pagelist.push(a.menu[c].attributes["data-link"]);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,pagelist,null);navMenu(pageManager.page)}});

View File

@ -1,20 +1,165 @@
var DOM, pageManager, api, Notification;
/* [1] Toggle du sub-menu-side <-> navigation
===========================================*/
var navSubMenu = function(subsection){
/* [1] Format du param
------------------------------------------------*/
// Contient l'element courant
var current = $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]');
// Contiendra l'element cible
var target = null;
// si @subsection est un element, on le prends
target = (subsection instanceof Element) ? subsection : null;
// Si string, on trouve l'element correspondant
target = (typeof subsection == 'string') ? $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink="'+subsection+'"]') : target;
// Si rien trouve, on prend le premier element correspondant a la premiere page
target = (target == null) ? $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink]') : target;
// Si le param n'est toujours pas bon, on retourne une erreur
if( target == null ) return false;
/* [2] Gestion de l'affichage de l'element
------------------------------------------------*/
// On desactive l'element courant
if( current != null )
current.remClass('active');
// On cache les sections visibles
var visibleSections = $$('#CONTAINER > section[data-sublink].active');
for( var i = 0 ; i < visibleSections.length ; i++ )
visibleSections[i].remClass('active');
// On active le nouveau
if( target != null ){
target.addClass('active');
// On affiche les sections associées
var targetSections = $$('#CONTAINER > section[data-sublink="'+target.getData('sublink')+'"]');
for( var i = 0 ; i < targetSections.length ; i++ )
targetSections[i].addClass('active');
}
/* [3] Gestion de pageManager
------------------------------------------------*/
// Si element, on recupere le data-link
var page = null;
// Si erreur, on retourne FALSE
if( !target.getData('sublink') ) return false
var mustRefresh = pageManager.vars[0] != target.getData('sublink');
// On met a jour la variable page-manager si data-link trouve
pageManager.vars[0] = target.getData('sublink');
if( mustRefresh )
// navMenu(pageManager.page);
pageManager.updateURL();
}
/* [4] Toggle du side-menu <-> navigation
===========================================*/
var navMenu = function(section){
/* [1] Format du param
------------------------------------------------*/
// Contient l'element courant
var current = $('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]');
// Contiendra l'element cible
var target = null;
// si @section est un element, on le prends
target = (section instanceof Element) ? section : null;
// Si string, on trouve l'element correspondant
target = (typeof section == 'string') ? $('#WRAPPER > #MENU-SIDE > span[data-link="'+section+'"]') : target;
// Si rien trouve, on prend le premier element correspondant a la premiere page
target = (target == null) ? $('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]') : target;
// Si le param n'est toujours pas bon, on retourne une erreur
if( target == null ) return false;
/* [2] Gestion de l'affichage de l'element
------------------------------------------------*/
// On desactive l'element courant
if( current != null )
current.remClass('active');
// On active le nouveau
if( target != null )
target.addClass('active');
/* [3] Gestion de pageManager
------------------------------------------------*/
// Si element, on recupere le data-link
var page = null;
// On charge la page si data-link trouve
if( target.getData('link') ){
DOM.HEADER.addClass('loading'); // Animation de chargement
pageManager.setPage( target.getData('link') );
pageManager.activeXHR.addEventListener('loadend', function(){
// On gere la navigation du sous-menu (si defini, utilise)
var subSectionExists = pageManager.vars.length >= 1 && $('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]') != null;
if( subSectionExists ) // Si le lien du menu associe existe
navSubMenu(pageManager.vars[0]); // on charge la page associee
else // sinon
navSubMenu(null); // on charge le lien par defaut
// GESTION DE LA NAVIGATION DU SOUS-MENU
// si le sous-menu existe
var smenu = $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub');
if( smenu != null )
smenu.addEventListener('click', function(e){
var target = e.target;
while( target != document.body && !target.getData('sublink') )
target = target.parentNode;
if( target.getData('sublink') )
navSubMenu(target);
}, false);
// On retire l'icone de chargement
DOM.HEADER.remClass('loading');
}, false);
}
}
/* [0] Initialisation des variables en local /* [0] Initialisation des variables en local
=========================================================*/ =========================================================*/
var DOM = { DOM = {
WRAPPER: $('body > #WRAPPER'), WRAPPER: $('body > #WRAPPER'),
HEADER: $('body > #WRAPPER > #HEADER'), HEADER: $('body > #WRAPPER > #HEADER'),
MENUSIDE: $('body > #WRAPPER > #MENU-SIDE'), MENUSIDE: $('body > #WRAPPER > #MENU-SIDE'),
CONTAINER: $('body > #WRAPPER > #CONTAINER') CONTAINER: $('body > #WRAPPER > #CONTAINER')
}; };
var pageManager;
// On cree une instance de l'api // On cree une instance de l'api
api = new APIClass('/api/'); api = new APIClass('/api/');
// On crée une instance du gestionnaire des notifications // On crée une instance du gestionnaire des notifications
Notification = new NotificationClass( $('#notification-container') ); var Notification = new NotificationClass( $('#notification-container') );
// Temps d'une notification : ~4s // Temps d'une notification : ~4s
Notification.defaultTimeout = 4000; Notification.defaultTimeout = 4000;
@ -49,161 +194,6 @@
/* [1] Toggle du sub-menu-side <-> navigation
===========================================*/
function navSubMenu(subsection){
/* [1] Format du param
------------------------------------------------*/
// Contient l'element courant
var current = $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]');
// Contiendra l'element cible
var target = null;
// si @subsection est un element, on le prends
target = (subsection instanceof Element) ? subsection : null;
// Si string, on trouve l'element correspondant
target = (typeof subsection == 'string') ? $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink="'+subsection+'"]') : target;
// Si rien trouve, on prend le premier element correspondant a la premiere page
target = (target == null) ? $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub > span[data-sublink]') : target;
// Si le param n'est toujours pas bon, on retourne une erreur
if( target == null ) return false;
/* [2] Gestion de l'affichage de l'element
------------------------------------------------*/
// On desactive l'element courant
if( current != null )
current.remClass('active');
// On cache les sections visibles
var visibleSections = $$('#CONTAINER > section[data-sublink].active');
for( var i = 0 ; i < visibleSections.length ; i++ )
visibleSections[i].remClass('active');
// On active le nouveau
if( target != null ){
target.addClass('active');
// On affiche les sections associées
var targetSections = $$('#CONTAINER > section[data-sublink="'+target.getData('sublink')+'"]');
for( var i = 0 ; i < targetSections.length ; i++ )
targetSections[i].addClass('active');
}
/* [3] Gestion de pageManager
------------------------------------------------*/
// Si element, on recupere le data-link
var page = null;
// Si erreur, on retourne FALSE
if( !target.getData('sublink') ) return false
var mustRefresh = pageManager.vars[0] != target.getData('sublink');
// On met a jour la variable page-manager si data-link trouve
pageManager.vars[0] = target.getData('sublink');
if( mustRefresh )
// navMenu(pageManager.page);
pageManager.updateURL();
}
/* [4 Toggle du side-menu <-> navigation
===========================================*/
function navMenu(section){
/* [1] Format du param
------------------------------------------------*/
// Contient l'element courant
var current = $('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]');
// Contiendra l'element cible
var target = null;
// si @section est un element, on le prends
target = (section instanceof Element) ? section : null;
// Si string, on trouve l'element correspondant
target = (typeof section == 'string') ? $('#WRAPPER > #MENU-SIDE > span[data-link="'+section+'"]') : target;
// Si rien trouve, on prend le premier element correspondant a la premiere page
target = (target == null) ? $('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]') : target;
// Si le param n'est toujours pas bon, on retourne une erreur
if( target == null ) return false;
/* [2] Gestion de l'affichage de l'element
------------------------------------------------*/
// On desactive l'element courant
if( current != null )
current.remClass('active');
// On active le nouveau
if( target != null )
target.addClass('active');
/* [3] Gestion de pageManager
------------------------------------------------*/
// Si element, on recupere le data-link
var page = null;
// On charge la page si data-link trouve
if( target.getData('link') ){
DOM.HEADER.addClass('loading'); // Animation de chargement
pageManager.setPage( target.getData('link') );
pageManager.activeXHR.addEventListener('loadend', function(){
// On gere la navigation du sous-menu (si defini, utilise)
var subSectionExists = pageManager.vars.length >= 1 && $('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]') != null;
if( subSectionExists ) // Si le lien du menu associe existe
navSubMenu(pageManager.vars[0]); // on charge la page associee
else // sinon
navSubMenu(null); // on charge le lien par defaut
// GESTION DE LA NAVIGATION DU SOUS-MENU
// si le sous-menu existe
var smenu = $('#MENU-SIDE > span[data-link='+pageManager.page+'] + div.sub');
if( smenu != null )
smenu.addEventListener('click', function(e){
var target = e.target;
while( target != document.body && !target.getData('sublink') )
target = target.parentNode;
if( target.getData('sublink') )
navSubMenu(target);
}, false);
// On retire l'icone de chargement
DOM.HEADER.remClass('loading');
}, false);
}
}
/* [5] Gestion de la navigation (physique) /* [5] Gestion de la navigation (physique)

View File

@ -14,7 +14,7 @@ for(b=0;b<c.length;b++)-1<a.freq.indexOf(c[b].value)?c[b].setAttribute("checked"
inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()}; inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=[],c=40>lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40;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("p_fiches",d);null==a&&(a=this.defaultData);a.uid=d;a.contact=parseInt(e);lsi.set("p_fiches",d,a);if(b.length>=c)break}var a=lsi["export"]("p_fiches"),f;for(f in a)b=lsi.get("p_contacts",a[f].contact),null!=b&&(b=20>parseInt(f)?20+b.sms: inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=[],c=40>lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40;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("p_fiches",d);null==a&&(a=this.defaultData);a.uid=d;a.contact=parseInt(e);lsi.set("p_fiches",d,a);if(b.length>=c)break}var a=lsi["export"]("p_fiches"),f;for(f in a)b=lsi.get("p_contacts",a[f].contact),null!=b&&(b=20>parseInt(f)?20+b.sms:
b.call,b=a[b],null==b||b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))};inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))}; b.call,b=a[b],null==b||b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))};inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),c=0;c<b.length;c++)b[c].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 b=Object.keys(a),c=0;c<b.length;c++){var e=parseInt(b[c]);0==e&&(this.nav_container.innerHTML+="<span>APPELS</span>");20>e&&c<b.length-1&&20<=b[c+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%20+1)+"</span>&nbsp;&nbsp;":(20==e&&(this.nav_container.innerHTML+='<br><span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+e+'">'+(e%20+ inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_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>APPELS</span>");20>e&&c<b.length-1&&20<=b[c+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%20+1)+"</span>&nbsp;&nbsp;":(20==e&&(this.nav_container.innerHTML+='<br><span class="fc">&nbsp;&nbsp; SMS &nbsp;&nbsp;</span>'),this.nav_container.innerHTML+='<span data-n="'+
1)+"</span>")}for(var d in a)b=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))}; e+'">'+(e%20+1)+"</span>")}for(var d in a)b=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.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]))&&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|| inputPhoneFiche.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};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;var 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};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -480,7 +480,7 @@ inputPhoneFiche.prototype.updateNavBar = function(){
// Si début du top 20 des SMS, on met le label 'SMS' et un border-left // Si début du top 20 des SMS, on met le label 'SMS' et un border-left
else if( i == 20 ){ else if( i == 20 ){
this.nav_container.innerHTML += '<br><span class="fc">SMS</span>'; this.nav_container.innerHTML += '<br><span class="fc">&nbsp;&nbsp; SMS &nbsp;&nbsp;</span>';
this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i%20 + 1)+'</span>'; this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i%20 + 1)+'</span>';
// Sinon, on ajoute juste le bouton // Sinon, on ajoute juste le bouton

View File

@ -1,9 +1,9 @@
function pageManagerClass(){}var ptrPageManagerClass; function pageManagerClass(){}var ptrPageManagerClass;
pageManagerClass.prototype={depJS:null,depCSS:null,xhr:[],activeXHR:null,page:null,vars:[],root:"",path:"",jsPath:"js",cssPath:"css",pagelist:null,container:null,ajax:function(b,d,e,a){for(var f=0;f<this.xhr.length;f++)this.xhr=this.xhr.slice(0,f-1).concat(this.xhr.slice(f,this.xhr.length-1));var c;c=window.XMLHttpRequest?this.xhr.push(new XMLHttpRequest)-1:this.xhr.push(new ActiveXObject("Microsoft.XMLHttpRequest"))-1;this.activeXHR=this.xhr[c];var g=this;this.xhr[c].onreadystatechange=function(){4== pageManagerClass.prototype={depJS:null,depCSS:null,xhr:[],activeXHR:null,page:null,vars:[],root:"",path:"",jsPath:"js",cssPath:"css",pagelist:null,container:null,ajax:function(b,d,f,a){var e;e=window.XMLHttpRequest?this.xhr.push(new XMLHttpRequest)-1:this.xhr.push(new ActiveXObject("Microsoft.XMLHttpRequest"))-1;this.activeXHR=this.xhr[e];var c=this;this.xhr[e].addEventListener("readystatechange",function(){if(void 0!=c.xhr[e]&&4==c.xhr[e].readyState){-1<[0,200].indexOf(c.xhr[e].status)?d(c.xhr[e].responseText):
g.xhr[c].readyState&&(-1<[0,200].indexOf(g.xhr[c].status)?d(g.xhr[c].responseText):d())};e="string"==typeof e&&/^POST|GET$/i.test(e)?e.toUpperCase():"POST";a="POST"==e&&"object"==typeof a&&a instanceof FormData?a:null;this.xhr[c].open(e,b,!0);this.xhr[c].send(a);return this},explodeURL:function(b){b=1<=arguments.length?b:document.URL;if(null!=this.pagelist&&/^(?:(?:https?:\/\/)?[^\/]+)\/([a-z0-9_]+)\/?(?:\/((?:.+\/)+)\/?)?$/i.test(b)){for(var d=RegExp.$2.split("/");""==d[d.length-1];)d.pop();return-1< d();c.xhr[e]=null;for(var a=!0,b=0;b<c.xhr.length;b++)if(null!==c.xhr[b]){a=!1;break}a&&(c.xhr=[])}},!1);f="string"==typeof f&&/^POST|GET$/i.test(f)?f.toUpperCase():"POST";a="POST"==f&&"object"==typeof a&&a instanceof FormData?a:null;this.xhr[e].open(f,b,!0);this.xhr[e].send(a);return this},explodeURL:function(b){b=1<=arguments.length?b:document.URL;if(null!=this.pagelist&&/^(?:(?:https?:\/\/)?[^\/]+)\/([a-z0-9_]+)\/?(?:\/((?:.+\/)+)\/?)?$/i.test(b)){for(var d=RegExp.$2.split("/");""==d[d.length-
this.pagelist.indexOf(RegExp.$1)?{page:RegExp.$1,"var":d}:null}return null},loadDependencies:function(){"object"==typeof this.depCSS&&this.depCSS instanceof Element&&this.depCSS.parentNode==document.head&&document.head.removeChild(this.depCSS);"object"==typeof this.depJS&&this.depJS instanceof Element&&this.depJS.parentNode==document.head&&document.head.removeChild(this.depJS);ptrPageManagerClass=this;this.ajax(this.root+this.path+"/"+this.cssPath+"/"+this.page+".css",function(b){null!=b?(ptrPageManagerClass.depCSS= 1];)d.pop();return-1<this.pagelist.indexOf(RegExp.$1)?{page:RegExp.$1,"var":d}:null}return null},loadDependencies:function(){"object"==typeof this.depCSS&&this.depCSS instanceof Element&&this.depCSS.parentNode==document.head&&document.head.removeChild(this.depCSS);"object"==typeof this.depJS&&this.depJS instanceof Element&&this.depJS.parentNode==document.head&&document.head.removeChild(this.depJS);ptrPageManagerClass=this;this.ajax(this.root+this.path+"/"+this.cssPath+"/"+this.page+".css",function(b){null!=
document.createElement("link"),ptrPageManagerClass.depCSS.rel="stylesheet",ptrPageManagerClass.depCSS.type="text/css",ptrPageManagerClass.depCSS.href=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+ptrPageManagerClass.page+".css",document.head.appendChild(ptrPageManagerClass.depCSS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+ptrPageManagerClass.page+".css)")});this.ajax(this.root+ b?(ptrPageManagerClass.depCSS=document.createElement("link"),ptrPageManagerClass.depCSS.rel="stylesheet",ptrPageManagerClass.depCSS.type="text/css",ptrPageManagerClass.depCSS.href=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+ptrPageManagerClass.page+".css",document.head.appendChild(ptrPageManagerClass.depCSS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+ptrPageManagerClass.page+
this.path+"/"+this.jsPath+"/"+this.page+".js",function(b){null!=b?(ptrPageManagerClass.depJS=document.createElement("script"),ptrPageManagerClass.depJS.type="text/javascript",ptrPageManagerClass.depJS.src=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.jsPath+"/"+ptrPageManagerClass.page+".js",document.head.appendChild(ptrPageManagerClass.depJS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.jsPath+"/"+ ".css)")});this.ajax(this.root+this.path+"/"+this.jsPath+"/"+this.page+".js",function(b){null!=b?(ptrPageManagerClass.depJS=document.createElement("script"),ptrPageManagerClass.depJS.type="text/javascript",ptrPageManagerClass.depJS.src=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.jsPath+"/"+ptrPageManagerClass.page+".js",document.head.appendChild(ptrPageManagerClass.depJS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+
ptrPageManagerClass.page+".js)")})},updateURL:function(){0<this.vars.length?window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/"+this.vars.join("/")+"/"):window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/")},setPage:function(b,d,e,a,f){var c="object"==typeof a&&a instanceof Array?a:null;if(null!=c)for(a=0;a<c.length&&(c="string"==typeof c[a]&&/^[a-z0-9_]+$/i.test(c[a])?c:null,null!=c);a++);this.pagelist=null!=c?c:this.pagelist;this.page=this.pagelist[0];this.root= ptrPageManagerClass.jsPath+"/"+ptrPageManagerClass.page+".js)")})},updateURL:function(){0<this.vars.length?window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/"+this.vars.join("/")+"/"):window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/")},setPage:function(b,d,f,a,e){var c="object"==typeof a&&a instanceof Array?a:null;if(null!=c)for(a=0;a<c.length&&(c="string"==typeof c[a]&&/^[a-z0-9_]+$/i.test(c[a])?c:null,null!=c);a++);this.pagelist=null!=c?c:this.pagelist;
"string"==typeof f?f:this.root;this.path="string"==typeof d?d:this.path;this.container="object"==typeof e&&e instanceof Element?e:this.container;if(null!=this.pagelist&&null!=this.container)if("string"==typeof b&&-1<this.pagelist.indexOf(b)){this.page=b;var g=this;b=new FormData;for(a=0;a<this.vars.length;a++)b.append(this.vars[a],null);this.ajax(this.root+this.path+"/"+this.page+".php",function(a){g.container.innerHTML=a;g.loadDependencies()},"POST",b);this.updateURL()}else if(d=this.explodeURL(), this.page=this.pagelist[0];this.root="string"==typeof e?e:this.root;this.path="string"==typeof d?d:this.path;this.container="object"==typeof f&&f instanceof Element?f:this.container;if(null!=this.pagelist&&null!=this.container)if("string"==typeof b&&-1<this.pagelist.indexOf(b)){this.page=b;var g=this;b=new FormData;for(a=0;a<this.vars.length;a++)b.append(this.vars[a],null);this.ajax(this.root+this.path+"/"+this.page+".php",function(a){g.container.innerHTML=a;g.loadDependencies()},"POST",b);this.updateURL()}else if(d=
null!=d){this.page=d.page;var h=this;b=new FormData;for(a=this.vars.length=0;a<d["var"].length;a++)this.vars[a]=d["var"][a],b.append(this.vars[a],null);this.ajax(this.root+this.path+"/"+this.page+".php",function(a){h.container.innerHTML=a;h.loadDependencies()},"POST",b);this.updateURL()}else this.setPage(this.pagelist[0]);else console.warn("pagelist et container manquant");return this},refresh:function(){this.setPage(this.page);return this}}; this.explodeURL(),null!=d){this.page=d.page;var h=this;b=new FormData;for(a=this.vars.length=0;a<d["var"].length;a++)this.vars[a]=d["var"][a],b.append(this.vars[a],null);this.ajax(this.root+this.path+"/"+this.page+".php",function(a){h.container.innerHTML=a;h.loadDependencies()},"POST",b);this.updateURL()}else this.setPage(this.pagelist[0]);else console.warn("pagelist et container manquant");return this},refresh:function(){this.setPage(this.page);return this}};

View File

@ -37,10 +37,9 @@ pageManagerClass.prototype = {
========================================================================== */ ========================================================================== */
ajax: function(pLink, pHandler, pMethod, pForm){ ajax: function(pLink, pHandler, pMethod, pForm){
// on efface les requêtes qui sont terminées et on push une nouvelle // on efface les requêtes qui sont terminées et on push une nouvelle
for( var i = 0 ; i < this.xhr.length ; i++ ){ // for( var i = 0 ; i < this.xhr.length ; i++ ){
// if( this.xhr[i].readyState == 4 ) // si terminée // this.xhr = this.xhr.splice(i, 1); // suppression entrée
this.xhr = this.xhr.slice(0,i-1).concat(this.xhr.slice(i,this.xhr.length-1)); // suppression entrée // }
}
var index; var index;
@ -52,14 +51,38 @@ pageManagerClass.prototype = {
// On definit un pointeur sur l'instance XHR active (ajax) // On definit un pointeur sur l'instance XHR active (ajax)
this.activeXHR = this.xhr[index]; this.activeXHR = this.xhr[index];
var ptrPageManagerClass = this; var self = this;
this.xhr[index].onreadystatechange = function(){ this.xhr[index].addEventListener('readystatechange', function(){
if( ptrPageManagerClass.xhr[index].readyState == 4 ) // si la requête est terminée
if( [0,200].indexOf(ptrPageManagerClass.xhr[index].status) > -1 ) // si fichier existe et reçu // si la requete n'a pas ete supprimee
pHandler(ptrPageManagerClass.xhr[index].responseText); if( self.xhr[index] == undefined )
return;
// Si la requête est terminée
if( self.xhr[index].readyState == 4 ){ // si la requête est terminée
if( [0,200].indexOf(self.xhr[index].status) > -1 ) // si fichier existe et reçu
pHandler(self.xhr[index].responseText);
else // si code d'erreur retourne null else // si code d'erreur retourne null
pHandler(); pHandler();
};
// On supprime la requête
self.xhr[index] = null;
// S'il n'y a plus de requête active, on supprime tout
var empty = true;
for( var i = 0 ; i < self.xhr.length ; i++ )
if( self.xhr[i] !== null ){
empty = false;
break;
}
// Si tout est vide, on efface
empty && ( self.xhr = [] );
}
}, false);
// gestion de la méthode // gestion de la méthode
var method = ( typeof pMethod == 'string' && /^POST|GET$/i.test(pMethod) ) ? pMethod.toUpperCase() : 'POST'; var method = ( typeof pMethod == 'string' && /^POST|GET$/i.test(pMethod) ) ? pMethod.toUpperCase() : 'POST';

59
view/js/input-min.js vendored
View File

@ -1,37 +1,24 @@
var sField=$("#search-field"),sSubmit=$("#search-subject"),sList=$('section[data-sublink="survey"] ul[data-list]'),tmpSubjectSearchListener=function(a){api.send({path:"subject/search",name:sField.value},function(b){if(0!=b.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(b);var a="",f;for(f in b.results)a+="<li data-element data-id='"+f+"'>",a+="<div data-user><span>SUJET</span></div>",a+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+ var sField,sSubmit,sList,pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager,fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
f+"'></span> </div>",a+="<div> <span data-prefix='Nom'>"+b.results[f].name+"</span> </div>",a+="<div> <span data-prefix='Cr\u00e9ation'>"+b.results[f].creation+"</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+f+"' "+(null!=b.results[f].phone?"checked":"")+" disabled><label for='s_"+f+"'>Cellulaire</label>",a+="</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+f+"' "+(null!=b.results[f].facebook?"checked":"")+" disabled><label for='s_"+f+"'>Facebook</label>",a+="</span> </div>", document.body.addEventListener("load",function(){function e(b){var c=b instanceof Element,a=c&&"INPUT"==b.tagName&&"submit"==b.type,d=c&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),c=c&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!a&&!d&&!c&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();
a+="</li>";sList.innerHTML=a})};sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);var pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager; !0===b?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(),(a||c)&&pContactManager.storageToFields())}function f(b){var c=b instanceof Element,a=c&&"INPUT"==b.tagName&&
function pDynamicUpdate(a){var b=a instanceof Element,g=b&&"INPUT"==a.tagName&&"submit"==a.type,f=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(!g&&!f&&!b&&!0!==a)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();!0===a?api.send({path:"subject/getFriends", "submit"==b.type,d=c&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),c=c&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!a&&!d&&!c&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===b?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},function(a){if(0!=
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(),(g||b)&&pContactManager.storageToFields())}var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager; a.ModuleError)return!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),(a||c)&&fContactManager.storageToFields())}sField=$("#search-field");sSubmit=$("#search-subject");sList=$('section[data-sublink="survey"] ul[data-list]');var g=function(b){api.send({path:"subject/search",name:sField.value},
function fDynamicUpdate(a){var b=a instanceof Element,g=b&&"INPUT"==a.tagName&&"submit"==a.type,f=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(!g&&!f&&!b&&!0!==a)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===a?api.send({path:"subject/getFriends", function(b){if(0!=b.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(b);var a="",d;for(d in b.results)a+="<li data-element data-id='"+d+"'>",a+="<div data-user><span>SUJET</span></div>",a+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+d+"'></span> </div>",a+="<div> <span data-prefix='Nom'>"+b.results[d].name+"</span> </div>",a+="<div> <span data-prefix='Cr\u00e9ation'>"+b.results[d].creation+
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(),(g||b)&&fContactManager.storageToFields())} "</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+d+"' "+(null!=b.results[d].phone?"checked":"")+" disabled><label for='s_"+d+"'>Cellulaire</label>",a+="</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+d+"' "+(null!=b.results[d].facebook?"checked":"")+" disabled><label for='s_"+d+"'>Facebook</label>",a+="</span> </div>",a+="</li>";sList.innerHTML=a})};sSubmit.addEventListener("click",g,!1);sField.addEventListener("keypress",function(b){13===b.keyCode&&g(b)},!1);fMatriceManager=
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]')); fFicheManager=fMiniManager=fContactManager=fSubjectManager=pMatriceManager=pFicheManager=pMiniManager=pContactManager=pSubjectManager=null;include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),
pSubjectManager.attach(pDynamicUpdate);pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(pDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(pDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),$('[data-sublink="phone"] #p_nav-fiche')); $('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));pSubjectManager.attach(e);pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(e);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(e);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),
pFicheManager.attach(pDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(pDynamicUpdate);var a=new ShortcutManager,b=!1;a.append("s+n+a+k+e",function(){b||(b=!0,pMatriceManager.snake())});a.listen();$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");lsi.clear("p_friends");pSubjectManager.storageToFields(); $('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(e);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(e);var b=new ShortcutManager,c=!1;b.append("s+n+a+k+e",function(){c||(c=!0,pMatriceManager.snake())});b.listen();$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");lsi.clear("p_friends");
pContactManager.storageToFields();pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"), pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),
matrice:lsi["export"]("p_matrice")[0]};var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change", fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",
function(a){a={path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields(); function(a){a={path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();
pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();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"]("p_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++, pMatriceManager.storageToFields();e(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();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"]("p_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention",
!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"]("p_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"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]}; "La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_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"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);
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)})})})})}); 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)})})})})});include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact.js",function(){include("/js/includes/input-facebook-mini.js",function(){include("/js/includes/input-facebook-fiche.js",function(){include("/js/includes/input-facebook-matrice-min.js",
include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact.js",function(){include("/js/includes/input-facebook-mini.js",function(){include("/js/includes/input-facebook-fiche.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));fSubjectManager.attach(fDynamicUpdate); function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));fSubjectManager.attach(f);fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(f);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini'));
fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(fDynamicUpdate);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini'));fMiniManager.attach(fDynamicUpdate);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));fFicheManager.attach(fDynamicUpdate); fMiniManager.attach(f);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));fFicheManager.attach(f);fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(f);$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(b){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");
fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(fDynamicUpdate);$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");lsi.clear("f_friends");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields(); lsi.clear("f_friends");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),
Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={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]};var b=$('[data-sublink="facebook"] #f_download-target');b.download= mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var c=$('[data-sublink="facebook"] #f_download-target');c.download="local-facebook-data.json";c.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));c.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(b){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",
"local-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(a){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]}; function(b){b.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(b){b={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]};api.send(b,function(b){console.log(b);if(0!=b.ModuleError)return Notification.error("Erreur",b.ModuleError),!1;lsi.set("f_subject",0,b.local_data.subject);lsi["import"]("f_contacts",b.local_data.contacts);lsi["import"]("f_mini-fiches",b.local_data.mini);lsi["import"]("f_fiches",b.local_data.fiches);
api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();fDynamicUpdate(!0)})},!1);$('[data-sublink="facebook"] #f_submit-all').addEventListener("click", lsi.set("f_matrice",0,b.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();f(!0)})},!1);$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",function(b){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),
function(a){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,g;for(g in a)if(!isNaN(g)&&(b++,!a[g].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"), !1;b=lsi["export"]("f_mini-fiches");var c=0,a;for(a in b)if(!isNaN(a)&&(c++,!b[a].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+c+"</b> est incompl\u00e8te et/ou incorrecte"),!1;b=lsi["export"]("f_fiches");for(a in b)if(!b[a].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(a)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),
!1;a=lsi["export"]("f_fiches");for(g in a)if(!a[g].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(g)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;g={path:"input/facebook",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(g,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError), mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})})},!1);
!1;console.log(a)},!1)},!1)})})})})});
function testRoutinePhone(a){var b=lsi["export"]("p_contacts"),g=lsi["export"]("p_mini-fiches"),f=lsi["export"]("p_fiches"),c=0;if(null!=a&&a)for(var e in g)isNaN(e)||(a="",null!=b[e]&&(a=b[e].username),g=$('#p_nav-mini [data-n="'+e+'"]'),g.click(),$("#unknown_min_p_"+e).checked=0==a.length,0==a.length?($("#sexeI_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+e).checked=!0):(a=["H","F"][Math.floor(c%2)],$("#sexe"+a+"_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=1+c%6,a=c%10,9==a?($("#reltype10_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_p_"+e).checked=!0,c++));for(var d in f)isNaN(d)||(g=$('#p_nav-fiche [data-n="'+
d+'"]'),g.click(),a=["H","F","I"][Math.floor(c%3)],$("#sexe"+a+"_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,b="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),b=b[c%b.length],$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="job"]').value=b,b=(c%12).toString(),1==b.length&&(b="0"+b),$('article.fiche-relation > input[data-name="uid"][value="'+
d+'"] ~ h5 select[data-name="studies"]').value=b,a=c%9,8==a?($("#reltype10_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="city"]').value=(10+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
d+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_p_"+d).checked=!0,b=$$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="duration"]'),b[0].value=c.toString(),b[1].value=1+c.toString(),b=c%14,$("article.fiche-relation #contexte"+b+"_p_"+d).checked=!0,f=$$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(f[0].value="internet"),12==b&&(f[1].value="association"),
13==b&&(f[2].value="autre"),c++)}
function testRoutineFacebook(a){var b=lsi["export"]("f_contacts"),g=lsi["export"]("f_mini-fiches"),f=lsi["export"]("f_fiches"),c=0;if(null!=a&&a)for(var e in g)isNaN(e)||(a="",null!=b[e]&&(a=b[e].username),g=$('#f_nav-mini [data-n="'+e+'"]'),g.click(),$("#unknown_min_f_"+e).checked=0==a.length,0==a.length?($("#sexeI_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+e).checked=!0):(a=["H","F"][Math.floor(c%2)],$("#sexe"+a+"_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=1+c%6,a=c%10,9==a?($("#reltype10_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_f_"+e).checked=!0,c++));for(var d in f)isNaN(d)||(g=$('#f_nav-fiche [data-n="'+
d+'"]'),g.click(),a=["H","F","I"][Math.floor(c%3)],$("#sexe"+a+"_f_"+d).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,b="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),b=b[c%b.length],$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="job"]').value=b,b=(c%12).toString(),1==b.length&&
(b="0"+b),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=b,a=c%9,8==a?($("#reltype10_f_"+d).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_f_"+d).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="city"]').value=
(10+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_f_"+d).checked=!0,b=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="duration"]'),
b[0].value=c.toString(),b[1].value=1+c.toString(),b=c%14,$('section[data-sublink="facebook"] article.fiche-relation #contexte'+b+"_f_"+d).checked=!0,f=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(f[0].value="internet"),12==b&&(f[1].value="association"),13==b&&(f[2].value="autre"),c++)};

View File

@ -1,11 +1,16 @@
var sField, sSubmit, sList,
pSubjectManager, pContactManager, pMiniManager, pFicheManager, pMatriceManager,
fSubjectManager, fContactManager, fMiniManager, fFicheManager, fMatriceManager;
document.body.addEventListener('load', function(){
/*=========================================================*/ /*=========================================================*/
/*=========== Gestion de la recherche de sujet ============*/ /*=========== Gestion de la recherche de sujet ============*/
/*=========================================================*/ /*=========================================================*/
var sField = $('#search-field'); sField = $('#search-field');
var sSubmit = $('#search-subject'); sSubmit = $('#search-subject');
var sList = $('section[data-sublink="survey"] ul[data-list]'); sList = $('section[data-sublink="survey"] ul[data-list]');
var tmpSubjectSearchListener = function(e){ var tmpSubjectSearchListener = function(e){
@ -75,11 +80,11 @@
/* [1] Initialisation des utilitaires et variables PHONE /* [1] Initialisation des utilitaires et variables PHONE
=========================================================* =========================================================*
/* (1) Initialisation des managers */ /* (1) Initialisation des managers */
var pSubjectManager; pSubjectManager = null,
var pContactManager; pContactManager = null,
var pMiniManager; pMiniManager = null,
var pFicheManager; pFicheManager = null,
var pMatriceManager; pMatriceManager = null;
/* (2) Fonctions utiles */ /* (2) Fonctions utiles */
@ -156,6 +161,11 @@
} }
} }
fSubjectManager = null,
fContactManager = null,
fMiniManager = null,
fFicheManager = null,
fMatriceManager = null;
@ -163,11 +173,7 @@
/* [2] Initialisation des utilitaires et variables FACEBEOOK /* [2] Initialisation des utilitaires et variables FACEBEOOK
=========================================================* =========================================================*
/* (1) Initialisation des managers */ /* (1) Initialisation des managers */
var fSubjectManager;
var fContactManager;
var fMiniManager;
var fFicheManager;
var fMatriceManager;
/* (2) Fonctions utiles */ /* (2) Fonctions utiles */
@ -931,28 +937,6 @@
/*=========================================================*/ /*=========================================================*/
/*============= Routine de test CELLULAIRE ================*/ /*============= Routine de test CELLULAIRE ================*/
/*=========================================================*/ /*=========================================================*/
@ -1307,3 +1291,7 @@
} }
} }
}, false);