$(function() { }); function get_booster_geolocation(){ if (navigator.geolocation){ var optionsUserGeolocation = { enableHighAccuracy: true, maximumAge: 100, timeout: 60000 }; function successUserGeolocation(pos) { var crd = pos.coords; $.ajax({ type: "POST", url: "http://www.leboost.com/set-booster-geolocation.ajax", data: "latitude="+crd.latitude+"&longitude="+crd.longitude, success: function(msg){ if (msg != '0'){ location.reload(); } } }); /* console.warn('Your current position is:'); console.log('Latitude : ' + crd.latitude); console.log('Longitude: ' + crd.longitude); console.log('More or less ' + crd.accuracy + ' meters.'); */ }; function errorUserGeolocation(err) { console.warn('ERROR(' + err.code + '): ' + err.message); }; navigator.geolocation.getCurrentPosition(successUserGeolocation, errorUserGeolocation, optionsUserGeolocation); } } function get_etablissements_yellowpages_by_name() { var cp = $("#cp").val(); var etablissement = $("#etablissement").val(); if (etablissement.length > 3 && cp.length >= 2){ $.ajax({ type: "POST", url: "http://www.leboost.com//06-nice//get-etablissements-yellowpages-by-name.ajax", data: "etablissement="+etablissement+"&cp="+cp, success: function(msg){ $("#propositionsEtablissements").html(msg); } }); } } function get_villes_correspondantes() { var cp = (typeof $("#cp").val() !== 'undefined'?$("#cp").val():''); var ville = $("#labelVille").val(); $.ajax({ type: "POST", url: "http://www.leboost.com/get-villes-correspondantes.ajax", data: "ville="+ville+"&cp="+cp, success: function(msg){ $("#villesCorrespondantes").html(msg); } }); } function get_etablissements_doublons() { var cp = $("#cp").val(); var etablissement = $("#etablissement").val(); if (etablissement.length > 3 && cp.length >= 2){ $.ajax({ type: "POST", url: "http://www.leboost.com/get-etablissements-doublons.ajax", data: "etablissement="+etablissement+"&cp="+cp, success: function(msg){ $("#doublonsEtablissements").html(msg); } }); } } function get_evenements_doublons(etablissement_id, evenement){ $.ajax({ type: "POST", url: "http://www.leboost.com/get-evenements-doublons.ajax", data: "etablissement_id="+etablissement_id+"&evenement="+evenement, success: function(msg){ if (msg != ''){ $("#doublonsEvenements").show(); $("#doublonsEvenements").html(msg); } else { $("#doublonsEvenements").hide(); } } }); } function get_boosters_doublons() { var pseudo = $("#pseudo").val(); $.ajax({ type: "POST", url: "http://www.leboost.com/get-boosters-doublons.ajax", data: "pseudo="+pseudo, success: function(msg){ if (msg != ''){ $("#doublonsBoosters").html(msg); $("#pseudo").val(''); } else{ $("#doublonsBoosters").html(''); } } }); } function actualiserCalendrier(action){ var mois = $("#calendrierMois").html(); var annee = $("#calendrierAnnee").html(); var thisDate = 20180918 if ($("#calendrier")){ $.ajax({ type: "POST", url: "http://www.leboost.com/calendrier.ajax", data: "mois="+mois+"&annee="+annee+"&thisDate="+thisDate+"&action="+action, success: function(msg){ $("#calendrier").html(msg); $("#calendrierMois").html($("#calendrierNewMois").html()); $("#calendrierAnnee").html($("#calendrierNewAnnee").html()); } }); } } function evenementsEnCeMoment(){ $.ajax({ type: "POST", url: "http://www.leboost.com//06-nice//get-evenements-en-ce-moment.ajax", data: "", success: function(msg){ $("#enCeMoment div").html(msg); $('#enCeMoment').slideToggle('fast'); } }); } function getEvenementByEtablissementID(etablissement_id){ return $.ajax({ type: "POST", url: "http://www.leboost.com//06-nice//get-today-evenement-by-etablissement-id.ajax", data: "etablissement_id="+etablissement_id }); } function getEvenementByID(evenement_id){ return $.ajax({ type: "POST", url: "http://www.leboost.com//06-nice//get-evenement-by-id.ajax", data: "evenement_id="+evenement_id+"&d_jour="+$("#d_jour").html() }); } function getEtablissementByID(etablissement_id){ return $.ajax({ type: "POST", url: "http://www.leboost.com/06-nice/get-etablissement-by-id.ajax", data: "etablissement_id="+etablissement_id }); } function get_more_articles(){ var distanceTop = $('.waypoint').offset().top - $(window).height(); if ($(window).scrollTop() >= distanceTop && $('#more_articles').html() != 0){ $('.waypoint').removeClass('waypoint'); $.ajax({ type: "POST", url: "http://www.leboost.com/get-more-articles.ajax", data: "limit="+$('#more_articles').html()+'&latitude='+$('#articles_latitude').html()+'&longitude='+$('#articles_longitude').html(), success: function(msg){ $('#more_articles').html(parseInt($('#more_articles').html())+30) if (msg != 0) $('.colonnePreview:last').after(msg); else $('#more_galeries_photos').html(0); $('.colonnePreview:last').addClass('waypoint'); } }); } } function get_more_galeries(){ var distanceTop = $('.waypoint').offset().top - $(window).height(); if ($(window).scrollTop() >= distanceTop && $('#more_galeries_photos').html() != 0){ $('.waypoint').removeClass('waypoint'); $.ajax({ type: "POST", url: "http://www.leboost.com/get-more-galeries.ajax", data: "etablissement_id="+$('#more_galeries_etablissement_id').html()+"&limit="+$('#more_galeries_photos').html()+'&latitude='+$('#galeries_latitude').html()+'&longitude='+$('#galeries_longitude').html(), success: function(msg){ $('#more_galeries_photos').html(parseInt($('#more_galeries_photos').html())+30) if (msg != 0) $('.colonnePreview:last').after(msg); else $('#more_galeries_photos').html(0); $('.colonnePreview:last').addClass('waypoint'); } }); } } //Routine FB Events function getFbEvents(){ $.ajax({ async: true, type: "POST", url: "http://www.leboost.com/get-fb-events.ajax", success: function(msg){ if (msg.match(/^(\d+)$/)){ getFbEvents(); } else { $('.connecteViaFB').html('>'+$('.connecteViaFB').html()); } } }); }