// JavaScript Document var scrollPosition={}; var isalreadyflyto=false; var urlcore="https://www.netsportique.es/core"; var urlsite="https://www.netsportique.es"; var urltemplate="https://www.netsportique.es/template/modele1"; var rootbase="/application"; var rootcore="/application/core"; var roottemplate="/application/template/modele1"; var userID=unescape(readCookie('userID')); var userSerial=unescape(readCookie('userSerial')); var currentNiceeditor=false; var tamponOutput={}; var currentPanier={}; var rootconfig="/application"; var firstpage="accueil"; var firstpageurl="https://www.netsportique.es"; var currentPage=1; var currentPageInfo=""; var entrance=true; var domaine="https://"+window.location.host; var currentHistory=""; var UserPanel=false; var livehtmlEditor=false; var nombrezoneschargees=0; var totalzoneschargees=0; var moduleEdition=false; var numbersavings=0; var donnees = {"post":[]}; var numbersavingstotal=0; var gotoafterload=false; var backaction=false; var currentimageselector=false; function initialiserliens(conteneur){ var targets=$(conteneur+" a").not("a.livehtml").not("a.recordhtml").not("a.recordall").not("a.recordallok").not("a.nogo").not("a.externe").not('a.lightbox').not('a.popuphtml').not('a.gallery').not('a.lightboxhtml').not('a.lightboxhtmlfull').not('a.lightboxnewsletter').not('a.lightboxinline').not('a.integrer').not('a.cke_off'); targets.unbind('click.saezam'); targets.bind('click.saezam',function() { if(entrance==true){entrance=false;} var urlcomplete=this.href; var pagesget=this.href.split('/'); //URL VIDE if($(this).attr("href")=="" || $(this).attr("href")=="#"){return false;} //URL VERS LES FICHIERS if($(this).attr("href").substring($(this).attr("href").length-4,$(this).attr("href").length-3)=="." && $(this).attr("href")!=urlsite){ $(this).attr("target","_blank"); //URL VERS UNE PAGE DU SITE }else if($(this).attr("href").substring(0,domaine.length)==domaine || $(this).attr("href")==urlsite){ //CIBLER UN ELEMENT APRES CHARGEMENT gotoafterload=false; if(typeof($(this).attr("data-gotoafterload"))!='undefined' && $(this).attr("data-gotoafterload")!=""){ gotoafterload=$(this).attr("data-gotoafterload"); } if(typeof($(this).attr("href"))!="undefined" && $(this).attr("href").indexOf("#")!=-1){ gotoafterload=$(this).attr("href").substr($(this).attr("href").indexOf("#")+1,$(this).attr("href").length-1); } if(window.location.href.indexOf("#")!=-1){ var currentlocation=window.location.href.substr(0,window.location.href.indexOf("#")); }else{ var currentlocation=window.location.href; } titlestring=$(this).attr("title"); //SI Exactement même url sans hash on recharge if(typeof($(this).attr("href"))!="undefined" && $(this).attr("href").indexOf("#")==-1 && $(this).attr("href")==currentlocation){ reloadPage(); flyto("#front"); return false; //Si même url mais hash présent on fly }else if(typeof($(this).attr("href"))!="undefined" && $(this).attr("href").indexOf("#")!=-1 && currentlocation.length==$(this).attr("href").substring(0,$(this).attr("href").indexOf("#")).length){ flyto("#"+gotoafterload); window.history.pushState("", titlestring, urlcomplete); return false; //SI AUTRE PAGE }else{ addHistory("",titlestring,urlcomplete); return false; } //URL EXTERNE }else{ $(this).attr("target","_blank"); } }) $(conteneur+" a.nogo").click(function() { return false; }) $(conteneur+" img").on('load', function() { $(this).css({"opacity":1}); }) $(conteneur+" a.musiclink").click(function() { $("#jquery_jplayer_1").jPlayer("setMedia", { mp3:$(this).attr("href") }).jPlayer("play"); }) $(conteneur+" a.externe").attr("target","_blank"); $(conteneur+" a.deconnexion").click(function() { deconnexion(); return false; }) $(conteneur+" a.rotation").click(function() { return false; }) $(conteneur+" a.livehtml").click(function() { var cibleinfo=$(this).attr("id").split('_'); var cibles=$(this).attr("id").split('_'); cibles.splice(0,2); cibles.splice(-2,2); cibles=cibles.join("_"); cibles=cibles.split('-'); for(var i=0;i"); //$("#"+cible).find("img.saezam").parent().append('
Modifier
'); $(this).css("display","none"); $("#"+cibleinfo[0]+"_"+cibleinfo[1]+"_"+cibleinfo[2]+"_"+cibleinfo[3]+"_recordok").css("display","inline"); return false; }) $(conteneur+" a.cancelbouton").click(function() { if(!confirm("Vous êtes en train de faire des modifications sur la page. Êtes-vous sûr(e) de vouloir continuer ?")){return false;} cancelrecord(); reloadPage(); return false; }) $(conteneur+" a.supprimer").click(function() { return false; }) $(conteneur+" a.lightbox").fancybox({ openEffect : 'elastic', closeEffect : 'elastic', titleShow : false, helpers : { title : { type : 'inside' } } }); //$(conteneur+" a.lightbox").bind("click.fancybox",function() { // $.fancybox({ // href : $(this).attr("href"), // openEffect : 'elastic', // closeEffect : 'elastic', // // helpers : { // title : { // type : 'inside' // } // } // }); // return false; //}); $(conteneur+" a.lightboxinline").fancybox({ 'hideOnContentClick': true, 'touch' : false, 'afterLoad' : function(){ var fonction=$(this).attr("href")+"oncomplete"; fonction=fonction.substr(1,fonction.length); if(typeof(window['fonction']) == "function"){ window['fonction'](); } } }); //$(conteneur+" a.lightboxhtml").click(function() { // if($(this).parents("div[contenteditable='true']").length>0){return false;} // $(this).gglightbox("page"); // return false; // }) $(conteneur+" a.lightboxhtml").click(function() { var maxWidth='1250px'; var maxHeight=""; if(typeof($(this).attr("data-width"))!="undefined"){ maxWidth=$(this).attr("data-width"); } if(typeof($(this).attr("data-height"))!="undefined"){ maxHeight=$(this).attr("data-height"); } if($(this).attr("href").indexOf('core/form/connect.php')!=-1){ maxWidth="390px"; maxHeight="520px"; } $.fancybox.open({ src: $(this).attr("href"), 'touch' : false, 'type': 'iframe', 'autoDimensions' : true, 'iframe' : { 'css' : { 'width' : maxWidth, 'height' : maxHeight, } } }); return false; }) $(conteneur+" a.lightboxhtmlfull").click(function() { var maxWidth=''; var maxHeight=""; if(typeof($(this).attr("data-width"))!="undefined"){ maxWidth=$(this).attr("data-width"); } if(typeof($(this).attr("data-height"))!="undefined"){ maxHeight=$(this).attr("data-height"); } $.fancybox.open({ src: $(this).attr("href"), 'touch' : false, 'type': 'iframe', 'autoDimensions' : true, 'iframe' : { 'css' : { 'width' : maxWidth, 'height' : maxHeight, } } }); return false; }) $(conteneur+" a.popuphtml").click(function() { if($(this).parents("div[contenteditable='true']").length>0){return false;} window.open($(this).attr("href"),'_blank','width=350,height=600,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0'); return false; }) //$("a.lightbox").click(function(){return false;}) //$(conteneur+" a.lightbox").colorbox({ // maxWidth:"95%", // maxHeight:"95%", // scalePhotos:true, // fixed:true, // initialWidth:50, // initialHeight:50, // onOpen:function() { // //$('body').append('
'); // }, // onClosed:function() { // //$('body').remove('
'); // } // }); // // $(conteneur+" a.lightboxhtml").colorbox({ // fastIframe:false, // iframe:true, // minWidth:200, // maxWidth:800, // width:"100%", // speed:200, // height:"80%", // initialWidth:50, // initialHeight:50, // fixed:true, // onOpen:function() { // $('body').append('
'); // }, // onClosed:function() { // $('#info-overlay').remove(); // } // }); // // $(conteneur+" a.lightboxhtml").colorbox({ // fastIframe:false, // iframe:true, // width:"100%", // height:"80%", // minWidth:200, // maxWidth:400, // maxHeight:300, // speed:200, // initialWidth:50, // initialHeight:50, // fixed:true, // onOpen:function() { // $('body').append('
'); // // }, // onClosed:function() { // $('#info-overlay').remove(); // } // }); // $(conteneur+" a.lightboxnewsletter").colorbox({ // fastIframe:false, // iframe:true, // minWidth:200, // maxWidth:400, // width:"100%", // height:500, // initialWidth:50, // initialHeight:50, // fixed:true, // onOpen:function() { // //$('body').append('
'); // }, // onClosed:function() { // //$('body').remove('
'); // } // }); } function clearInfo(){ $("#oks").html(""); $("#errors").html(""); } function appearInfo(time){ if (time==undefined){time=2000;} if($("#oks").html()!=""){$("#oks").slideDown(200);}else{$("#oks").css("display","none");} if($("#errors").html()!=""){$("#errors").slideDown(200);}else{$("#errors").css("display","none");} setTimeout("disappearInfo()", time); } function disappearInfo(){ $("#oks").slideUp(200); $("#errors").slideUp(200); } function scrollToPos(id){ $('html,body').animate({ scrollTop: $(id).offset().top-100 }, 500); return false; } function initialiserform(){ $("form").not("form.independant").submit(function(){ if($(this).hasClass("notvalid")){return false;} var submits=$("input[type='submit']",this); submits.attr('disabled','disabled'); var formulaire=$(this); var datastring=prepareform(formulaire); //alert(datastring); $("#chargement span").html("Envoi du formulaire"); $("body").trigger("PageChangeBegin",window.location); $.ajax({ type: "POST",url: "https://www.netsportique.es/core/form/validation.php", data: datastring, dataType: "json", success: function(msg){ submits.removeAttr('disabled'); //alert(msg); clearInfo(); if(msg.logs != ""){ throw new Error("Erreurs de ChuckValidation dans editvalidation.php : "+msg.logs); } var i=0; //erreurs var errors=""; $("#errors").html(errors); //oks var oks=""; $("#oks").html(oks); appearInfo(); //$(this).css("display","none"); if(errors==""){ if(formulaire.hasClass('gotoconnectform')){loadPage(urlsite+"/interface","Connexion",null);} if(formulaire.hasClass('notifs')){sendNotifications();} if(formulaire.hasClass('reload')){reloadPage();} else if(!formulaire.hasClass('noback')){history.back();} scrollToPos("#header"); } $("body").trigger("PageChangeComplete",window.location.href); } }); return false; }); } function prepareform(formulaire){ var fields = $(":input",formulaire).serializeArray(); //console.log(fields); var results={}; jQuery.each(fields, function(i, field){ var namefield=field.name; var valuefield=field.value; if(namefield.search("unset_")==-1){ if(typeof(results[namefield])!="undefined" && results[namefield]!=undefined){ results[namefield] += ","+encodeURIComponent(valuefield); }else{ results[namefield] = encodeURIComponent(valuefield); } } }); $('textarea', formulaire).each(function() { namefield=$(this).attr("id"); if(typeof(tinyMCE)!="undefined" && tinyMCE.get(namefield)){ valuefield=tinyMCE.get(namefield).getContent(); }else{ valuefield=$(this).val(); } results[namefield] = encodeURIComponent(valuefield); }); var datastring=""; $.each(results,function(key,value){ if(datastring!=""){datastring+="&";} datastring+=key+"="+value; }); return datastring; } //loader page function loadPage(urlString,title,registerHistory,lightbox,currentPagination){ if($("a.moduleeditokbouton").css("display")!="none"){$("a.moduleeditokbouton").click();} if(($("a.recordokallbouton").length>0 && $("a.recordokallbouton").css("display")!="none")){ if(!confirm("Vous êtes en train de faire des modifications sur la page. Êtes-vous sûr(e) de vouloir continuer ?")){ return false; }else{ cancelrecord(); } } $("#chargement span").html("Chargement en cours"); $("body").trigger("PageChangeBegin",urlString); if(currentPagination==null){ currentPage=1; }else{ currentPage=currentPagination; } loadAlways(urlString,lightbox,currentPage,false); } function loadAlways(url,lightbox,pagination,reloadPage){ nombrezoneschargees=0; tamponOutput={}; totalzoneschargees=$("div.reloadalways").length; if(pagination==undefined){pagination=1;}; //$("body").trigger("LoadAlwaysBegin",url); var currentdivid=0; $('div.reloadalways').not("div.ischildrenmisenpage").each(function() { loadZone($(this).attr("id"),currentdivid,url,lightbox,pagination,"reloadalways",reloadPage); currentdivid++; }) } function loadNecessary(urltogo,lightbox,pagination,reloadPage){ nombrezoneschargees=0; tamponOutput={}; totalzoneschargees=$("div.reloadnecessary").length; //console.log(urltogo); if(pagination==undefined){pagination=1;}; $("body").trigger("LoadNecessaryBegin",urltogo); var currentdivid=0; $('div.reloadnecessary').each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadnecessary",reloadPage); currentdivid++; }) } function loadAlwaysNecessary(urltogo,lightbox,pagination,reloadPage){ nombrezoneschargees=0; tamponOutput={}; totalzoneschargees=$("div.reloadalways").length+$("div.reloadnecessary").length; if(pagination==undefined){pagination=1;}; //$("body").trigger("LoadAlwaysBegin",urltogo); var currentdivid=0; $('div.reloadalways').not("div.ischildrenmisenpage").each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadalwaysnecessary",reloadPage); currentdivid++; }) if(pagination==undefined){pagination=1;}; $("body").trigger("LoadNecessaryBegin",urltogo); $('div.reloadnecessary').each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadalwaysnecessary",reloadPage); currentdivid++; }) } function loadEverything(urltogo,lightbox,pagination,reloadPage){ nombrezoneschargees=0; tamponOutput={}; totalzoneschargees=$("div.reloadnever").length+$("div.reloadalways").length+$("div.reloadnecessary").length; if(pagination==undefined){pagination=1;}; var currentdivid=0; $("body").trigger("LoadEverythingBegin",urltogo); $('div.reloadalways').not("div.ischildrenmisenpage").each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadeverything",reloadPage); currentdivid++; }) if(pagination==undefined){pagination=1;}; $('div.reloadnecessary').each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadeverything",reloadPage); currentdivid++; }) $('div.reloadnever').each(function() { loadZone($(this).attr("id"),currentdivid,urltogo,lightbox,pagination,"reloadeverything",reloadPage); currentdivid++; }) } function loadZone(ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage){ var currentDiv=$("#"+ide); var showpagetitle=false; var sameforallpage=false; if(currentDiv.hasClass("showpagetitletrue")){ showpagetitle=true; } if(currentDiv.hasClass("sameforallpage")){ sameforallpage=true; } var miseenpage=false; if(currentDiv.hasClass("miseenpagetrue")){ miseenpage=true; } //console.log(donnees); $.ajax({ type: "POST", url: url, dataType: "json", data: "goJava=1&nom="+ide+"&reload="+currentDiv.attr("data-reload")+"&showpagetitle="+showpagetitle+"&miseenpage="+miseenpage+"&pagination="+pagination+"&sameforallpage="+sameforallpage+"&post="+donnees.post+"&filtrequery="+$("#filtrequery").val()+"&recherchequery="+escape($("#recherchequery").val())+"&commandestring="+escape($("#commandestring").val())+"&classementquery="+escape($("#classementquery").val())+"&nomjoli="+currentDiv.attr("data-nomjoli").replace(/\\/g, ''), error:function(xhr, status, errorThrown) { if(errorThrown!=""){ if(typeof(console)!=="undefined"){ //console.log("cla errorThrown:"+errorThrown+'\n'+"status:"+status+'\n'+"xhr:"+xhr.statusText); } $("body").trigger("PageChangeComplete",currentHistory); } }, success: function(msg){ currentPageInfo=msg.currentPage; var idscript=0; var nbrscriptloaded=0; var nbrscript=msg.scripts.length; var head= document.getElementsByTagName('head')[0]; if(nbrscript==0){resultload(msg,ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage);}else{ for(idscript=0;idscript0){ nbrscriptloaded++; if(nbrscriptloaded==nbrscript){ resultload(msg,ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage); } }else{ var script= document.createElement('script'); script.onreadystatechange= function () { if (this.readyState == 'complete') { nbrscriptloaded++; if(nbrscriptloaded==nbrscript){ resultload(msg,ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage); }; } } script.onload= function(){ nbrscriptloaded++; if(nbrscriptloaded==nbrscript){ resultload(msg,ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage);}; }; script.type= 'text/javascript'; script.src= 'https://www.netsportique.es/core/'+msg.scripts[idscript]; if(typeof(console)!=="undefined"){ //console.log(script); } head.appendChild(script); }} } } }); } function resultload(msg,ide,incrementation,url,lightbox,pagination,reloadtype,reloadPage){ $("body").unbind("PageChangeComplete.gouppage"); var jHtmlObject = jQuery($.trim(msg.html)); var editor = jQuery("

