Merge branch 'feature/easter-egg-snake' into dev
This commit is contained in:
commit
c1402aed01
|
@ -1,5 +1,10 @@
|
||||||
function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={container:this.container};
|
function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={container:this.container};
|
||||||
inputPhoneMatrice.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("p_matrice",0,d)};
|
inputPhoneMatrice.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 g in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][g]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("p_matrice",0,d)};
|
||||||
inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches"),d=lsi.get("p_matrice",0),b=lsi["export"]("p_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;">',
|
inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches"),d=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),g=[],f;for(f in a)-1==g.indexOf(a[f].contact)&&g.push(a[f].contact);a="<table class='line'>";for(f=0;f<g.length;f++){var e=b[f],a=a+"<tr>";0<f?(a+='<td style="text-align: right;">',a+=e.username,a+="</td>"):a+="<td></td>";for(var c=0;c<g.length;c++)if(c<g.length-1){var h=b[c];0==f?(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='matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
|
a+=h.username,a+="</span>"):c<f?(a+="<td>",a+="<input type='checkbox' name='matrice_"+e.uid+"_"+h.uid+"' data-name='"+e.uid+"' value='"+h.uid+"' id='matrice_"+e.uid+"_"+h.uid+"'",null!=d[f]&&-1<d[f].indexOf(c)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+e.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
|
||||||
inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1);this.snake()};inputPhoneMatrice.prototype.snake=function(){this.sVelocity=[0,0];this.sLength=0;this.sStack=[]};
|
inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};inputPhoneMatrice.prototype.parseGrid=function(){var a=$$(".matrice-panel input[data-name][value]"),d;for(d in a)if(a[d]instanceof Element){var b=a[d].getData("name"),g=a[d].value;this.sGrid[b]instanceof Array||(this.sGrid[b]=[]);this.sGrid[b][g]=a[d]}};
|
||||||
|
inputPhoneMatrice.prototype.snake=function(){this.sVelocity=[0,0];this.sLength=2;this.sStack=[];this.sKeys=[];this.sGrid=[];this.sRoutine=this.sTarget=null;var a=this;this.parseGrid();var d=parseInt(this.sGrid.length/2),b=parseInt(this.sGrid[d].length/2);this.sStack.push(this.sGrid[d][b]);for(var d=!1,g,f;!d;)g=Math.floor(Math.random()*this.sGrid.length),f=Math.floor(Math.random()*this.sGrid[g].length),d=(d=null!=this.sGrid[g]&&null!=this.sGrid[g][f])&&-1==this.sStack.indexOf(this.sGrid[g][f]);this.sTarget=
|
||||||
|
this.sGrid[g][f];document.body.addEventListener("keydown",function(e){-1<[37,38,39,40].indexOf(e.keyCode)&&-1==a.sKeys.indexOf(e.keyCode)&&a.sKeys.push(e.keyCode)},!1);document.body.addEventListener("keyup",function(e){var c=a.sKeys.indexOf(e.keyCode);-1<[37,38,39,40].indexOf(e.keyCode)&&-1<c&&a.sKeys.splice(c)},!1);this.sRoutine=setInterval(function(){-1<a.sKeys.indexOf(37)?a.sVelocity[0]=-1:-1<a.sKeys.indexOf(39)&&(a.sVelocity[0]=1);-1<a.sKeys.indexOf(38)?a.sVelocity[1]=-1:-1<a.sKeys.indexOf(40)?
|
||||||
|
a.sVelocity[1]=1:0!=a.sVelocity[0]&&(a.sVelocity[1]=0);-2==a.sKeys.indexOf(37)+a.sKeys.indexOf(39)&&0!=a.sVelocity[1]&&(a.sVelocity[0]=0);var e=a.sStack[a.sStack.length-1],c=parseInt(e.getData("name")),e=parseInt(e.value),e=(e+a.sVelocity[0])%a.sGrid[c].length;0>e&&(e=a.sGrid[c].length-1);c=(c+a.sVelocity[1])%a.sGrid.length;0>=c&&(c=e+1);if(null==a.sGrid[c]||null==a.sGrid[c][e])c=a.sGrid.length-1;if(null!=a.sGrid[c]&&null!=a.sGrid[c][e]){if(a.sGrid[c][e].checked)if(a.sGrid[c][e].id==a.sTarget.id){a.sLength++;
|
||||||
|
for(var d=!1,b,f;!d;)b=Math.floor(Math.random()*a.sGrid.length),f=Math.floor(Math.random()*a.sGrid[b].length),d=(d=null!=a.sGrid[b]&&null!=a.sGrid[b][f])&&-1==a.sStack.indexOf(a.sGrid[b][f]);a.sTarget=a.sGrid[b][f]}else a.sStack[a.sStack.length-1].id!=a.sGrid[c][e].id&&(console.log(a.sStack[a.sStack.length-1].id,a.sGrid[c][e].id),alert("vous avez perdu! Score: "+(a.sLength-2)),clearInterval(a.sRoutine));a.sStack.push(a.sGrid[c][e])}var c=[],g;for(g in a.sStack)b=a.sStack[g].getData("name"),f=a.sStack[g].value,
|
||||||
|
null==c[b]&&(c[b]=[]),c[b].push(parseInt(f));null!=a.sTarget&&(b=a.sTarget.getData("name"),f=a.sTarget.value,null==c[b]&&(c[b]=[]),c[b].push(parseInt(f)));lsi.set("p_matrice",0,c);a.storageToFields();a.parseGrid();g=a.sStack.length;g>=a.sLength&&(a.sStack=a.sStack.slice(1+g-a.sLength));document.location="#snake"},200)};
|
||||||
|
|
|
@ -83,10 +83,10 @@ inputPhoneMatrice.prototype.storageToFields = function(){
|
||||||
// On récupère les données de la matrice
|
// On récupère les données de la matrice
|
||||||
var matriceData = lsi.get('p_matrice', 0);
|
var matriceData = lsi.get('p_matrice', 0);
|
||||||
|
|
||||||
// On récupère les contacts pour afficher les noms/prénoms
|
// On récupère les contacts pour afficher les noms/prénoms
|
||||||
var contactData = lsi.export('p_contacts');
|
var contactData = lsi.export('p_contacts');
|
||||||
|
|
||||||
// Contiendra les UID des contacts à mettre dans la matrice
|
// Contiendra les UID des contacts à mettre dans la matrice
|
||||||
var contacts = [];
|
var contacts = [];
|
||||||
|
|
||||||
// Pour chaque fiche, on ajoute l'uid du contact s'il n'est pas déja ajouté
|
// Pour chaque fiche, on ajoute l'uid du contact s'il n'est pas déja ajouté
|
||||||
|
@ -170,8 +170,6 @@ inputPhoneMatrice.prototype.attach = function(){
|
||||||
ptr.fieldsToStorage();
|
ptr.fieldsToStorage();
|
||||||
ptr.storageToFields();
|
ptr.storageToFields();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
this.snake();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,14 +180,178 @@ inputPhoneMatrice.prototype.attach = function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inputPhoneMatrice.prototype.parseGrid = function(){
|
||||||
|
/* (1) On récupère la matrice des éléments de la grille */
|
||||||
|
var gridElements = $$('.matrice-panel input[data-name][value]');
|
||||||
|
for( var i in gridElements ){
|
||||||
|
if( !(gridElements[i] instanceof Element) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var col = gridElements[i].getData('name');
|
||||||
|
var row = gridElements[i].value;
|
||||||
|
|
||||||
|
if( !(this.sGrid[col] instanceof Array) )
|
||||||
|
this.sGrid[col] = [];
|
||||||
|
|
||||||
|
this.sGrid[col][row] = gridElements[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
inputPhoneMatrice.prototype.snake = function(){
|
inputPhoneMatrice.prototype.snake = function(){
|
||||||
|
|
||||||
/* [0] On écrit les fonctions principales
|
/* [0] On écrit les fonctions principales
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
/* (1) ATTRIBUTS */
|
||||||
this.sVelocity = [0, 0];
|
this.sVelocity = [0, 0];
|
||||||
this.sLength = 0;
|
this.sLength = 2;
|
||||||
this.sStack = [];
|
this.sStack = [];
|
||||||
|
this.sKeys = [];
|
||||||
|
this.sGrid = [];
|
||||||
|
this.sTarget = null;
|
||||||
|
this.sRoutine = null;
|
||||||
|
var ptr = this;
|
||||||
|
|
||||||
|
/* (2) ON RECUPERE LA MATRICE D'ELEMENTS */
|
||||||
|
this.parseGrid();
|
||||||
|
|
||||||
|
/* (2) On positionne le joueur au milieu */
|
||||||
|
var midcol = parseInt( this.sGrid.length / 2 );
|
||||||
|
var midrow = parseInt( this.sGrid[midcol].length / 2 );
|
||||||
|
this.sStack.push( this.sGrid[midcol][midrow] );
|
||||||
|
|
||||||
|
/* (3) On positionne la cible */
|
||||||
|
var tool = { correct: false }
|
||||||
|
while( !tool.correct ){
|
||||||
|
tool.col = Math.floor( Math.random()*this.sGrid.length );
|
||||||
|
tool.row = Math.floor( Math.random()*this.sGrid[tool.col].length );
|
||||||
|
tool.correct = this.sGrid[tool.col] != null && this.sGrid[tool.col][tool.row] != null;
|
||||||
|
tool.correct = tool.correct && this.sStack.indexOf(this.sGrid[tool.col][tool.row]) == -1;
|
||||||
|
}
|
||||||
|
this.sTarget = this.sGrid[tool.col][tool.row];
|
||||||
|
|
||||||
|
/* [1] Gestion des handlers
|
||||||
|
=========================================================*/
|
||||||
|
/* (1) Pression sur touche */
|
||||||
|
document.body.addEventListener('keydown', function(e){
|
||||||
|
// Si une fleche, on l'enregistre si elle ne l'est pas déja
|
||||||
|
if( [37, 38, 39, 40].indexOf(e.keyCode) > -1 && ptr.sKeys.indexOf(e.keyCode) == -1 )
|
||||||
|
ptr.sKeys.push(e.keyCode);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
/* (2) Relachement touche */
|
||||||
|
document.body.addEventListener('keyup', function(e){
|
||||||
|
var index = ptr.sKeys.indexOf(e.keyCode);
|
||||||
|
// Si une fleche, on la retire si elle ne l'est pas déja
|
||||||
|
if( [37, 38, 39, 40].indexOf(e.keyCode) > -1 && index > -1 )
|
||||||
|
ptr.sKeys.splice(index);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
/* [2] Lancement de la boucle de jeu
|
||||||
|
=========================================================*/
|
||||||
|
this.sRoutine = setInterval(function(){
|
||||||
|
/* (1) Gestion de la vélocité en fonction des touches */
|
||||||
|
if( ptr.sKeys.indexOf(37) > -1 ) // Vers la gauche
|
||||||
|
ptr.sVelocity[0] = -1;
|
||||||
|
else if( ptr.sKeys.indexOf(39) > -1 ) // Vers la droite
|
||||||
|
ptr.sVelocity[0] = 1;
|
||||||
|
|
||||||
|
if( ptr.sKeys.indexOf(38) > -1 ) // Vers le haut
|
||||||
|
ptr.sVelocity[1] = -1;
|
||||||
|
else if( ptr.sKeys.indexOf(40) > -1 ) // Vers le bas
|
||||||
|
ptr.sVelocity[1] = 1;
|
||||||
|
else if( ptr.sVelocity[0] != 0 )
|
||||||
|
ptr.sVelocity[1] = 0;
|
||||||
|
|
||||||
|
if( ptr.sKeys.indexOf(37)+ptr.sKeys.indexOf(39) == -2 && ptr.sVelocity[1] != 0 )
|
||||||
|
ptr.sVelocity[0] = 0;
|
||||||
|
|
||||||
|
// Dernier element de la pile
|
||||||
|
var lastStack = ptr.sStack[ ptr.sStack.length-1 ];
|
||||||
|
var lastcol = parseInt( lastStack.getData('name') );
|
||||||
|
var lastrow = parseInt( lastStack.value );
|
||||||
|
|
||||||
|
/* (2) Gestion du mouvement */
|
||||||
|
lastrow = (lastrow + ptr.sVelocity[0]) % ptr.sGrid[lastcol].length;
|
||||||
|
if( lastrow < 0 ) lastrow = ptr.sGrid[lastcol].length - 1;
|
||||||
|
|
||||||
|
lastcol = (lastcol + ptr.sVelocity[1]) % ptr.sGrid.length;
|
||||||
|
if( lastcol <= 0 ) lastcol = lastrow+1;
|
||||||
|
if( ptr.sGrid[lastcol] == null || ptr.sGrid[lastcol][lastrow] == null )
|
||||||
|
lastcol = ptr.sGrid.length-1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if( ptr.sGrid[lastcol] != null && ptr.sGrid[lastcol][lastrow] != null ){
|
||||||
|
|
||||||
|
/* (1) Si la case est déja prisse */
|
||||||
|
if( ptr.sGrid[lastcol][lastrow].checked ){
|
||||||
|
/* (2) Si on c'est la cible */
|
||||||
|
if( ptr.sGrid[lastcol][lastrow].id == ptr.sTarget.id ){
|
||||||
|
ptr.sLength++;
|
||||||
|
|
||||||
|
// On repositionne la cible
|
||||||
|
var tool = { correct: false }
|
||||||
|
while( !tool.correct ){
|
||||||
|
tool.col = Math.floor( Math.random()*ptr.sGrid.length );
|
||||||
|
tool.row = Math.floor( Math.random()*ptr.sGrid[tool.col].length );
|
||||||
|
tool.correct = ptr.sGrid[tool.col] != null && ptr.sGrid[tool.col][tool.row] != null;
|
||||||
|
tool.correct = tool.correct && ptr.sStack.indexOf(ptr.sGrid[tool.col][tool.row]) == -1;
|
||||||
|
}
|
||||||
|
ptr.sTarget = ptr.sGrid[tool.col][tool.row];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (3) Si on se mord la queue (mais pas la tete)*/
|
||||||
|
else if( ptr.sStack[ptr.sStack.length-1].id != ptr.sGrid[lastcol][lastrow].id ){
|
||||||
|
console.log(ptr.sStack[ptr.sStack.length-1].id, ptr.sGrid[lastcol][lastrow].id );
|
||||||
|
alert('vous avez perdu! Score: '+(ptr.sLength-2) );
|
||||||
|
clearInterval(ptr.sRoutine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ptr.sStack.push( ptr.sGrid[lastcol][lastrow] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (3) On affiche que les cases de la pile */
|
||||||
|
var matrix = [];
|
||||||
|
for( var i in ptr.sStack ){
|
||||||
|
var col = ptr.sStack[i].getData('name');
|
||||||
|
var row = ptr.sStack[i].value;
|
||||||
|
|
||||||
|
if( matrix[col] == null )
|
||||||
|
matrix[col] = [];
|
||||||
|
|
||||||
|
matrix[col].push( parseInt(row) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (4) On ajoute la cible */
|
||||||
|
if( ptr.sTarget != null ){
|
||||||
|
var col = ptr.sTarget.getData('name');
|
||||||
|
var row = ptr.sTarget.value;
|
||||||
|
|
||||||
|
if( matrix[col] == null )
|
||||||
|
matrix[col] = [];
|
||||||
|
|
||||||
|
matrix[col].push( parseInt(row) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (5) Enregistrement du modèle */
|
||||||
|
lsi.set('p_matrice', 0, matrix);
|
||||||
|
ptr.storageToFields();
|
||||||
|
ptr.parseGrid();
|
||||||
|
|
||||||
|
|
||||||
|
/* (6) On vide les cases dépassant sLength */
|
||||||
|
var len = ptr.sStack.length;
|
||||||
|
|
||||||
|
if( len >= ptr.sLength )
|
||||||
|
ptr.sStack = ptr.sStack.slice( 1+len-ptr.sLength );
|
||||||
|
|
||||||
|
document.location ='#snake';
|
||||||
|
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
function strToKeyCode(a){var b=a.toUpperCase().charCodeAt(0);if(1==a.length&&(65<=b&&90>=b||49<=b&&57>=b))return b;switch(a){case "ctrl":return 17;case "maj":return 16;case "alt":return 18;case "tab":return 9;case "left":return 37;case "up":return 38;case "right":return 39;case "down":return 40}return null}function ShortcutManager(){}
|
||||||
|
ShortcutManager.prototype={pressed:[],shortcuts:[],handlers:[],lastKeyCode:[],append:function(a,b){for(var c=a.toLowerCase().split("+"),d=0;d<c.length;d++)if(c[d]=strToKeyCode(c[d]),null==c[d])return null;c=this.shortcuts.push(c)-1;this.handlers[c]=b;this.lastKeyCode[c]=null},listen:function(){var a=this;window.addEventListener("keydown",function(b){0>a.pressed.indexOf(b.keyCode)&&a.pressed.push(b.keyCode);for(var c=0;c<a.shortcuts.length;c++){for(var d=a.shortcuts[c].length,e=0;e<a.pressed.length;e++)-1<
|
||||||
|
a.shortcuts[c].indexOf(a.pressed[e])&&--d;if(0==d)a.handlers[c](b)}},!1);window.addEventListener("keyup",function(b){b=a.pressed.indexOf(b.keyCode);a.pressed=-1<b?a.pressed.slice(0,b).concat(a.pressed.slice(b+1)):[]},!1)}};
|
|
@ -0,0 +1,119 @@
|
||||||
|
/**************/
|
||||||
|
/* PRÉ-REQUIS */
|
||||||
|
/**************/
|
||||||
|
/* Retourne le keyCode correspondant à la chaîne donnée
|
||||||
|
*
|
||||||
|
* @param str enchaînement de touches sous forme de string
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* return keyCode le code de la touche correspondante
|
||||||
|
|
||||||
|
*/
|
||||||
|
function strToKeyCode(keyString){
|
||||||
|
// on enregistre le keyCode du premier caractère
|
||||||
|
var keyCode = keyString.toUpperCase().charCodeAt(0);
|
||||||
|
|
||||||
|
// s'il s'agit d'un caractère uniquement (entre "a" et "z" ou entre "0" et "9")
|
||||||
|
if( keyString.length == 1 && ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 49 && keyCode <= 57)) )
|
||||||
|
return keyCode; // on retourne le keyCode associé
|
||||||
|
else
|
||||||
|
switch( keyString ){ // sinon, on récupère l'ascii spécifiquement
|
||||||
|
case 'ctrl': return 17; break;
|
||||||
|
case 'maj': return 16; break;
|
||||||
|
case 'alt': return 18; break;
|
||||||
|
case 'tab': return 9; break;
|
||||||
|
case 'left': return 37; break;
|
||||||
|
case 'up': return 38; break;
|
||||||
|
case 'right': return 39; break;
|
||||||
|
case 'down': return 40; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********/
|
||||||
|
/* CLASSE */
|
||||||
|
/**********/
|
||||||
|
function ShortcutManager(){};
|
||||||
|
|
||||||
|
ShortcutManager.prototype = {
|
||||||
|
pressed: [], // contiendra les touches pressées (en cours)
|
||||||
|
shortcuts: [], // contiendra tous les raccourcis
|
||||||
|
// progress: [], // contiendra l'avancée des raccourcis
|
||||||
|
handlers: [], // contiendra tous les handlers (fonctions à éxécuter)
|
||||||
|
/* tmp */
|
||||||
|
lastKeyCode: [], // contiendra des "reminder" pour les évènements
|
||||||
|
|
||||||
|
/* ajout d'un nouveau raccourcis clavier */
|
||||||
|
append: function(keyRow, handler){
|
||||||
|
/* [1] On découpe la chaîne (en minuscule) par "+"
|
||||||
|
=======================================================*/
|
||||||
|
var keyStore = keyRow.toLowerCase().split('+');
|
||||||
|
|
||||||
|
/* [2] On récupère les keyCodes correspondant aux codes/lettres
|
||||||
|
=======================================================*/
|
||||||
|
for( var i = 0 ; i < keyStore.length ; i++ ){
|
||||||
|
keyStore[i] = strToKeyCode( keyStore[i] );
|
||||||
|
|
||||||
|
// si on a une erreur, on retourne NULL
|
||||||
|
if( keyStore[i] == null ) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [3] On enregistre dans l'objet (shortcuts, progress, handler)
|
||||||
|
=======================================================*/
|
||||||
|
var index = this.shortcuts.push( keyStore ) - 1;
|
||||||
|
// this.progress[index] = 0; // le progrès est l'index d'avancement
|
||||||
|
this.handlers[index] = handler; // handler (function qui s'éxécutera lors de l'activation)
|
||||||
|
this.lastKeyCode[index] = null; //
|
||||||
|
},
|
||||||
|
|
||||||
|
/* démarre l'écoute (active les évènements) */
|
||||||
|
listen: function(){
|
||||||
|
|
||||||
|
/* [1] On créé l'évènement d'appui de touche pour chaque élément
|
||||||
|
=======================================================*/
|
||||||
|
var pointer = this;
|
||||||
|
|
||||||
|
// on initialise/créer l'évènement
|
||||||
|
window.addEventListener('keydown', function(e){
|
||||||
|
|
||||||
|
// on ajoute la touche si elle n'y est pas
|
||||||
|
if( pointer.pressed.indexOf(e.keyCode) < 0 ) pointer.pressed.push(e.keyCode);
|
||||||
|
|
||||||
|
for( var i = 0 ; i < pointer.shortcuts.length ; i++ ){
|
||||||
|
|
||||||
|
var complete = pointer.shortcuts[i].length; // taille du shortcut en question
|
||||||
|
// on vérifie que l'ensemble des touches pressées remplissent le shortcut
|
||||||
|
for( var k = 0 ; k < pointer.pressed.length ; k++ )
|
||||||
|
if( pointer.shortcuts[i].indexOf( pointer.pressed[k] ) > -1 ) // si la touche est dans le shortcut, on décrémente compteur (complete)
|
||||||
|
complete -= 1;
|
||||||
|
|
||||||
|
|
||||||
|
// si le compteur est à 0, on a terminé la combinaison de touches, on remet le compteur à 0 + on exécute le handler
|
||||||
|
if( complete == 0 )
|
||||||
|
pointer.handlers[i](e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// si on lâche une touche, on l'enlève de "pressed"
|
||||||
|
window.addEventListener('keyup', function(e){
|
||||||
|
var index = pointer.pressed.indexOf(e.keyCode);
|
||||||
|
|
||||||
|
if( index > -1 ) // si c'est une touche définie comme déjà appuyée, on l'enlève
|
||||||
|
pointer.pressed = pointer.pressed.slice(0,index).concat( pointer.pressed.slice(index+1) );
|
||||||
|
else // sinon on supprime tout (car sûrement erreur d'écoute)
|
||||||
|
pointer.pressed = [];
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
};
|
5
view.php
5
view.php
|
@ -35,10 +35,11 @@
|
||||||
<script type='text/javascript' src='/f/js/api-min/js/lib' ></script> <!-- Gestion des transactions avec le serveur -->
|
<script type='text/javascript' src='/f/js/api-min/js/lib' ></script> <!-- Gestion des transactions avec le serveur -->
|
||||||
<script type='text/javascript' src='/f/js/page-manager-min/js/lib' ></script> <!-- Gestion réseau/chargement/liens/URL -->
|
<script type='text/javascript' src='/f/js/page-manager-min/js/lib' ></script> <!-- Gestion réseau/chargement/liens/URL -->
|
||||||
<script type='text/javascript' src='/f/js/notif-min/js/lib' ></script> <!-- Gestion des notifications -->
|
<script type='text/javascript' src='/f/js/notif-min/js/lib' ></script> <!-- Gestion des notifications -->
|
||||||
|
<script type='text/javascript' src='/f/js/shortcut-manager/js/lib' ></script> <!-- Gestion des raccourcis clavier -->
|
||||||
|
|
||||||
<!-- Dépendences Spéficiques pré-chargeables -->
|
<!-- Dépendences Spéficiques pré-chargeables -->
|
||||||
<script type='text/javascript' src='/f/js/input-html-phone-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition -->
|
<script type='text/javascript' src='/f/js/input-html-phone-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition 'phone' -->
|
||||||
<script type='text/javascript' src='/f/js/input-html-facebook-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition -->
|
<script type='text/javascript' src='/f/js/input-html-facebook-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition 'facebook' -->
|
||||||
|
|
||||||
<!-- Librairies Externes Javascript -->
|
<!-- Librairies Externes Javascript -->
|
||||||
<script type='text/javascript' src='/f/js/_charts-min/js/lib' ></script> <!-- Librairie pour les graphiques -->
|
<script type='text/javascript' src='/f/js/_charts-min/js/lib' ></script> <!-- Librairie pour les graphiques -->
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<!-- MATRICE RELATIONNELLE DES 2 TOP 10 -->
|
<!-- MATRICE RELATIONNELLE DES 2 TOP 10 -->
|
||||||
<h3 data-n='5' class='color4'>Saisir les matrices des relations entre les contacts les plus contactés</h3>
|
<h3 data-n='5' class='color4'>Saisir les matrices des relations entre les contacts les plus contactés</h3>
|
||||||
<!-- NAVIGATION ENTRE LES FICHES -->
|
<!-- NAVIGATION ENTRE LES FICHES -->
|
||||||
<article class='matrice-panel'></article>
|
<article class='matrice-panel' id='snake'></article>
|
||||||
|
|
||||||
|
|
||||||
<!-- BOUTON D'ENVOI DU FORMULAIRE -->
|
<!-- BOUTON D'ENVOI DU FORMULAIRE -->
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
var cSubjectManager,cContactManager,cMiniManager,cFicheManager,cMatriceManager;
|
var cSubjectManager,cContactManager,cMiniManager,cFicheManager,cMatriceManager;
|
||||||
function cDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,e=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&&!e&&!b&&!0!==a)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();pMiniManager.storageToFields();
|
function cDynamicUpdate(b){var a=b instanceof Element,d=a&&"INPUT"==b.tagName&&"submit"==b.type,e=a&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!d&&!e&&!a&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();pMiniManager.storageToFields();
|
||||||
pFicheManager.storageToFields();pMatriceManager.storageToFields();(c||b)&&pContactManager.storageToFields()}
|
pFicheManager.storageToFields();pMatriceManager.storageToFields();(d||a)&&pContactManager.storageToFields()}
|
||||||
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact-min.js",function(){include("/js/includes/input-phone-mini-min.js",function(){include("/js/includes/input-phone-fiche-min.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="number"]'),$('[data-sublink="phone"] article.subject-panel [data-name="username"]'),
|
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact-min.js",function(){include("/js/includes/input-phone-mini-min.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="number"]'),$('[data-sublink="phone"] article.subject-panel [data-name="username"]'),
|
||||||
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));pSubjectManager.attach();pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(cDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(cDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),
|
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));pSubjectManager.attach();pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(cDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(cDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),
|
||||||
$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(cDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(cDynamicUpdate);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$('[data-sublink="phone"] #p_subject_phone_number').value,
|
$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(cDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(cDynamicUpdate);var b=new ShortcutManager;b.append("s+n+a+k+e",function(){pMatriceManager.snake()});b.listen();$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",
|
||||||
file:a.target.files[0]};api.send(a,function(b){console.log(b);var a=null;if(0!=b.ModuleError)9==b.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",b.ModuleError);else{a=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=b.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var e=0;e<b.call.length;e++){var d=b.directory[b.call[e]];
|
function(a){a={path:"upload/call_log",phone_number:$('[data-sublink="phone"] #p_subject_phone_number').value,file:a.target.files[0]};api.send(a,function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();
|
||||||
lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:e,sms:-1})}for(e=0;e<b.sms.length;e++)if(d=b.directory[b.sms[e]],-1<b.call.indexOf(b.sms[e])){var g=lsi.get("p_contacts",d.id);g.sms=e;lsi.set("p_contacts",d.id,g)}else lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:e});for(var f in b.directory)f=parseInt(f),-1<b.call.indexOf(f)||-1<b.sms.indexOf(f)||(d=b.directory[f],lsi.set("p_contacts",
|
pSubjectManager.storageToFields();for(var f=0;f<a.call.length;f++){var c=a.directory[a.call[f]];lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:f,sms:-1})}for(f=0;f<a.sms.length;f++)if(c=a.directory[a.sms[f]],-1<a.call.indexOf(a.sms[f])){var h=lsi.get("p_contacts",c.id);h.sms=f;lsi.set("p_contacts",c.id,h)}else lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:f});for(var g in a.directory)g=
|
||||||
d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:-1}));pContactManager.storageToFields();cDynamicUpdate(!0);null!=a&&a.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[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");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();
|
parseInt(g),-1<a.call.indexOf(g)||-1<a.sms.indexOf(g)||(c=a.directory[g],lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:-1}));pContactManager.storageToFields();cDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[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");
|
||||||
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"),matrice:lsi["export"]("p_matrice")[0]};
|
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"),
|
||||||
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=
|
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",
|
||||||
{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();
|
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();
|
||||||
cDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();cFicheManager.fieldsToStorage();if(!cSubjectManager.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",
|
pMatriceManager.storageToFields();cDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();cFicheManager.fieldsToStorage();if(!cSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,e;for(e in a)if(!isNaN(e)&&(b++,
|
||||||
"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);
|
!a[e].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(e in a)if(!a[e].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(e)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;e={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]};
|
||||||
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)})})})})});var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
api.send(e,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)})})})})});var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
||||||
function fDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,e=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&&!e&&!b&&!0!==a)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
function fDynamicUpdate(b){var a=b instanceof Element,d=a&&"INPUT"==b.tagName&&"submit"==b.type,e=a&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!d&&!e&&!a&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
||||||
fFicheManager.storageToFields();fMatriceManager.storageToFields();(c||b)&&fContactManager.storageToFields()}
|
fFicheManager.storageToFields();fMatriceManager.storageToFields();(d||a)&&fContactManager.storageToFields()}
|
||||||
include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact-min.js",function(){include("/js/includes/input-facebook-mini-min.js",function(){include("/js/includes/input-facebook-fiche-min.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="username"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));
|
include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact-min.js",function(){include("/js/includes/input-facebook-mini-min.js",function(){include("/js/includes/input-facebook-fiche-min.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="username"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));
|
||||||
fSubjectManager.attach();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'));
|
fSubjectManager.attach();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);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");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();
|
fFicheManager.attach(fDynamicUpdate);fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(fDynamicUpdate);$('[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");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(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');
|
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"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var a=$('[data-sublink="facebook"] #f_download-target');
|
||||||
b.download="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]};
|
a.download="local-facebook-data.json";a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.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",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(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",
|
api.send(b,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",
|
||||||
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,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"),
|
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>"),!1;b=lsi["export"]("f_mini-fiches");var a=0,d;for(d in b)if(!isNaN(d)&&(a++,!b[d].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+a+"</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/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(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
|
!1;b=lsi["export"]("f_fiches");for(d in b)if(!b[d].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(d)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;d={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(d,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
|
||||||
!1;console.log(a)},!1)},!1)})})})})});
|
!1;console.log(a)},!1)},!1)})})})})});
|
||||||
|
|
|
@ -78,7 +78,8 @@ include('/js/includes/input-phone-subject-min.js', function(){
|
||||||
include('/js/includes/input-phone-contact-min.js', function(){
|
include('/js/includes/input-phone-contact-min.js', function(){
|
||||||
include('/js/includes/input-phone-mini-min.js', function(){
|
include('/js/includes/input-phone-mini-min.js', function(){
|
||||||
include('/js/includes/input-phone-fiche-min.js', function(){
|
include('/js/includes/input-phone-fiche-min.js', function(){
|
||||||
include('/js/includes/input-phone-matrice-min.js', function(){
|
// TODO: Use 'min' version
|
||||||
|
include('/js/includes/input-phone-matrice.js', function(){
|
||||||
|
|
||||||
|
|
||||||
/* (1) Gestion du formulaire du sujet
|
/* (1) Gestion du formulaire du sujet
|
||||||
|
@ -146,6 +147,12 @@ include('/js/includes/input-phone-matrice-min.js', function(){
|
||||||
pMatriceManager.attach(cDynamicUpdate);
|
pMatriceManager.attach(cDynamicUpdate);
|
||||||
|
|
||||||
|
|
||||||
|
// Listener pour snake
|
||||||
|
var smgr = new ShortcutManager();
|
||||||
|
smgr.append('s+n+a+k+e', function(){ pMatriceManager.snake(); });
|
||||||
|
smgr.listen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue