NxTIC/public_html/view/js/min/data.js

5 lines
1.8 KiB
JavaScript

var exportSubjectList=$("#export_subject-list"),exportSubjectAdd=$("#export_add-subject"),exportDeflater=new FormDeflater(document.getElementById("export-form"),["input"],["data-name"]);exportSubjectAdd.addEventListener("click",function(a){a=document.createElement("input");a.type="number";a.dataset.name="subjects";a.placeholder="Sujet";a.style="width: 5em; display: block;";exportSubjectList.appendChild(a)},!1);
$("#export-form #export_export-all").addEventListener("click",function(a){var b=(new FormDeflater(exportSubjectList,["input"],["data-name"])).deflate().subjects;a=[];b instanceof Array||(b=[b]);for(var c=0;c<b.length;c++)0<b[c].length&&!isNaN(b[c])&&a.push(b[c]);b=exportDeflater.deflate();api.send({path:"download/multiple",subjects:a,all:"all"==b.group},function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);
var chartsSubjectList=$("#charts_subject-list"),chartsSubjectAdd=$("#charts_add-subject"),chartsDeflater=new FormDeflater(document.getElementById("charts-form"),["input"],["data-name"]);chartsSubjectAdd.addEventListener("click",function(a){a=document.createElement("input");a.type="number";a.dataset.name="subjects";a.placeholder="Sujet";a.style="width: 5em; display: block;";chartsSubjectList.appendChild(a)},!1);
$("#charts-form #charts_export-all").addEventListener("click",function(a){var b=(new FormDeflater(chartsSubjectList,["input"],["data-name"])).deflate().subjects;a=[];b instanceof Array||(b=[b]);for(var c=0;c<b.length;c++)0<b[c].length&&!isNaN(b[c])&&a.push(b[c]);b=chartsDeflater.deflate();api.send({path:"download/chart",subjects:a,all:"all"==b.group},function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);