").append(jHtmlObject); var divtoreplace=editor.find("div").first().attr("id"); tamponOutput[divtoreplace]=msg.html; //var currentDiv=$("#"+divtoreplace); //currentDiv.replaceWith(msg.html); $("body").trigger("ZoneLoadComplete",ide); nombrezoneschargees++; //initialiserform(); incrementation++; //console.log(nombrezoneschargees+"/"+totalzoneschargees); if(reloadtype=="reloadalways"){ if(nombrezoneschargees==totalzoneschargees){ flushTamponOuput(); if(reloadPage!==true){ $("body").bind("PageChangeComplete.gouppage",function(event,url){ gouppage(msg); }); } $("body").trigger("PageChangeComplete",currentHistory); document.title =msg.currentPage.nomjoli; $('meta[name=description]').attr('content', msg.currentPage.description); $('meta[name=tags]').attr('content', msg.currentPage.tags); if(moduleEdition==true){ startmoduleedit(); } } } if(reloadtype=="reloadalwaysnecessary"){ if(nombrezoneschargees==totalzoneschargees){ flushTamponOuput(); if(reloadPage!==true){ $("body").bind("PageChangeComplete.gouppage",function(event,url){ gouppage(msg); }); } $("body").trigger("PageChangeComplete",currentHistory); document.title =msg.currentPage.nomjoli; $('meta[name=description]').attr('content', msg.currentPage.description); $('meta[name=tags]').attr('content', msg.currentPage.tags); if(moduleEdition==true){ startmoduleedit(); } } } if(reloadtype=="reloadeverything"){ $("#introchargement").html(parseInt(nombrezoneschargees/totalzoneschargees*100)+"%"); if(nombrezoneschargees==totalzoneschargees){ flushTamponOuput(); if(reloadPage!==true){ $("body").bind("PageChangeComplete.gouppage",function(event,url){ gouppage(msg); }); } $("body").trigger("PageChangeComplete",currentHistory); document.title =msg.currentPage.nomjoli; $('meta[name=description]').attr('content', msg.currentPage.description); $('meta[name=tags]').attr('content', msg.currentPage.tags); if(moduleEdition==true){ startmoduleedit(); } } } } function flushTamponOuput(){ $.each(tamponOutput,function(divtoreplace,html){ var currentDiv=$("#"+divtoreplace); currentDiv.replaceWith(html); initialiserliens("#"+divtoreplace); }); } function gotopagination(pagination){ console.log(window.location.href); $("body").trigger("PageChangeBegin",window.location.href); $("#chargement span").html("Chargement de la page "+pagination); loadAlways(window.location.href,false,pagination); } function reloadPage(){ var urle=""; urle=document.location.href; $("#chargement span").html("Rechargement de la page"); $("body").trigger("PageChangeBegin",urle); $("body").trigger("ReloadPageBegin",urle); loadAlwaysNecessary(urle,false,1,true); refreshvoletbas(); } function reloadPageForce(){ var urle=""; urle=document.location.href; $("#chargement span").html("Rechargement complète de la page"); $("body").trigger("PageChangeBegin",urle); loadEverything(urle,false,1,true); } function flyto(cible){ $("body").trigger("ScrollBegin",$(window).scrollTop()); var position=$(cible).offset(); if(typeof(position)=="undefined"){return false;} var time=Math.abs($(window).scrollTop()-position.top); if(time>700){time=700;} var offsetancredefault=$("#header_wrap").height(); $("html, body").animate({ scrollTop: position.top-offsetancredefault}, time,function(){ $("body").trigger("ScrollStop",$(window).scrollTop()); }); } function gouppage(msg){ $("body").trigger("ScrollBegin",$(window).scrollTop()); var cible=false; var url=window.location.href; if(gotoafterload!=false){ cible=$(gotoafterload); }else if(window.history.pushState && url.indexOf("#")!=-1){ var depart=url.indexOf("#"); var fin=url.length-1; //console.log(url.substr(url.indexOf("#"),url.length-1)); if($(url.substr(depart,fin)).length>0){ cible=$(url.substr(depart,fin)); } } if(backaction){ backaction=false; var topposition=0; if(typeof(scrollPosition[url])!="undefined"){ topposition=scrollPosition[url]; } console.log(scrollPosition); console.log(topposition); var time=topposition; if(time>1000){time=1000;} $("html, body").animate({ scrollTop: topposition }, time,function(){$("body").trigger("ScrollStop",topposition);}); }else if(cible==false){ var time=$(window).scrollTop(); var topposition=0; var generaloffset=0; if(typeof(msg.currentPage.topoffset)!="undefined" && msg.currentPage.topoffset!="" && msg.currentPage.topoffset!=0){ time=Math.abs($(window).scrollTop()-msg.currentPage.topoffset); topposition=msg.currentPage.topoffset; }else{ time=Math.abs($(window).scrollTop()-generaloffset); topposition=generaloffset; } if(time>1000){time=1000;} $("html, body").animate({ scrollTop: topposition }, time,function(){$("body").trigger("ScrollStop",$(window).scrollTop());}); }else{ var position=cible.offset(); if(typeof(position)!="undefined"){ var topposition=position.top-$("#navigation_wrap").height(); }else{ var topposition=0; } var time=Math.abs($(window).scrollTop()-topposition); if(time>1000){time=1000;} $("html, body").animate({ scrollTop: topposition }, time,function(){$("body").trigger("ScrollStop",$(window).scrollTop());cible.addClass("ciblescroll");}); } } //history function addHistory(data,titlestring,urlcomplete){ scrollPosition[window.location.href]=$(window).scrollTop(); currentHistory=urlcomplete; var hash=urlcomplete.substring("https://www.netsportique.es".length+1,urlcomplete.length); if (hash==""){ urlstring="https://www.netsportique.es"; titlestring=null; }else{ urlstring="https://www.netsportique.es/"+hash; } if(urlstring.indexOf("#")!=-1){ urltoload=urlstring.substr(0,urlstring.indexOf("#")); }else{ urltoload=urlstring; } if(window.history.pushState){ window.history.pushState(data, titlestring, urltoload); if(urlcomplete.indexOf("#")!=-1){ gotoafterload=urlcomplete.substr(urlcomplete.indexOf("#"),urlcomplete.length-1); urlavant=urlcomplete.substr(0,urlcomplete.indexOf("#")); urlapres=window.location.href.substr(0,window.location.href.indexOf("#")); if(urlavant==urlapres){ $("body").bind("PageChangeComplete",function(event,url){ flyto(gotoafterload); }); return false; } } loadPage(urlstring,titlestring,null,false); }else{ History.pushState(null, titlestring, urlstring); } } window.onpopstate = function(event) { if(entrance==false){ currentHistory=document.location.href; backaction=true; loadPage(currentHistory,event.title,null,false); entrance=false; } // alert("location: " + document.location + ", state: " + JSON.stringify(event.state)); }; //function PromptMe() { // var stateVar = "nothin'", displayDiv = document.getElementById("HistoryState"); // // this.historyListener = function(historyHash) { // alert("yo"); // stateVar = historyHash; // loadPage(urlsite+"/"+historyHash); // }; // unFocus.History.addEventListener('historyChange', this.historyListener); // this.historyListener(unFocus.History.getCurrent()); //}; //var demoApp; function rotation(serial,angle,id){ $("#chargement span").html("Rotation en cours"); $("body").trigger("PageChangeBegin",window.location); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/rotation.php", data: "serial="+serial+"&angle="+angle, dataType: "html", beforeSend : function(){ $("#"+id+" img.contenu").fadeOut(); }, success: function(msg){ d = new Date(); //console.log(msg); $("#"+id).html(unescape(msg)); $("#"+id+" img.contenu").on('load', function(){ $(this).css({"opacity":1}); }) initialiserliens("#"+id); $("body").trigger("PageChangeComplete",window.location.href); } }); } function supprimer(type,id,nom){ if(confirm("Supprimer '"+unescape(nom)+"' ?")){ $("#chargement span").html("Suppression en cours"); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/supprimer.php", data: "id="+id+"&type="+type, dataType: "html", error:function(xhr, status, errorThrown) { if(errorThrown!=""){ alert("errorThrown:"+errorThrown+'\n'+"status:"+status+'\n'+"xhr:"+xhr.statusText); } }, success: function(msg){ //console.log(msg); //alert(msg); $("body").trigger("FileDeleteComplete",id); reloadPage(); if(type=="gabarit" || type=="categorie"){ reloadUserPanel(); } } });} } function activer(type,id,active){ $("#chargement span").html("Action en cours"); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/activer.php", data: "id="+id+"&type="+type+"&active="+active, dataType: "html", success: function(msg){ //alert(msg); reloadPage(); } }); } function cacher(type,id,active){ $("#chargement span").html("Action en cours"); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/cacher.php", data: "id="+id+"&type="+type+"&active="+active, dataType: "html", success: function(msg){ //alert(msg); reloadPage(); } }); } function changerordre(type,nouvelordre){ $("#chargement span").html("Changement de l'ordre"); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/changerordre.php", data: "type="+type+"&nouvelordre="+nouvelordre, dataType: "html", error:function(xhr, status, errorThrown) { if(errorThrown!=""){ alert("errorThrown:"+errorThrown+'\n'+"status:"+status+'\n'+"xhr:"+xhr.statusText); } }, success: function(msg){ reloadPage(); } }); } function autoLevel(id,fichier){ $("#chargement span").html("Réglage en cours"); $("body").trigger("PageChangeBegin",window.location); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/balanceblanc.php", data: "serial="+id, dataType: "html", success: function(msg){ d = new Date(); $("#"+id).attr("src", fichier+"?"+d.getTime()); $("body").trigger("PageChangeComplete",window.location.href); } }); } function integrer(nomurl,chemin,galerieid,id,fichier){ $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/integrer.php", async:false, data: "nomurl="+nomurl+"&chemin="+encodeURIComponent(chemin)+"&galerieid="+galerieid+"&id="+id, dataType: "html", beforeSend : function(){ $("#"+id+" img.contenu").fadeOut(); }, success: function(msg){ d = new Date(); $("#"+id).html(unescape(msg)); $("#"+id+" img.contenu").on('load', function(){ $(this).css({"opacity":1}); }) initialiserliens("#"+id); } }); } function recordinDB(classe,id,logs){ logs.logdate=new Date(); var json_text = JSON.stringify(logs); var datastring="classe="+classe+"&id="+id+"&json="+encodeURIComponent(json_text); $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/recordtodb.php", data: datastring, dataType: "json", error:function(xhr, status, errorThrown) { if(errorThrown!=""){ alert("errorThrown:"+errorThrown+'\n'+"status:"+status+'\n'+"xhr:"+xhr.statusText); } }, success: function(msg){ numbersavings=numbersavings-1; $("#chargement span").html("Sauvegarde sur "+$('a.livehtml').length+" zones en cours : "+Math.round((numbersavingstotal-numbersavings)/numbersavingstotal*100)+"%"); if(numbersavings==0){ numbersavingstotal=0; reloadPage(); } if(msg.logs!=""){alert(msg.logs);} } }); } function recordCompleteinDBinsecret(classe,id,logs){ } function sendNotifications(){ $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/envoinotifications.php", dataType: "html", success: function(msg){ //alert(msg); } }); } //DECONNEXION function stopActAs(){ eraseCookie("userGroup"); window.location.reload(); } function deconnexion(){ if($("a.recordokallbouton").length>0 && $("a.recordokallbouton").css("display")!="none"){ if(!confirm("Vous êtes en train de faire des modifications sur la page. Êtes-vous sûr(e) de vouloir vous déconnecter ?")){return false;}else{livehtmlEditor=false;$("#livehtml").remove();$("a.recordallbouton").css("display","inline");$("a.recordokallbouton").css("display","none");} } $.ajax({url: "https://www.netsportique.es/core/php/session-deconnexion.php", success: function(msg){ eraseCookie("userGroup"); $("body").trigger("userDisconnected"); reloadPage(); $("#back").removeClass("loaded"); setTimeout(function(){$("#back").remove(); },1000); $("#back").html(""); $("body").removeClass("opened"); $("#espace").css("display","block"); depreparekeyboard(); deprepareresizeback(); }}); } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/"; } function editCookie(name,value){ document.cookie=name+'='+encodeURIComponent(value)+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return decodeURIComponent(c.substring(nameEQ.length,c.length)); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function supprimerphoto(input,div){ input.val('0'); div.html('(pas de photo disponible)'); } function supprimerdate(input){ input.val(''); } function appearUserPanel(){ $("#back").addClass("loaded"); } function disappearUserPanel(){ $("#back").removeClass("loaded"); setTimeout(function(){$("#back").remove(); },1000); } function reloadUserPanel(){ $.ajax({ type: "POST", url: "https://www.netsportique.es/core/php/volet.php", data: "java=1&rootbase="+rootbase+"&rootcore="+rootcore, dataType: "html", success: function(msg){ if(msg!=""){ if($('body > #back').length==0){ $("body").append('

