var listParams=new Object(); listParams.isUserPage=""; listParams.newScen=""; listParams.oldScen=""; listParams.bestScen=""; listParams.noVoteScen=""; listParams.modifiedScen=""; listParams.publicScen=""; listParams.constructionScen=""; listParams.concoursScen=""; listParams.compendium=""; listParams.pageNr=0; listParams.playersNbr=[]; function typeSearch() { fillListScenarios("",0); } function fillListScenarios(deleteScen,pageNr) { listParams.playersNbr=[]; listParams.addons=[]; listParams.maps=[]; listParams.publicScen=0; listParams.constructionScen=0; listParams.concoursScen=0; listParams.compendium=0; listParams.keywords=$("#searchScenarios").val(); listParams.french=0; listParams.english=0; if($("#french").is(":checked")) { listParams.french=1; } if($("#english").is(":checked")) { listParams.english=1; } if($("#publicScen").is(":checked")) { listParams.publicScen=1; } if($("#constructionScen").is(":checked")) { listParams.constructionScen=1; } if($("#concoursScen").is(":checked")) { listParams.concoursScen=1; } if($("#compendium").is(":checked")) { listParams.compendium=1; } $(".playersNbr").each(function(index, el) { if($(this).is(":checked")) { listParams.playersNbr.push($(this).val()); } }); $(".addons").each(function(index, el) { if($(this).is(":checked")) { listParams.addons.push($(this).val()); } }); $(".maps").each(function(index, el) { if($(this).is(":checked")) { listParams.maps.push($(this).val()); } }); listParams.pageNr=pageNr; $("#listScenariosSpinner").show(); $("#listContener").hide(); console.log(listParams); jsonListParams=JSON.stringify(listParams, null, 2); var data={del:deleteScen,page:pageNr,params:jsonListParams,asList:localStorage.getItem('asList')}; var jqxhr = $.post( "inc/_listScenarios.php", data) .done(function(data) { //console.log( data ); if(data.indexOf("ERROR") >= 0) { alert("Error!"); console.log(data); $("#listScenariosSpinner").hide(); $("#listContener").show(); } else { $("#listContener").html(data); $("#listScenariosSpinner").hide(); $("#listContener").show(); if(localStorage.getItem('asList')!==null) { displayAsList(JSON.parse(localStorage.getItem('asList'))); } } }) .fail(function() { console.log( "load error" ); $("#listScenariosSpinner").hide(); $("#listContener").show(); }) .always(function() { console.log( "load finished" ); $("#listScenariosSpinner").hide(); $("#listContener").show(); }); } function modifSearchParameters(paramType,launchSearch) { listParams.newScen=""; listParams.oldScen=""; listParams.bestScen=""; listParams.noVoteScen=""; listParams.modifiedScen=""; if(paramType=='newScen') { listParams.newScen=1; } if(paramType=='oldScen') { listParams.oldScen=1; } if(paramType=='bestScen') { listParams.bestScen=1; } if(paramType=='noVoteScen') { listParams.noVoteScen=1; } if(paramType=='modifiedScen') { listParams.modifiedScen=1; } if(launchSearch) { fillListScenarios("",0); } $("#mySidenav").toggleClass("openedSidenav"); } function switchValue(paramType,launchSearch) { if(val==0) { val=1; } else { val=0; } return val; }