Correction matrice

This commit is contained in:
xdrm-brackets 2016-06-07 11:06:59 +02:00
parent 8bb5bf3089
commit 8513033c04
5 changed files with 12 additions and 5 deletions

View File

@ -44,7 +44,7 @@
"children": [ "children": [
{ "permissions": [], "text": "Export des données", { "permissions": [], "text": "Export des données",
"attributes": { "data-sublink": "export" } }, "attributes": { "data-sublink": "export" } },
{ "permissions": [], "text": "Export des graphiques", { "permissions": [], "text": "Export Gephi",
"attributes": { "data-sublink": "charts" } }, "attributes": { "data-sublink": "charts" } },
{ "permissions": [], "text": "Statistiques", { "permissions": [], "text": "Statistiques",
"attributes": { "data-sublink": "analytics" } } "attributes": { "data-sublink": "analytics" } }

View File

@ -2,4 +2,4 @@ function inputFacebookMatrice(a){this.container=a}inputFacebookMatrice.prototype
inputFacebookMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d)}; inputFacebookMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d)};
inputFacebookMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="<table class='line'>";for(c=0;c<e.length;c++){var g=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">', inputFacebookMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="<table class='line'>";for(c=0;c<e.length;c++){var g=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='f_matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='f_matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"}; a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='f_matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='f_matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)}; inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1)};

View File

@ -167,7 +167,10 @@ inputFacebookMatrice.prototype.attach = function(){
/* (3) On enregistre la matrice à chaque modification */ /* (3) On enregistre la matrice à chaque modification */
var ptr = this; var ptr = this;
this.container.addEventListener('click', function(e){ this.container.addEventListener('click', function(e){
ptr.fieldsToStorage(); ptr.fieldsToStorage();
ptr.storageToFields();
setTimeout(function(){ ptr.storageToFields(); }, 500);
}, false); }, false);
}; };

View File

@ -2,7 +2,8 @@ function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={cont
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.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"),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;">', 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>"):c<f?(a+="<td>",a+="<input type='checkbox' name='matrice_"+e.uid+"_"+h.uid+"' data-name='"+e.uid+"' value='"+h.uid+"' id='p_matrice_"+e.uid+"_"+h.uid+"'",null!=d[f]&&-1<d[f].indexOf(c)&&(a+=" checked"),a+=" >",a+="<label for='p_matrice_"+e.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='p_matrice_"+e.uid+"_"+h.uid+"'",null!=d[f]&&-1<d[f].indexOf(c)&&(a+=" checked"),a+=" >",a+="<label for='p_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)};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.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!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= 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)? 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++; 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++;

View File

@ -167,8 +167,11 @@ inputPhoneMatrice.prototype.attach = function(){
/* (3) On enregistre la matrice à chaque modification */ /* (3) On enregistre la matrice à chaque modification */
var ptr = this; var ptr = this;
this.container.addEventListener('click', function(e){ this.container.addEventListener('click', function(e){
ptr.fieldsToStorage(); ptr.fieldsToStorage();
ptr.storageToFields();
setTimeout(function(){ ptr.storageToFields(); }, 500);
}, false); }, false);
}; };