'); }else{ $("#back").removeClass("loaded"); } $("#back").html(msg); $("#back").addClass("loaded"); $("body").addClass("opened"); } } }); } function reloadMiniUserPanel(){ $.ajax({ type: "POST", url: urltemplate+"/miniuserpanel.php", data: "java=1&rootbase="+rootbase+"&rootcore="+rootcore, dataType: "html", success: function(msg){ $("#espace-switch").html(msg); //$("#back").stop(); //$("#back").animate({top:0},500); } }); } function openMiniUserPanel(){ $("#espace-switch").animate({top:0},500); } function closeMiniUserPanel(){ $("#espace-switch").animate({top:"-100px"},500); } var UserPanel=false; function openUserPanel(direction){ $("body").addClass("opened"); } function closeUserPanel(){ $("body").removeClass("opened"); $("#back").removeClass("loaded"); } function loadEditor(id) { tinymce.init({ selector: "#"+id, theme: "modern", plugins: [ "advlist autolink link image lists charmap preview hr anchor pagebreak", "searchreplace visualblocks visualchars code fullscreen insertdatetime media nonbreaking", "table contextmenu directionality paste textcolor" ], //content_css: "https://www.netsportique.es/template/modele1/css/1-screen.css", toolbar: "undo redo | styleselect | fontsizeselect | bold italic | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | media fullpage", convert_urls: false, language : 'fr_FR', browser_spellcheck: true, entity_encoding : "raw", contextmenu: false }); } function insertAtCursor(value){ //var instance=livehtmlEditor.lastSelectedInstance; //var range = instance.getRng(); // var editorField = instance.selElm(); //var instance=livehtmlEditor.lastSelectedInstance; //alert(value); //pasteHtmlAtCaret(value,true); //instance.nicCommand("insertHTML",value); //instance.e.innerHTML = instance.e.innerHTML.substring(0, range.startOffset) + value + instance.e.innerHTML.substring(range.endOffset, editorField.nodeValue.length); //livehtmlEditor.lastSelectedInstance.setContent(value); tinyMCE.activeEditor.execCommand('mceInsertContent', false, value); } function pasteHtmlAtCaret(html, selectPastedContent) { var sel, range; if (window.getSelection) { // IE9 and non-IE sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); // Range.createContextualFragment() would be useful here but is // only relatively recently standardized and is not supported in // some browsers (IE9, for one) var el = document.createElement("div"); el.innerHTML = html; var frag = document.createDocumentFragment(), node, lastNode; while ( (node = el.firstChild) ) { lastNode = frag.appendChild(node); } var firstNode = frag.firstChild; range.insertNode(frag); // Preserve the selection if (lastNode) { range = range.cloneRange(); range.setStartAfter(lastNode); if (selectPastedContent) { range.setStartBefore(firstNode); } else { range.collapse(true); } sel.removeAllRanges(); sel.addRange(range); } } } else if ( (sel = document.selection) && sel.type != "Control") { // IE < 9 var originalRange = sel.createRange(); originalRange.collapse(true); sel.createRange().pasteHTML(html); if (selectPastedContent) { range = sel.createRange(); range.setEndPoint("StartToStart", originalRange); range.select(); } } } function getenv (varname) { // Get the value of an environment variable // // version: 1109.2015 // discuss at: http://phpjs.org/functions/getenv // + original by: Brett Zamir (http://brett-zamir.me) // % note 1: We are not using $_ENV as in PHP, you could define // % note 1: "$_ENV = this.php_js.ENV;" and get/set accordingly // % note 2: Returns e.g. 'en-US' when set global this.php_js.ENV is set // % note 3: Uses global: php_js to store environment info // * example 1: getenv('LC_ALL'); // * returns 1: false if (!this.php_js || !this.php_js.ENV || !this.php_js.ENV[varname]) { return false; } return this.php_js.ENV[varname]; } if(!window.history.pushState){ (function(window,undefined){ // Establish Variables var History = window.History, // Note: We are using a capital H instead of a lower h State = History.getState(), $log = $('#log'); // Log Initial State //History.log('initial:', State.data, State.title, State.url); // Bind to State Change History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate // Log the State var State = History.getState(); // Note: We are using History.getState() instead of event.state //History.log('statechange:', State.data, State.title, State.url); currentHistory=State.url; loadPage(State.url,State.title,null,false); }); })(window); } //FONCTIONS DU CLAVIER function appearAddModule(){ if($(".addmodule").css("display")=="none"){ $(".addmodule").css("display","block"); $(".addmodule").animate({"opacity":1,"display":"block"},200); } $(".pageedit").fadeToggle(); $(".moduleedit").fadeOut(); $(".modulecontent").fadeOut(); } function disappearAddModule(){ if($(".addmodule").css("display")=="block"){ $(".addmodule").css("display","none"); $(".addmodule").animate({"opacity":0,"display":"none"},200); } $(".pageedit").fadeToggle(); $(".moduleedit").fadeOut(); $(".modulecontent").fadeOut(); } function appearEditModule(){ $(".moduleedit").fadeToggle(); $(".addmodule").fadeOut(); $(".pageedit").fadeOut(); $(".modulecontent").fadeOut(); } function appearEditContent(){ $(".modulecontent").fadeToggle(); $(".addmodule").fadeOut(); $(".pageedit").fadeOut(); $(".moduleedit").fadeOut(); } function startrecord(){ $(document).unbind('click.fb-start'); $("a.recordallbouton").css("display","none"); $("a.addtext").css("display","inline"); $("a.recordokallbouton").css("display","inline"); $("a.insertimagebouton").css("display","inline"); $("a.cancelbouton").css("display","inline"); $("a.moduleeditbouton").css("display","none"); $("a.moduleeditokbouton").css("display","none"); $("#back a.deconnexion").css("display","none"); $('a.livehtml').each(function() { $(this).click(); }); } function saveTextLiveEdit(){ $("#chargement span").html("Sauvegarde sur "+$('a.livehtml').length+" zones en cours : 0%"); $("body").trigger("PageChangeBegin",window.location); var tosave={}; $.each(tinyMCE.editors,function(i,editor){ var json={}; var cibleinfo=editor.id.split('_'); var classe=cibleinfo[0]; var id=cibleinfo[1]; var key=editor.id.split('_'); key.splice(0,2); key.splice(-1,1); key=key.join("_"); var text=editor.getContent(); if(typeof(tosave[classe+"_"+id])=="undefined"){ tosave[classe+"_"+id]={}; } tosave[classe+"_"+id][key]=text; $("#"+editor.id).css("outline",""); }); var length = tinyMCE.editors.length; for (var i=length; i>0; i--) { tinyMCE.editors[i-1].remove(); }; $.each(tosave,function(instance,content){ var cibleinfo=instance.split('_'); var classe=cibleinfo[0]; var id=cibleinfo[1]; recordinDB(classe,id,content); numbersavings++; numbersavingstotal++; }); $("a.recordallbouton").css("display",""); $("a.addtext").css("display","none"); $("a.cancelbouton").css("display","none"); $("a.moduleeditbouton").css("display","inline"); $("a.recordokallbouton").css("display","none"); $("a.insertimagebouton").css("display","none"); $("#back a.deconnexion").css("display","inline"); } function cancelrecord(){ gotovolet(0); if(numbersavings==0){ $("#chargement span").html("Annulation des modifications"); } var length = tinyMCE.editors.length; for (var i=length; i>0; i--) { tinyMCE.editors[i-1].remove(); }; $("a.recordallbouton").css("display","inline"); $("a.cancelbouton").css("display","none"); $("a.moduleeditbouton").css("display","inline"); $("a.moduleeditokbouton").css("display","none"); $("a.recordokallbouton").css("display","none"); $("a.insertimagebouton").css("display","none"); $("#back a.deconnexion").css("display","inline"); } function startmoduleedit(){ appearAddModule(); moduleEdition=true; $("a.moduleeditbouton").css("display","none"); $("a.moduleeditokbouton").css("display","inline"); $("a.cancelbouton").css("display","none"); $("a.recordallbouton").css("display","none"); $("a.recordokallbouton").css("display","none"); $("a.insertimagebouton").css("display","none"); $("#back a.deconnexion").css("display","none"); $('div.copymodule').each(function() { $(this).css("display","block"); }); $('div.module').parent().sortable({ cursor: 'move', update: function(e, ui) { $(this).sortable("refresh"); var nouvelordre='{"elements":['; var i=0; $(this).find('div.module').each(function(){ if(i!=0){nouvelordre+=',';} if($(this).attr('data-reload')=="reloadalways"){ nouvelordre+='{"id":"'+$(this).attr('data-id')+'","position":"'+$(this).attr('data-position')+'","pageid":"'+$(this).attr('data-pageid')+'","nouvelordre":"'+i+'"}'; }else{ nouvelordre+='{"id":"'+$(this).attr('data-id')+'","position":"'+$(this).attr('data-position')+'","nouvelordre":"'+i+'"}'; } i++; }); nouvelordre+="]}"; sorted = $(this).sortable("serialize", 'id'); changerordre("instance",nouvelordre); } }); } function stopmoduleedit(){ disappearAddModule(); moduleEdition=false; $("a.moduleeditbouton").css("display","inline"); $("a.moduleeditokbouton").css("display","none"); $("a.cancelbouton").css("display","none"); $("a.recordallbouton").css("display","inline"); $("#back a.deconnexion").css("display","inline"); $('div.copymodule').each(function() { $(this).css("display","none"); }); //$("a.recordallbouton").css("display","inline"); //$("a.recordokallbouton").css("display","none"); $('div.module').parent().sortable( "destroy" ); } function startgraphismeliveedit(){ } function gotovolet(id){ if(id>0){ $("#voletmask").animate({"left":"0px"},200); $("#voletroll").animate({"left":-((id-1)*$("#back").width())+"px"},200); }else{ $("#voletmask").animate({"left":"100%"},200); } } function preparekeyboard(){ $(document).keydown(function(event){ if(event.which==112){ if($(".addmodule").css("display")=="none"){ cancelrecord(); startmoduleedit(); gotovolet(2); }else{ //stopmoduleedit(); gotovolet(0); } } if(event.which==0){ if($("a.recordokallbouton").css("display")=="none"){ //stopmoduleedit(); startrecord(); gotovolet(1); }else{ stoprecord(); gotovolet(0); } } }); $(document).focus(); } function depreparekeyboard(){ $(document).unbind('keydown'); } function prepareresizeback(limit){ if(limit==undefined){limit=1200;} $(window).resize(function(event){ if($(window).width()limit){ if(UserPanel==false){ if($("#back").hasClass("directionleft")){ openUserPanel("left"); } if($("#back").hasClass("directiontop")){ openUserPanel("top"); } if($("#back").hasClass("directionright")){ openUserPanel("right"); } if($("#back").hasClass("directionbottom")){ openUserPanel("bottom"); } } } }); } function deprepareresizeback(){ $(window).unbind('resize'); } function htmlspecialchars_decode (string, quote_style) { // http://kevin.vanzonneveld.net // + original by: Mirek Slugen // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Mateusz "loonquawl" Zalega // + input by: ReverseSyntax // + input by: Slawomir Kaniecki // + input by: Scott Cariss // + input by: Francois // + bugfixed by: Onno Marsman // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Brett Zamir (http://brett-zamir.me) // + input by: Ratheous // + input by: Mailfaker (http://www.weedem.fr/) // + reimplemented by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Brett Zamir (http://brett-zamir.me) // * example 1: htmlspecialchars_decode("

