/** * PrestaShop Mobile App * * @author Rolige * @copyright Since 2011 Rolige - All Rights Reserved * @license Proprietary and confidential */ rg_psmobileapp.showCustomContent = function () { if (rg_psmobileapp.custom_content) { let divs = document.querySelectorAll(".rg-psmobileapp.custom-content-to-replace"); const node = new DOMParser().parseFromString(rg_psmobileapp.custom_content, 'text/html').body.childNodes[0]; divs.forEach(function (el) { el.replaceWith(node); }); } }; rg_psmobileapp.showCustomContent(); const isMobile = "ontouchstart" in document.documentElement && navigator.userAgent.match( /Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/ ) && window.matchMedia("only screen and (max-width: 760px)").matches; if (isMobile) { rgmoapp_get_app = { setCookie: function (cname, cvalue, exdays) { const d = new Date(); d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); let expires = "expires=" + d.toGMTString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; }, getCookie: function (cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(";"); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == " ") { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } }; $(document).ready(function () { $("#rgmoapp_get_app .ga-close span").on("click", function () { $("#rgmoapp_get_app").addClass("hidden"); rgmoapp_get_app.setCookie("rgmoapp_get_app", 1, 30); }); let get_app = rgmoapp_get_app.getCookie("rgmoapp_get_app"); if (get_app != 1) { $("#rgmoapp_get_app.hidden").removeClass("hidden"); } }); }