') } opts = $.extend({}, $.fn.CloudZoom.defaults, options); opts = $.extend({}, opts, relOpts); $(this).data('zoom', new CloudZoom($(this), opts)) } else if ($(this).is('.cloud-zoom-gallery')) { opts = $.extend({}, relOpts, options); $(this).data('relOpts', opts); $(this).bind('click', $(this), function (event) { var data = event.data.data('relOpts'); var $imgContainer = $('#' + data.useZoom); var $img = $imgContainer.find('img'); $imgContainer.data('zoom').destroy(); $imgContainer.attr('href', event.data.attr('href')); if (data.loupeRel !== undefined && data.loupeRel != '') $imgContainer.attr('rel', data.loupeRel); $img.attr('src', data.smallImage); if (data.width !== undefined && data.width != '') $img.attr('width', data.width); if (data.height !== undefined && data.height != '') $img.attr('height', data.height); $imgContainer.CloudZoom(); return false }) } }); return this }; $.fn.CloudZoom.defaults = { zoomWidth: 'auto', zoomHeight: 'auto', position: 'right', tint: false, tintOpacity: 0.5, lensOpacity: 0.5, softFocus: false, smoothMove: 3, showTitle: true, titleOpacity: 0.5, adjustX: 0, adjustY: 0 } $(document).ready(function () { $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom() }); })(jQuery); /* * jCountdown 1.4.2 jQuery Plugin * Copyright 2012 Tom Ellis http://www.webmuse.co.uk | MIT Licensed (license.txt) */ // FICHE_ARTICLE_VENTEFLASH_V12 (function ($) { $.fn.countdown = function (method) { var defaults = { date: null, updateTime: 1E3, htmlTemplate: "%d days %h hours %i mins %s sec", minus: false, onChange: null, onComplete: null, onResume: null, onPause: null, leadingZero: false, offset: null, servertime: null, hoursOnly: false, minsOnly: false, secsOnly: false, hours: false, yearsAndMonths: false, direction: "down" }, slice = [].slice, clear = window.clearInterval, floor = Math.floor, ceil = Math.ceil, msPerHr = 36E5, msPerDay = 864E5, rDate = /(%y|%m|%d|%h|%i|%s)/g, rYears = /%y/, rMonths = /%m/, rDays = /%d/, rHrs = /%h/, rMins = /%i/, rSecs = /%s/, getTZDate = function (offset, difference) { var hrs, dateMS, extra, curHrs, tmpDate = new Date(); if (offset === null) { dateMS = tmpDate.getTime() - difference; } else { hrs = offset * msPerHr; curHrs = tmpDate.getTime() - ((-tmpDate.getTimezoneOffset() / 60) * msPerHr) + hrs; dateMS = tmpDate.setTime(curHrs); } return new Date(dateMS); }, timerFunc = function () { var $this = this, template, now, date, timeLeft, yearsLeft, monthsLeft, eDaysLeft, daysLeft, eHrsLeft, hrsLeft, minsLeft, eMinsleft, secLeft, time = "", diff, settings = $this.data("jcdData"); if (!settings) { return false; } template = settings.htmlTemplate; if (settings.offset === null && settings.servertime === null) { now = new Date(); } else if (settings.offset !== null) { now = getTZDate(settings.offset); } else { now = getTZDate(null, settings.difference); } date = new Date(settings.date); timeLeft = (settings.direction === "down") ? date.getTime() - now.getTime() : now.getTime() - date.getTime(); diff = Math.round(timeLeft / 1000); secLeft = diff % 60; diff = floor(diff / 60); minsLeft = diff % 60; diff = floor(diff / 60); hrsLeft = diff % 24; diff = floor(diff / 24); daysLeft = diff; if (settings.yearsAndMonths) { yearsLeft = floor(diff / 365); diff = floor(diff % 365); monthsLeft = floor(diff / 30); if (monthsLeft === 12) { if (settings.direction === "down") { yearsLeft = 1; } else { yearsLeft += 1; } monthsLeft = 0; diff = 12; } daysLeft = ceil(diff % 30); } if (settings.hoursOnly) { hrsLeft += daysLeft * 24; daysLeft = 0; } if (settings.minsOnly) { minsLeft += (hrsLeft * 60) + ((daysLeft * 24) * 60); daysLeft = 0; hrsLeft = 0; } if (settings.secsOnly) { secLeft += (minsLeft * 60); daysLeft = 0; hrsLeft = 0; minsLeft = 0; } settings.yearsLeft = yearsLeft; settings.monthsLeft = monthsLeft; settings.daysLeft = daysLeft; settings.hrsLeft = hrsLeft; settings.minsLeft = minsLeft; settings.secLeft = secLeft; if (secLeft === 60) { secLeft = 0; } if (settings.leadingZero) { if (daysLeft < 10 && !settings.hoursOnly) { daysLeft = "0" + daysLeft; } if (yearsLeft < 10) { yearsLeft = "0" + yearsLeft; } if (monthsLeft < 10) { monthsLeft = "0" + monthsLeft; } if (hrsLeft < 10) { hrsLeft = "0" + hrsLeft; } if (minsLeft < 10) { minsLeft = "0" + minsLeft; } if (secLeft < 10) { secLeft = "0" + secLeft; } } if ((settings.direction === "down" && (now < date || settings.minus)) || (settings.direction === "up" && (date < now || settings.minus))) { time = template.replace(rYears, yearsLeft).replace(rMonths, monthsLeft); time = time.replace(rDays, daysLeft).replace(rHrs, hrsLeft).replace(rMins, minsLeft).replace(rSecs, secLeft); } else { time = template.replace(rDate, "00"); settings.hasCompleted = true; } $this.html(time).trigger("change.jcdevt", [settings]); if (settings.hasCompleted) { $this.trigger("complete.jcdevt"); clear(settings.timer); } }, methods = { init: function (options) { var opts = $.extend({}, defaults, options), template = opts.htmlTemplate, local, testDate; return this.each(function () { var $this = $(this), settings = {}, func; if ($this.data("jcdData")) { $this.countdown("changeSettings", options, true); opts = $this.data("jcdData"); } if (opts.date === null) { $.error("No Date passed to jCountdown. date option is required."); return true; } testDate = new Date(opts.date); if (testDate.toString() === "Invalid Date") { $.error("Invalid Date passed to jCountdown: " + opts.date); } testDate = null; if (opts.onChange) { $this.on("change.jcdevt", opts.onChange); } if (opts.onComplete) { $this.on("complete.jcdevt", opts.onComplete); } if (opts.onPause) { $this.on("pause.jcdevt", opts.onPause); } if (opts.onResume) { $this.on("resume.jcdevt", opts.onResume); } settings = { originalHTML: $this.html(), date: opts.date, yearsAndMonths: opts.yearsAndMonths, hoursOnly: opts.hoursOnly, minsOnly: opts.minsOnly, secsOnly: opts.secsOnly, leadingZero: opts.leadingZero, updateTime: opts.updateTime, direction: opts.direction, template: opts.htmlTemplate, htmlTemplate: opts.htmlTemplate, minus: opts.minus, offset: opts.offset, servertime: opts.servertime, difference: null, onChange: opts.onChange, onComplete: opts.onComplete, onResume: opts.onResume, onPause: opts.onPause, hasCompleted: false, timer: 0 }; if (opts.servertime !== null) { var tempTime; local = new Date(); tempTime = ($.isFunction(settings.servertime)) ? settings.servertime() : settings.servertime; settings.difference = local.getTime() - tempTime; } func = $.proxy(timerFunc, $this); settings.timer = setInterval(func, settings.updateTime); $this.data("jcdData", settings); func(); }); }, changeSettings: function (options, internal) { return this.each(function () { var $this = $(this), settings, testDate, func = $.proxy(timerFunc, $this); if (!$this.data("jcdData")) { return true; } settings = $.extend({}, $this.data("jcdData"), options); if (options.hasOwnProperty("date")) { testDate = new Date(options.date); if (testDate.toString() === "Invalid Date") { $.error("Invalid Date passed to jCountdown: " + options.date); } } settings.completed = false; clear(settings.timer); $this.off(".jcdevt").data("jcdData", settings); if (!internal) { if (settings.onChange) { $this.on("change.jcdevt", settings.onChange); } if (settings.onComplete) { $this.on("complete.jcdevt", settings.onComplete); } if (settings.onPause) { $this.on("pause.jcdevt", settings.onPause); } if (settings.onResume) { $this.on("resume.jcdevt", settings.onResume); } settings.timer = setInterval(func, settings.updateTime); $this.data("jcdData", settings); func(); } }); }, resume: function () { return this.each(function () { var $this = $(this), settings = $this.data("jcdData"), func = $.proxy(timerFunc, $this); if (!settings) { return true; } $this.data("jcdData", settings).trigger("resume.jcdevt"); if (!settings.hasCompleted) { settings.timer = setInterval(func, settings.updateTime); func(); } }); }, pause: function () { return this.each(function () { var $this = $(this), settings = $this.data("jcdData"); if (!settings) { return true; } clear(settings.timer); $this.data("jcdData", settings).trigger("pause.jcdevt"); }); }, complete: function () { return this.each(function () { var $this = $(this), settings = $this.data("jcdData"); if (!settings) { return true; } clear(settings.timer); settings.hasCompleted = true; $this.data("jcdData", settings).trigger("complete.jcdevt").off(".jcdevt"); }); }, destroy: function () { return this.each(function () { var $this = $(this), settings = $this.data("jcdData"); if (!settings) { return true; } clear(settings.timer); $this.off(".jcdevt").removeData("jcdData").html(settings.originalHTML); }); }, getSettings: function (name) { var $this = $(this), settings = $this.data("jcdData"); if (name && settings) { if (settings.hasOwnProperty(name)) { return settings[name]; } return undefined; } return settings; } }; if (methods[method]) { return methods[method].apply(this, slice.call(arguments, 1)); } else if (typeof method === "object" || !method) { return methods.init.apply(this, arguments); } else { $.error("Method " + method + " does not exist in the jCountdown Plugin"); } }; })(jQuery); } }(jQuery)); (function ($) { var moduleParams = {"txt":"Search :","mobileOn":false,"caisseOn":false,"bookingsOn":false}; $('#ac_keywords').on('focus', function () { if (this.value == moduleParams.txt) { this.value = ''; } }); if(moduleParams.mobileOn) { $('#header_search_trigger').on('click',function() { $('#header_search').slideToggle('fast');	}); } }(jQuery)); (function ($) { var moduleParams = {"products_id":937,"price":"0.30 \u20ac","thanks":"Your request has been taken into account.","mobileOn":false,"caisseOn":false,"bookingsOn":false}; $('#mod_fa_notifier_prix_lien').on('click',function () { $('#notifier_prix_content').modal({overlayClose: true}); window.scrollTo(0, 0); }); $('#notify_customer_close').on('click',function() { $.modal.close(); return false; }); $('#notify_customer_trigger').on('click',function(e) { e.preventDefault(); $('notifier_prix_message').hide(); $('notifier_prix_field_error').removeClass('notifier_prix_field_error'); $.post('ajax.php', { page: 'fa', action: 'send_notify_price', notify_pid: moduleParams.products_id, notify_ourprice: moduleParams.price, notify_price: $('#notify_price').val(), notify_products_name: $('#notify_product_name').val(), notify_url: $('#notify_url').val(), notify_customer_name: $('#notify_customer_name').val(), notify_customer_email: $('#notify_customer_email').val(), notify_customer_comment: $('#notify_customer_comment').val() }, function (data) { var json = data.evalJSON(true); if (json.erreur) { $('#notifier_prix_message').html(json.erreur).show(); if (json.fields) { for (i = 0; i < json.fields.length; i++) { $(json.fields[i]).parents().addClass('notifier_prix_field_error'); } } } else { $.modal.close(); alert(moduleParams.thanks); } }); }); }(jQuery)); (function ($) { var moduleParams = {"txtPrefix":"txt_","mobileOn":false,"caisseOn":false,"bookingsOn":false}; var $optionIconsValues = $('.fa_options_icone_valeurs'); $optionIconsValues.on('click', function() { $optionIconsValues.css('border', '1px solid transparent'); $(this).css('border', '2px solid black').prev('input[type="radio"]').attr('checked', 'checked'); }); if($optionIconsValues.load && $optionIconsValues.length) { $optionIconsValues.eq(0).trigger('click'); } $('#fa_options :input').on('change',function() { updateFaStock(); updateFaPrice(); var type = $(this).prop('type'); if(type == 'select-one') { change_image($(this).data('option_id')); //Compatible FICHE_ARTICLE_IMAGELOUPE uniquement } }); $('#fa_options :input').on('click',function() { var type = $(this).prop('type'); if(type == 'checkbox' || type == 'radio') { updateFaStock(); updateFaPrice(); } }); $('#fa_options textarea').on('keydown keyup focus',function() { var $this = $(this); textCounter($this.get(0),$(this).data('progressbar'),$this.data('length')); }); $('#fa_options textarea').trigger('focus'); }(jQuery)); (function ($) { var moduleParams = {"btns":"non","minQty":1,"productsQtyBlocks":1,"mobileOn":false,"caisseOn":false,"bookingsOn":false}; var $elQuantity = $('#fa_quantity'); var qtyBlocks = moduleParams.productsQtyBlocks; if (isNaN(qtyBlocks) || qtyBlocks<1) { qtyBlocks = 1; } function mod_fa_quantite_checkValue() { var qty = parseInt($elQuantity.val()); var newQty = mod_fa_quantite_getCleanValue(qty); if (qtyBlocks > 1) { // Quantité par lot if ((newQty % qtyBlocks) != 0) newQty += (qtyBlocks - (newQty % qtyBlocks)); } if (qty!= newQty) { $elQuantity.val(newQty); } } function mod_fa_quantite_getCleanValue (qty) { // Si la valeur saisie n'est pas numérique on met 1 if (isNaN(qty) || qty < moduleParams.minQty) { qty = moduleParams.minQty; } return qty; } $elQuantity.bind({ change: function () { mod_fa_quantite_checkValue(); updateFaOptions(); }, keypress: function (event) { if (event.which == 13) { event.preventDefault(); mod_fa_quantite_checkValue(); updateFaOptions(); } } }); if ('oui' === moduleParams.btns) { $('div.mod_fa_quantite_moins').off('click').on('click', function () { let qty = parseInt($elQuantity.val()), qtyMin = $elQuantity.data('min') ; if (qty > Math.max(1, qtyMin)) { $elQuantity.val(mod_fa_quantite_getCleanValue(qty - qtyBlocks)); updateFaOptions(); } }); $('div.mod_fa_quantite_plus').off('click').on('click', function () { let qty = parseInt($elQuantity.val()), qtyMax = $elQuantity.data('max') ; if (qtyMax !== 0 && (qty + qtyBlocks) > qtyMax) { return; } $elQuantity.val(mod_fa_quantite_getCleanValue(qty + qtyBlocks)); updateFaOptions(); }); } }(jQuery)); (function ($) { var moduleParams = {"url":"mon_compte_wishlist.php","products_id":937,"init_poid":"937{2}21","customer_logged_in":false,"customer_wishlist_products":[],"mobileOn":false,"caisseOn":false,"bookingsOn":false}; let removeLink = document.querySelector('#removeWishlistLink'), addLink = document.querySelector('#addWishlistLink') // ---------------- Etat du lien : // "Ajouter à ma liste" ou "Retirer de ma liste" const updateWishlistLinkState = (newPoid) => { if (moduleParams.customer_wishlist_products) { let productInList = false moduleParams.customer_wishlist_products.forEach(poid => { if (poid == newPoid) { // La déclinaison de l'article est dans la Wishlist // Affichage du lien "Retirer de ma liste" if(removeLink) { removeLink.dataset.poid = newPoid removeLink.style.display = 'inline-block' } if(addLink) { addLink.style.display = 'none' } productInList = true } }) if (!productInList) { // La déclinaison de l'article n'est pas dans la Wishlist // Affichage du lien "Ajouter à ma liste" if(removeLink) { removeLink.style.display = 'none' } if(addLink) { addLink.style.display = 'inline-block' addLink.dataset.poid = newPoid } } } } // init updateWishlistLinkState(moduleParams.init_poid) // Mise à jour au changement d'option const getDeclinationPoid = (idWrapper) => { // Récupération en ajax du poid de la déclinaison à partir des options sélectionnées const data = new FormData(); data.append('page', 'fa'); data.append('action', 'getPoid'); data.append('pid', moduleParams.products_id); const faOptions = document.getElementById(idWrapper).querySelectorAll('[name^="id["]') if (faOptions) { let opts = [] faOptions.forEach(option => { if (option.name.indexOf('txt_') === -1) { // CF bug n°11044, on n'insère pas les optons de type text (les options de type file sont déjà exclues) opts.push({ name: option.name, value: option.value }) } }) data.append('opts', JSON.stringify(opts)); } const request = new XMLHttpRequest(); request.open('POST', 'ajax.php'); request.onload = function () { if (request.status >= 200 && request.status < 400) { // Mise à jour du lien en fonction du poid obtenu updateWishlistLinkState(this.response) } } request.send(data) } window.addEventListener('updateFaOptions', e => { getDeclinationPoid(e.detail.idWrapper); }) // ---------------- Actions const save = (id, action) => { if (moduleParams.customer_logged_in) { // Ajout ajax à la wishlist let xmlHttp = new XMLHttpRequest() xmlHttp.open('GET', moduleParams.url + '?action=' + action + '&products_id=' + id, true) xmlHttp.onreadystatechange = () => { if (xmlHttp.readyState == XMLHttpRequest.DONE) { if (xmlHttp.status == 200) { location.reload() } } } xmlHttp.send() } else { // Redirection normale si client pas identifié car passage par connexion.php window.location = moduleParams.url + '?action=' + action + '&products_id=' + id; } } // Ajout à la Wishlist if(addLink) { addLink.addEventListener('click', item => { save(undefined !== item.target.dataset.poid ? item.target.dataset.poid : moduleParams.products_id, 'add'); }) } // Suppression de la Wishlist if(removeLink) { removeLink.addEventListener('click', item => { save(undefined !== item.target.dataset.poid ? item.target.dataset.poid : moduleParams.products_id, 'remove'); }) } }(jQuery)); (function ($) { var moduleParams = {"mobileOn":false,"caisseOn":false,"bookingsOn":false}; var catwalk_speed3 = 0, catwalk_shift_interval3 = 0, catwalk_speed_limit3 = 7, faGaleryWith3 = $('#pccatwalkcontainer3').find('.pccatwalktable').width(); function catwalk_over3(event, idTable) { catwalk_shift_interval3 = setInterval(function() { catwalk_shift3(idTable); }, 1); } function catwalk_move3(event, idContainer, idLeft, idRight, idTable) { var el = event.srcElement; if(!el) { el = event.target; } var offsetCount = 0; while(el.id != idContainer) { offsetCount += el.offsetLeft; el = el.parentNode; } var mouseX = event.offsetX + offsetCount; if(typeof event.offsetX == "undefined") { if(event.target.id.match(idLeft)) { mouseX = event.layerX; } else { if(event.target.id.match(idRight)) { mouseX = event.layerX; } else { mouseX = event.layerX + parseInt(document.getElementById(idTable).offsetLeft) + 40; } } } catwalk_speed3 = (mouseX - (faGaleryWith3 / 2)) / (faGaleryWith3 / 2) * 10; if(catwalk_speed3 > catwalk_speed_limit3) catwalk_speed3 = catwalk_speed_limit3; } function catwalk_out3() { clearInterval(catwalk_shift_interval3); } function catwalk_shift3(idTable) { var actual_speed3 = Math.abs(catwalk_speed3) - 2; if(actual_speed3 < 0) actual_speed3 = 0; if(catwalk_speed3 < 0) actual_speed3 = -1 * actual_speed3; var mytable = document.getElementById(idTable); if(mytable != null) { if(parseInt(mytable.offsetLeft) >= 0 && actual_speed3 < 0) { return; } if(parseInt(mytable.offsetLeft) <= (faGaleryWith3 - mytable.offsetWidth) && actual_speed3 > 0) { return; } mytable.style.left = (parseInt(mytable.offsetLeft) - actual_speed3) + "px"; } } catwalk_shift_interval_consultes3 = 0; function catwalk_over_consultes3(event, idTable) { catwalk_shift_interval_consultes3 = setInterval(function() { catwalk_shift3(idTable); }, 1); } function catwalk_out_consultes() { clearInterval(catwalk_shift_interval_consultes3); } $('#pccatwalkcontainer3').on('mousemove', function(event) { catwalk_move3(event, 'pccatwalkcontainer3', 'pccatwalkleft3', 'pccatwalkright3', 'pccatwalktable3'); }); $('#pccatwalkcontainer3').on('mouseover', function(event) { catwalk_over3(event, 'pccatwalktable3'); }); $('#pccatwalkcontainer3').on('mouseout', function(event) { catwalk_out3(event); }); }(jQuery)); (function ($) { var moduleParams = {"markupMode":"table","autoSwitchDevice":false,"mobileStatus":true,"mobileIsV16":false,"languagesCode":"en","pwaEnabled":false,"isSnapchatiOs":0,"httpServer":"","mobileOn":false,"caisseOn":false,"bookingsOn":false}; // Lazy loading var jQueryUnveil = jQuery().unveil; function lazyLoad() { if (jQueryUnveil) { $("img.lazy").unveil(); } }; $('body').on('ajaxListingProductsLoaded', function () { lazyLoad(); }); $(window).on('load', function () { lazyLoad(); }); // Smooth Scroll marquee if ($('marquee.defilante-smooth').length > 0) { $('marquee.defilante-smooth').on('load', function () { $('marquee.defilante-smooth').marquee().mouseover(function () { $(this).trigger('stop'); }) .mouseout(function () { $(this).trigger('start'); }) .mousemove(function (event) { if ($(this).data('drag') == true) { this.scrollLeft = $(this) .data('scrollX') + ($(this) .data('x') - event.clientX); } }) .mousedown(function (event) { $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft); }) .mouseup(function () { $(this).data('drag', false); }); }); } // https://developers.google.com/recaptcha/docs/display#explicit_render CaptchaCallback = function () { $('.g-recaptcha').each(function () { var $this = $(this); grecaptcha.render(this, {'sitekey': $this.data('sitekey'), 'stoken': $this.data('stoken')}); }); }; /* * RECAPTCHA V2 */ recaptchaV2CurrentIndex = 0; // index du captcha qui est traité // Fonction exécutée par le recaptcha v2 si valide CaptchaV2Submit = function (token) { var $form = $('#recaptcha_' + recaptchaV2CurrentIndex).closest('form'); $form.find('input[name="g-recaptcha-response"]').val(token); // On rempli le champ qui sert de traitement en PHP. $form.submit(); // On renvoi le formulaire après validation } // Fonction exécutée au chargement de la page si le captcha v2 est activé CaptchaV2Callback = function () { // Envoi du formulaire recaptcha v2 $('.g-recaptcha').closest('form').submit(function () { var $form = $(this); recaptchaV2CurrentIndex = $form.find('.g-recaptcha').data('index'); if ($form.find('input[name="g-recaptcha-response"]').val() != '') { return true; // Si captcha validé, tout est OK, on peut envoyer le formulaire } grecaptcha.execute(recaptchaV2CurrentIndex); // Contrôle de captcha. Si c'est OK, CaptchaV2Submit sera appelé et cette même fonction (submit) sera appelée return false; }); } /* * RECAPTCHA V2 - FIN */ //Chargement de la version mobile à la volée en dessous de 768px et chargement de la version PC sur mobile si > 768px //Ne fonctionne que sur PC , le device MObile prend le dessus. //Ne fonctionne pas si la version mobile est à OFF ou en V1 if (moduleParams.autoSwitchDevice && moduleParams.mobileStatus && moduleParams.mobileIsV16 && $.browser.desktop) { function checkWidth() { if ((window.innerWidth < 768 && !moduleParams.mobileOn) || (window.innerWidth >= 768 && moduleParams.mobileOn)) { $(window).unbind('resize'); $.get("/ajax.php?page=switchDevice", function () { }).done(function () { $('HTML').css({ 'background-image': 'url("/images/loading.gif")', 'background-repeat': 'no-repeat', 'background-position': 'center center', 'background-color': 'white!important', 'height': '100%' }); $('BODY').fadeOut('slow'); }).always(function () { setTimeout(function () { location.reload(true); }, 400); }); } } $(window).resize(checkWidth); $(window).trigger('resize'); } if (moduleParams.mobileOn && moduleParams.pwaEnabled) { if ('serviceWorker' in navigator) { navigator.serviceWorker.register('js/service-worker.js') .then(function (registration) { console.log('Registration successful, scope is:', registration.scope); }) .catch(function (error) { console.log('Service worker registration failed, error:', error); }); } } /** * BDC n°16021 - Sessions sur Snapchat iOS * Si l'user agent contient "iPhone OS" et "Snapchat" alors les sessions ne sont pas conservées * (le cookie navigateur générique "session" est remis à 0 mais pas les cookies faits maison). * Donc on crée un cookie fait maison "sa-session" pour stocker le premier session_id créé. * Comme ça si l'utilisateur revient sur le site on récupère ce "sa-session" * en back via $_COOKIE pour récupérer la session */ if (moduleParams.isSnapchatiOs) { function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } if (!getCookie('sa-session')) { setCookie('sa-session', getCookie('session'), 30, moduleParams.httpServer) } } }(jQuery));