this -> "

", 'ENT_NOQUOTES'); // * returns 1: '

this -> "

' // * example 2: htmlspecialchars_decode("&quot;"); // * returns 2: '"' var optTemp = 0, i = 0, noquotes = false; if (typeof quote_style === 'undefined') { quote_style = 2; } string = string.toString().replace(/</g, '<').replace(/>/g, '>'); var OPTS = { 'ENT_NOQUOTES': 0, 'ENT_HTML_QUOTE_SINGLE': 1, 'ENT_HTML_QUOTE_DOUBLE': 2, 'ENT_COMPAT': 2, 'ENT_QUOTES': 3, 'ENT_IGNORE': 4 }; if (quote_style === 0) { noquotes = true; } if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags quote_style = [].concat(quote_style); for (i = 0; i < quote_style.length; i++) { // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4 if (OPTS[quote_style[i]] === 0) { noquotes = true; } else if (OPTS[quote_style[i]]) { optTemp = optTemp | OPTS[quote_style[i]]; } } quote_style = optTemp; } if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should // string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP } if (!noquotes) { string = string.replace(/"/g, '"'); } // Put this in last place to avoid escape being double-decoded string = string.replace(/&/g, '&'); return string; } function accentsTidy(s){ var r=s.toLowerCase(); r = r.replace(new RegExp("\\s", 'g'),""); r = r.replace(new RegExp("[àáâãäå]", 'g'),"a"); r = r.replace(new RegExp("æ", 'g'),"ae"); r = r.replace(new RegExp("ç", 'g'),"c"); r = r.replace(new RegExp("[èéêë]", 'g'),"e"); r = r.replace(new RegExp("[ìíîï]", 'g'),"i"); r = r.replace(new RegExp("ñ", 'g'),"n"); r = r.replace(new RegExp("[òóôõö]", 'g'),"o"); r = r.replace(new RegExp("œ", 'g'),"oe"); r = r.replace(new RegExp("[ùúûü]", 'g'),"u"); r = r.replace(new RegExp("[ýÿ]", 'g'),"y"); r = r.replace(new RegExp("\\W", 'g'),"-"); return r; }; function addslashes(str) { str=str.replace(/\\/g,'\\\\'); str=str.replace(/\'/g,'\\\''); str=str.replace(/\"/g,'\\"'); str=str.replace(/\0/g,'\\0'); return str; } function stripslashes(str) { str=str.replace(/\\'/g,'\''); str=str.replace(/\\"/g,'"'); str=str.replace(/\\0/g,'\0'); str=str.replace(/\\\\/g,'\\'); return str; } function isValidEmailAddress(emailAddress) { var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i); return pattern.test(emailAddress); }; function rawurldecode( str ) { // Decodes URL-encodes string // // version: 901.1411 // discuss at: http://phpjs.org/functions/rawurldecode // + original by: Brett Zamir // * example 1: rawurldecode('Kevin+van+Zonneveld%21'); // * returns 1: 'Kevin+van+Zonneveld!' // * example 2: rawurldecode('http%3A%2F%2Fkevin.vanzonneveld.net%2F'); // * returns 2: 'http://kevin.vanzonneveld.net/' // * example 3: rawurldecode('http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'); // * returns 3: 'http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a' var histogram = {}; var ret = str.toString(); var replacer = function(search, replace, str) { var tmp_arr = []; tmp_arr = str.split(search); return tmp_arr.join(replace); }; // The histogram is identical to the one in urlencode. histogram["'"] = '%27'; histogram['('] = '%28'; histogram[')'] = '%29'; histogram['*'] = '%2A'; histogram['~'] = '%7E'; histogram['!'] = '%21'; for (replace in histogram) { search = histogram[replace]; // Switch order when decoding ret = replacer(search, replace, ret) // Custom replace. No regexing } // End with decodeURIComponent, which most resembles PHP's encoding functions ret = decodeURIComponent(ret); return ret; } function loadscriptifnecessary(url){ if($("script[src*='"+url+"']").length==0){ var script= document.createElement('script'); script.onreadystatechange= function () { alert("Chargé"); if (this.readyState == 'complete') { $("body").trigger("Scriptloaded",url); } } script.onload= function () { $("body").trigger("Scriptloaded",url); } script.type= 'text/javascript'; script.src= url; document.head.appendChild(script); return true; }else{ return false; } } function addToPanier(produitjson,donothing){ if(typeof(produitjson.produit)!="undefined"){ parray=[produitjson]; }else{ parray=produitjson; } var datajson={ "action" : "add", "produittoadd": parray }; $.ajax({ url: "https://www.netsportique.es/core/php/session-panier.php", type: "POST", data: datajson, dataType: "html", success: function(session){ if(typeof(donothing)=="undefined" || donothing==false){ if(session=="popup"){ popupPanier(session.lastadded); }else{ addHistory("","","https://www.netsportique.es/carrito-de-la-compra"); } } $("body").trigger("PanierUpdate"); $("body").trigger("ProduitAdd",parray); } }); } function popupPanier(content){ $.ajax({ url: "https://www.netsportique.es/core/php/dernierajout.php", type: "GET", dataType: "html", success: function(msg){ $("#content-popupPanier").remove(); $("#front").append(""); initialiserliens("#content-popupPanier"); animatePanier(); $.fancybox.open({ src: '#content-popupPanier', afterClose : function(){ //parent.animatePanier(); } }); } }); } function animatePanier(){ if($(".bloc_panier").length>0 && $("img.imageproduit").length>0){ var startOffset = $("img.imageproduit").offset(); var destOffset = $(".bloc_panier").offset(); var startLeft=startOffset.left; var startTop=startOffset.top-$(window).scrollTop(); var destLeft=destOffset.left; var destTop=destOffset.top-$(window).scrollTop(); var distanceX=destLeft-startLeft; var distanceY=destTop-startTop; console.log(startTop+"/"+destTop); var clone=$("img.imageproduit").clone().appendTo("#front"); clone.css({position:"fixed",opacity:0.7,left:startLeft+"px",top:startTop+"px",width:$("img.imageproduit").width()+"px",height:$("img.imageproduit").height()+"px",margin:0,padding:0}); TweenMax.to(clone, 0.8, {scale:0.5,opacity:0,x:distanceX,y:(distanceY-50),ease:Strong.easeInOut, onComplete:function(){clone.remove();}}); clignoter($(".bloc_panier")); } } function clignoter(cible){ cible.addClass("clignoter"); } function deleteProductFromPanier(identifiant){ var panier=JSON.parse(readCookie("panier")); delete panier[identifiant]; createCookie("panier",JSON.stringify(panier),0); $("body").trigger("PanierUpdate",panier); } function viderPanier(trigger){ $.ajax({ url: "https://www.netsportique.es/core/php/session-killpanier.php", dataType: "html", success: function(session){ if(typeof(trigger)=="undefined" || trigger==true){ $("body").trigger("PanierUpdate"); } }}); } function changeProductQuantityInPanier(identifiant,quantitydiff){ var panier=JSON.parse(readCookie("panier")); var quantite=parseInt(panier[identifiant]["quantite"]); quantite+=parseInt(quantitydiff); if(quantite<=0){ delete panier[identifiant]; }else{ panier[identifiant]["quantite"]=quantite; } createCookie("panier",JSON.stringify(panier),0); $("body").trigger("PanierUpdate",panier); } function addbrowser(){ } function removebrowser(){ } function openvoletbas(datatoload,isfront,cible){ if($("#browser_saezam").length==0){ $("#front").append("

