// PRECHARGEMENT DS CACHE // i1 = new Image; i1.src = "static/img/global/chargement.gif"; // alert("test"); //// function checkCP() { // vars let cp,selector,id_pays; // adresse de facturation = livraison ? let statut = document.getElementsByName('deliveryAddressIsSame').value; if (statut===1){ // adresse de facturation = livraison (memo infos facturation) cp = document.getElementById('fac_code_postal').value; selector = document.getElementById('fac_pays_id'); id_pays = selector[selector.selectedIndex].value; }else{ // adresse de facturation <> livraison (memo infos livraison) cp = document.getElementById('liv_code_postal').value; selector = document.getElementById('liv_pays_id'); id_pays = selector[selector.selectedIndex].value; } // Check si pays=france et cp<95999 if( id_pays === '72' && cp > '95999' ) { // erreur de saisie => formulaire pas valide alert("Le code postal n'est pas en France métropolitaine.\nVérifiez votre saisie.") return false; }else{ // ok => validation du formulaire return true; } } function ajxShow(div, action, showhide) { if(document.getElementById(div).style.visibility == "hidden" || showhide === false) { document.getElementById(div).innerHTML = "\"Chargement\""; document.getElementById(div).style.visibility = "visible"; document.getElementById(div).style.display = "block"; // AJAX $.ajax({ type: "POST", url: action, success: function(msg){ $('#'+div).html(msg); } }); } else { document.getElementById(div).style.visibility = "hidden"; document.getElementById(div).style.display = "none"; } } function montrecache(div) { //alert("test"); if($('#'+div).css('display')=='none') { $('#'+div).show('slow'); //$('#'+div).css('line-height', '40px'); } else { $('#'+div).hide('slow'); //$('#'+div).css('line-height', '0px'); } } function montre_menu(num_men) { var i; for (i = 1; i <= 7; i++) { if(i==num_men) montrecache('nav-'+i); else $('#nav-'+i).hide('fast'); } // return false; } function ddcom_show_submit(div, action, datas) { // alert("test"); document.getElementById(div).innerHTML = "\"Chargement\""; //alert(datas); // AJAX $.ajax({ type: "POST", url: action, data: datas, success: function(msg){ // alert(msg); $('#'+div).html(msg); } }); } function addToCart( paramData ) { console.log(paramData); $.ajax({ type: "POST", url: "/index.php", data: paramData, success: function(msg){ console.log(msg); $('#mpanier').html(msg); //alert( "Data Saved: " + msg ); //alert("Ajouté au panier !"); cartSummary(); } }); } function readInCart() { $.ajax({ type: "GET", url: "index.php", data: "act=cart&load=readCart", success: function(msg){ $('#mpanier').html(msg); } }); } function sendFormLogin(paramData) { $.ajax({ type: "POST", url: "index.php", data: paramData, success: function(msg){ $('#bcompte').html(msg); //alert( "Page loaded: " + msg ); } }); return false; } function getLoginMenu(paramData) { $.ajax({ type: "POST", url: "index.php", data: "act=espace-client&load=getLoginMenu", success: function(msg){ $('#bcompte').html(msg); //alert( "Page loaded: " + msg ); } }); } function computeCart(paramData) { delay(function() { $.ajax({ type: "POST", url: "index.php", data: paramData, success: function (msg) { $('#stotal').html(msg); } }); },200); } function deleteFromCart(paramData, fId) { $.ajax({ type: "POST", url: "index.php", data: "act=panier&load=deleteCart&id="+paramData, success: function(msg){ $('#deletecart').html(msg); //alert( "Page loaded: " + msg ); } }); var id = paramData.split('_'); console.log($('#'+id[0]+" tr").size()); readInCart(); $('#lineCart'+paramData+' + tr').remove(); $('#lineCart'+paramData).remove(); if($('#'+id[0]+" tr").size() == 1){ $('#'+id[0]).remove(); $('#head'+id[0]).remove(); } computeCart($('#'+fId).serialize()); } function sendFormNL(paramData) { $.ajax({ type: "POST", url: "index.php", data: paramData, success: function(msg){ $('#nlet').html(msg); //alert( "Page loaded: " + msg ); } }); return false; } // AFFICHAGE DES MODES D'EXPEDITION $('#panier input.addressBook').live('click', function(){ var proceed = false; // SI L'ADRESSE DE LIVRAISON EST LA MEME QUE L'ADRESSE DE FACTURATION if($('input.deliveryAddressIsSame').is(':checked') && $(this).attr('name') == "billAddress") { proceed = true; } // SINON ON N'AFFICHE LES MODES D'EXPEDITION QUE POUR L'ADRESSE DE LIVRAISON else if(!$('input.deliveryAddressIsSame').is(':checked') && $(this).attr('name') == "deliveryAddress") { proceed = true; } if(proceed) { $.ajax({ type: "POST", url: "index.php", data: "act=ajax&load=reload-expedition&total=" + $('input#cartStotal').val() + "&poids=" + $('input#cartPoids').val() + "&allDigital=" + $('input#cartAllDigital').val() + "&id=" + $(this).val(), success: function(msg){ $('#mexped').html(msg); //alert( "Page loaded: " + msg ); } }); } }); $(document).ready(function() { // SELECTION ADRESSE DE LIVRAISON $('#panier input.deliveryAddressIsSame').click(function() { var id = 0; var addRadio = $('input#ajxAddRadio').val(); // AFFICHAGE OU NON DU CARNET D'ADRESSES if($('input.deliveryAddressIsSame').is(':checked')) { /* $('#deliveryAddress').html(''); var radioValue = $("#panier input[name='billAddress']:checked").val(); if(radioValue > 0) { id = radioValue; }*/ $("#deliveryAddress" ).hide(); } else { $("#deliveryAddress" ).show(); /*$.ajax({ type: "POST", url: "index.php", data: "act=espace-client&load=getDeliveryAddress&addRadio=" + addRadio, success: function(msg){ $('#deliveryAddress').html(msg); //alert( "Page loaded: " + msg ); } });*/ } // MISE A JOUR DES MODES D'EXPEDITION $.ajax({ type: "POST", url: "index.php", data: "act=ajax&load=reload-expedition&total=" + $('input#cartStotal').val() + "&poids=" + $('input#cartPoids').val() + "&allDigital=" + $('input#cartAllDigital').val() + "&id=" + id, success: function(msg){ $('#mexped').html(msg); //alert( "Page loaded: " + msg ); } }); }); }); /******************************************** ** APPARITION ET DISPARITION DES MENUS ** ****************************************/ function afficheMenu(obj) { var idMenu = obj.id; var idSousMenu = 'sous' + idMenu; var sousMenu = document.getElementById(idSousMenu); /*****************************************************/ /** on cache tous les sous-menus pour n'afficher **/ /** que celui dont le menu correspondant est cliqué **/ /** 5 correspond au nombre de sous-menus **/ /*****************************************************/ for(var i = 1; i <= 5; i++) { if(document.getElementById('sousmenu' + i) && document.getElementById('sousmenu' + i) != sousMenu) { document.getElementById('sousmenu' + i).style.display = "none"; } } if(sousMenu) { //alert(sousMenu.style.display); if(sousMenu.style.display == "block") { sousMenu.style.display = "none"; } else { sousMenu.style.display = "block"; } } } /******************************************** ** APPARITION ET DISPARITION DES BLOCS ** ****************************************/ function afficheBloc(obj) { var idBloc = obj.id; var idSousBloc = 'sous' + idBloc; var sousBloc = document.getElementById(idSousBloc); /*****************************************************/ /** on cache tous les sous-blocs pour n'afficher **/ /** que celui dont le bloc correspondant est cliqué **/ /** 4 correspond au nombre de sous-bloc **/ /*****************************************************/ /*for(var i = 1; i <= 4; i++) { if(document.getElementById('sousbloc' + i) && document.getElementById('sousbloc' + i) != sousBloc) { document.getElementById('sousbloc' + i).style.display = "none"; } }*/ if(sousBloc) { //alert(sousBloc.style.display); if(sousBloc.style.display == "block") { sousBloc.style.display = "none"; } else { sousBloc.style.display = "block"; } } } function afficheChg(id) { elt = document.getElementById(id); elt.style.display = "block"; } function fermeall() { for(var i = 1; i <= 5; i++) { if(document.getElementById('sousmenu' + i)) { document.getElementById('sousmenu' + i).style.display = "none"; } } } function show_menuh( id ) { for(var i = 1; i <= 7; i++) { if(document.getElementById("ssmenuh" + i)) { if(i == id) document.getElementById("ssmenuh" + i).style.display = "block"; else document.getElementById("ssmenuh" + i).style.display = "none"; } } } function thumbs( src ) { document.getElementById('athumbId').href = src; document.getElementById('imgthumbId').src = src; } // INFO BULLE // function GetId(id) { return document.getElementById(id); } var i = false; // La variable i nous dit si la bulle est visible ou non function move_info(e) { if(i) { // Si la bulle est visible, on calcul en temps reel sa position ideale if(navigator.appName != "Microsoft Internet Explorer") { // Si on est pas sous IE GetId("curseur").style.left = e.pageX + 5+"px"; GetId("curseur").style.top = e.pageY + 10+"px"; } else { // Modif proposé par TeDeum, merci à lui if(document.documentElement.clientWidth > 0) { GetId("curseur").style.left = 20+event.x+document.documentElement.scrollLeft+"px"; GetId("curseur").style.top = 10+event.y+document.documentElement.scrollTop+"px"; } else { GetId("curseur").style.left = 20+event.x+document.body.scrollLeft+"px"; GetId("curseur").style.top = 10+event.y+document.body.scrollTop+"px"; } } } } function montre(text) { if(i == false) { GetId("curseur").style.visibility = "visible"; // Si il est caché (la verif n'est qu'une securité) on le rend visible. GetId("curseur").innerHTML = text; // on copie notre texte dans l'élément html i = true; } } function cache() { if(i == true) { GetId("curseur").style.visibility = "hidden"; // Si la bulle est visible on la cache i = false; } } function BeforeChoixlib(url,ean,session,gencod) { var sessionid = ''; var skipConfirm = false; session = JSON.parse(atob(session)); if(typeof(session.cart) !== "undefined") { if(session.cart.length == 0) { skipConfirm = true; } } else { skipConfirm = true; } if(gencod != '') { if (!skipConfirm) { if (confirm('Vous êtes en train d\'être redirigé sur le portail des Librairies Mieux Etre et Spiritualites, voulez vous conserver votre panier ?')) { sessionid = '&session_id=' + session.id; } } else { alert('Vous êtes en train d\'être redirigé sur le portail des Librairies Mieux Etre et Spiritualites, cliquez sur OK pour continuer'); } } window.location.href= url+"/panier/choixlib.html?id="+ean+sessionid; } var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); document.onmousemove = move_info; // dès que la souris bouge, on appelle la fonction move pour mettre à jour la position de la bulle. ////