Navigateur

"); } $.ajax({ type: "POST", url: "https://www.netsportique.es/core/form/voletbas.php", data: 'datastring='+datatoload, dataType: "html", success: function(msg){ $("#browser_saezam .ajax").html(msg); if(!$("#browser_saezam").hasClass("opened")){ $("#browser_saezam").addClass("opened"); } if(isfront){ $("#browser_saezam").addClass("selectfromgalerie"); }else{ $("#browser_saezam").removeClass("selectfromgalerie"); } $("#browser_saezam").attr("data-loaded",datatoload); } }); } function refreshvoletbas(){ if($("#browser_saezam").length==0){ return false; } $.ajax({ type: "POST", url: "https://www.netsportique.es/core/form/voletbas.php", data: 'datastring='+$("#browser_saezam").attr("data-loaded"), dataType: "html", success: function(msg){ $("#browser_saezam .ajax").html(msg); } }); } function animateopenbrowser(){ TweenMax.to($("#browser_saezam"), 0.8, {css:{"bottom":"0px"},ease:Strong.easeInOut,onComplete:function(){refreshbrowser();}}); } function closebrowser(){ if($("#browser_saezam").hasClass("opened")){ $("#browser_saezam").removeClass("opened"); } } $(document).ready(function() { initialiserliens(""); }) $("body").bind("PageChangeBegin",function(event,url){ if($("#chargement").length==0){ $("#front").append("
Chargement en cours
"); }else{ $("#chargement").addClass("showMe"); } }); $("body").bind("PageChangeComplete",function(event,url){ $("#chargement").removeClass("showMe"); setTimeout(function(){$("#chargement").remove();},200); $(document).scroll(); }); //saezam new fonctions var saezam={ lightboxExtensions : ["jpg","jpeg","png","gif","webp","pdf"], xhrs : {}, cke : [], focus : false, uploaders : {}, js : [], jsLoaded : [], css : [] }; saezam.loadCss = function(cssfile,callback){ if (!$("link[href='"+cssfile+"']").length){ $('').appendTo("head"); } if(typeof(callback)!="undefined"){ callback(); } } saezam.loadJs = function(jsfile,callback){ if(saezam["jsLoaded"].includes(jsfile)){ if(typeof(callback)!="undefined"){ callback(); } }else if(saezam["js"].includes(jsfile) && saezam["jsLoaded"].includes(jsfile)==false){ setTimeout(function(){saezam.loadJs(jsfile,callback);},500); }else{ if(typeof(callback)!="undefined"){ $.getScript(jsfile,function(){saezam["jsLoaded"].push(jsfile);callback();}); }else{ $.getScript(jsfile,function(){saezam["jsLoaded"].push(jsfile);}); } saezam["js"].push(jsfile); } } saezam.loadJSON= function(url,callback){ $.ajax({ type: "GET", url: url, dataType: "json", success: function(retour){ if(typeof(callback)!="undefined"){ callback(retour); } return retour; } }); } saezam.geocode = function(address,callback){ var result=saezam.loadJSON("https://api.geoapify.com/v1/geocode/search?text="+address+"&lang=fr&apiKey=8138642610e649d68282f847dd2a7a2d",function(result){ callback(result); }); }