A PHP Error was encountered

Severity: Notice

Message: Undefined index: title

Filename: controllers/Docs.php

Line Number: 318

Backtrace:

File: /var/www/vhosts/vuse-es/framework/apps/website/controllers/Docs.php
Line: 318
Function: _error_handler

File: /var/www/vhosts/vuse-es/public_html/index.php
Line: 356
Function: require_once

▷ VUSE España | Marca #1 Global de Vapeo

Cancelar

">

A PHP Error was encountered

Severity: Notice

Message: Undefined index: id

Filename: docs/docs_faqs.php

Line Number: 17

Backtrace:

File: /var/www/vhosts/vuse-es/framework/apps/website/views/docs/docs_faqs.php
Line: 17
Function: _error_handler

File: /var/www/vhosts/vuse-es/framework/apps/website/views/main_page.php
Line: 155
Function: view

File: /var/www/vhosts/vuse-es/framework/apps/website/controllers/Docs.php
Line: 335
Function: view

File: /var/www/vhosts/vuse-es/public_html/index.php
Line: 356
Function: require_once

" role="tablist" aria-multiselectable="true">

A PHP Error was encountered

Severity: Notice

Message: Undefined index: faqs

Filename: docs/docs_faqs.php

Line Number: 21

Backtrace:

File: /var/www/vhosts/vuse-es/framework/apps/website/views/docs/docs_faqs.php
Line: 21
Function: _error_handler

File: /var/www/vhosts/vuse-es/framework/apps/website/views/main_page.php
Line: 155
Function: view

File: /var/www/vhosts/vuse-es/framework/apps/website/controllers/Docs.php
Line: 335
Function: view

File: /var/www/vhosts/vuse-es/public_html/index.php
Line: 356
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: docs/docs_faqs.php

Line Number: 21

Backtrace:

File: /var/www/vhosts/vuse-es/framework/apps/website/views/docs/docs_faqs.php
Line: 21
Function: _error_handler

File: /var/www/vhosts/vuse-es/framework/apps/website/views/main_page.php
Line: 155
Function: view

File: /var/www/vhosts/vuse-es/framework/apps/website/controllers/Docs.php
Line: 335
Function: view

File: /var/www/vhosts/vuse-es/public_html/index.php
Line: 356
Function: require_once

visa mastercard paypal
chatChat
var fnc_cookies_delete = function (c_name) { document.cookie = c_name + "=; max-age=0"; } var fnc_cookies_set = function (c_name, value, exdays) { var expires = ""; if (exdays) { var date = new Date(); date.setTime(date.getTime() + (exdays * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toGMTString(); //console_log('cookie creada correctamente') } document.cookie = c_name + "=" + value + expires + "; path=/;SameSite=none;Secure;"; } var fnc_cookiesSeconds_set = function (c_name, value, seconds) { var expires = ""; if (seconds) { var date = new Date(); date.setTime(date.getTime() + (seconds * 1000)); expires = "; expires=" + date.toGMTString(); //console_log('cookie creada correctamente') } document.cookie = c_name + "=" + value + expires + "; path=/;SameSite=none;Secure"; } var fnc_cookies_get = function(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) {c_end = c_value.length;} c_value = unescape(c_value.substring(c_start,c_end)); } return c_value; } var fnc_gs_cookies_accept_agegate = function() { if ($('#popAgeGate').length > 0) { dataLayer.push({ 'event': 'popAgeGate' }); } } var fnc_checkCookieProDisplayed = function() { if (fnc_cookies_get('OptanonAlertBoxClosed')) $('#cookie-reminder').remove(); else setTimeout(function() { fnc_checkCookieProDisplayed() }, 200); } var fnc_checkBannerCookiePro = function() { if ($('#onetrust-consent-sdk').length < 1) $('#cookie-reminder').remove(); } var fnc_cookies_accept_reminder = function() { fnc_cookies_close_reminder(); fnc_cookies_set('cookies_warning', 1, 365); fnc_cookies_set('cookies_stats', 1, 365); fnc_cookies_set('cookies_adds', 1, 365); $('#cookie-reminder').remove(); fnc_gs_cookies_accept_agegate(); fnc_dlEvent('cookieUpdate'); } var fnc_cookies_reject_reminder = function() { fnc_cookies_close_reminder(); fnc_cookies_set('cookies_warning', 1, 365); fnc_cookies_set('cookies_stats', 0, 365); fnc_cookies_set('cookies_adds', 0, 365); $('#cookie-reminder').remove(); fnc_gs_cookies_accept_agegate(); fnc_dlEvent('cookieUpdate'); } var fnc_cookies_save_preference = function() { fnc_cookies_close_reminder(); $('#modalCookies').modal('hide'); fnc_cookies_set('cookies_warning', 1, 365); if($('#cook_ayr').is(':checked')) fnc_cookies_set('cookies_stats', 1, 365); else fnc_cookies_delete('cookies_stats'); if($('#cook_publi').is(':checked')) fnc_cookies_set('cookies_adds', 1, 365); else fnc_cookies_delete('cookies_adds'); $('#cookie-reminder').remove(); fnc_gs_cookies_accept_agegate(); fnc_dlEvent('cookieUpdate'); } var fnc_cookies_close_reminder = function() { $('#cookie-reminder').removeClass('displayed'); } var fnc_cookies_show_preferences = function() { $('#cook_ayr').prop( "checked", fnc_cookies_get('cookies_stats') ? true : false); $('#cook_publi').prop( "checked", fnc_cookies_get('cookies_adds') ? true : false); fnc_cookies_close_reminder(); $('#modalCookies').modal('show'); } var fnc_cookies_banner_reg_dispositivos = function() { fnc_cookiesSeconds_set('banner_reg_disp_day', 1, 24 * 60 * 60); } $(document).ready(function($){ if ($('#cookie-reminder').length > 0) fnc_checkCookieProDisplayed(); setTimeout(function() { fnc_checkBannerCookiePro(); }, 5000); $('#btn-aviso-cookies-preferencias').click(function(e) { e.preventDefault(); fnc_cookies_show_preferences(); }); $('#btn-aviso-cookies-preferencias-text').click(function(e) { e.preventDefault(); fnc_cookies_show_preferences(); }); $('#btn-editar-cookies-preferencias').click(function(e) { e.preventDefault(); fnc_cookies_show_preferences(); }); $('#btn-cerrar-cookies').click(function(e) { e.preventDefault(); $('#modalCookies').modal('hide'); $('#cookie-reminder').addClass('displayed'); }); $('#modalCookies').on('hidden.bs.modal', function () { $('#cookie-reminder').addClass('displayed'); }); $('#btn-aviso-cookies-aceptar').click(function(e) { e.preventDefault(); fnc_cookies_accept_reminder(); }); $('#btn-aviso-cookies-rechazar').click(function(e) { e.preventDefault(); fnc_cookies_reject_reminder(); }); $('#btn-aviso-cookies-close').click(function(e) { e.preventDefault(); fnc_cookies_close_reminder(); }); $('.js-cookies-save-preferences').click(function(e) { e.preventDefault(); fnc_cookies_save_preference(); }); $('#btn-agegate-young').click(function(e) { e.preventDefault(); $('#popAgeGate .modal-content .copy').empty().html('No puedes acceder a este sitio.
Te redigiremos a Google.'); $('#popAgeGate .modal-content .btns').remove(); $('#popAgeGate .modal-content .copy-warning').remove(); setTimeout(function(){ window.location.href = 'https://www.google.com'; }, 15000) }); $('#btn-agegate-old').click(function(e) { e.preventDefault(); $('.no-age-gate-visible').show(); //window.scrollTo(0,0); $('body').removeClass('no_scroll'); $('#popAgeGate').removeClass('d-block'); $('#popAgeGate').modal('hide'); fnc_cookies_set('age_gate', 1, 365); if ($('#hero_home_carrusel').length > 0) crear_homeHeroSlider(); fnc_launchPopupHome(); }); }); var _semPopCesta = false; var fnc_popup_cesta_add_minus = function(e) { if (_semPopCesta) return; _semPopCesta = true; actual_amount = $(e).attr('quantity') + $(e).hasClass('minus-button') ? -1 : 1; fnc_ajax_send_data( '/ws/micesta_modificar_lineitem', { lineitem : $(e).attr('lineId'), amount : $(e).hasClass('minus-button') ? -1 : 1 }, 'json', false, true, function(data) { fnc_dlUpdateCart(data.updated, actual_amount); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (!data.popup_skin || (data.popup_skin == '')) { $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); $('#modalSkin').on('hide.bs.modal', function () { fnc_set_waiting_layout(true, true); window.location.reload(true); }); } _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_popup_cesta_remove = function(e) { if (_semPopCesta) return; _semPopCesta = true; fnc_ajax_send_data( '/ws/micesta_eliminar_lineitem', { lineitem : $(e).attr('lineId') }, 'json', false, true, function(data) { fnc_dlUpdateCart(data.updated, data.quantity); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_popup_cesta_remove_kit_item = function(e) { if (_semPopCesta) return; _semPopCesta = true; fnc_ajax_send_data( '/ws/micesta_eliminar_vusegokit', { lineitem : $(e).attr('lineId') }, 'json', false, true, function(data) { fnc_dlUpdateCart(data.updated, data.quantity); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_popup_cesta_remove_kit_pro_one_item = function(e) { if (_semPopCesta) return; _semPopCesta = true; fnc_ajax_send_data( '/ws/micesta_eliminar_vuseprooneboxkit', { lineitem : $(e).attr('lineId') }, 'json', false, true, function(data) { fnc_dlUpdateCart(data.updated, data.quantity); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_popup_cesta_suscripcion_add_minus = function(e) { if (_semPopCesta) return; _semPopCesta = true; actual_amount = $(e).attr('quantity'); fnc_ajax_send_data( '/ws/micesta_modificar_item_suscripcion', { item : $(e).attr('itemId'), amount : $(e).hasClass('minus-button') ? -1 : 1 }, 'json', false, true, function(data) { //fnc_dlUpdateCart(data.updated, actual_amount); //fnc_set_waiting_layout(true, true); //window.location.reload(true); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_popup_cesta_suscripcion_remove = function(e) { if (_semPopCesta) return; _semPopCesta = true; actual_amount = $(e).attr('quantity'); fnc_ajax_send_data( '/ws/micesta_eliminar_item_suscripcion', { item : $(e).attr('itemId') }, 'json', false, true, function(data) { //fnc_dlUpdateCart(data.updated, actual_amount); //fnc_set_waiting_layout(true, true); //window.location.reload(true); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); _semPopCesta = false; }, function(e, t) { _semPopCesta = false; }); } var fnc_mostrar_popup_skin_by_product = function(variant_id) { fnc_message_back_modal(''); fnc_ajax_send_data('/ws/micesta_mostrar_popup_skin_product', { variant : variant_id }, 'json', false, false, function(data) { if (data.popup_skin == '') { location.reload(true); } else { $('.modal').modal('hide'); $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); } }, function(e, t) { }); } $('.detalles').click(function(e) { e.preventDefault(); if($(this).hasClass("collapsed")){ $(this).find('img').attr("src","https://stg-vuse-es.devogv.com/img/sections/tienda-online/engraves/plus.png"); }else{ $(this).find('img').attr("src","https://stg-vuse-es.devogv.com/img/sections/tienda-online/engraves/minus.png"); } }); var _productAddMinus_Sem = false; var _addItem_Sem = false; var _addItem_GoCheckout = false; var _addItem_ShowCart = true; var _cBundleGo = false; var _cBundleGoUnits = 0; var _cBundleGoMax = 5; var _cBundleGoImgs = ''; var _discover_vuse_slider_deslite_epen = null; var fnc_create_discover_vuse_slider_deslite_epen = function(){ if (_discover_vuse_slider_deslite_epen) return; _discover_vuse_slider_deslite_epen = true; $('.carac-cambio').slick({ infinite: false, arrows: false, dots: false, speed: 500, autoplay: false, autoplaySpeed: 3000, slidesToShow: 4, slidesToScroll: 1, nextArrow: '
siguiente
', prevArrow: '
previo
', responsive: [ { breakpoint: 1200, settings: { infinite: false, arrows: true, dots: true, speed: 500, autoplay: false, autoplaySpeed: 3000, slidesToShow: 3, slidesToScroll: 1, } }, { breakpoint: 992, settings: { infinite: false, arrows: true, dots: true, speed: 500, autoplay: false, autoplaySpeed: 3000, slidesToShow: 2, slidesToScroll: 2, } }, { breakpoint: 768, settings: { infinite: false, arrows: true, dots: true, speed: 500, autoplay: false, autoplaySpeed: 3000, slidesToShow: 1, slidesToScroll: 1, } } ] }); } function fnc_cambiarCantidadBundleGo(variant, quantity) { if (_cBundleGo) return; _cBundleGo = true; let e = $('.js-bundle-glo-caja-producto[data-variant="'+variant+'"]'); let old_quantity = parseInt(e.data('quantity')); let new_quantity = old_quantity + quantity; if ((new_quantity > 0) && (new_quantity <= _cBundleGoMax) && (_cBundleGoUnits + quantity <= _cBundleGoMax)) { e.data('quantity', new_quantity); e.find('.js-quantity').val(new_quantity); e.removeClass('d-none').addClass('d-flex'); } _cBundleGo = false; fnc_checkEstadoBundleGo(); } function fnc_imagenesBundleGo() { let imgs = ''; if (_cBundleGoUnits < 1) { imgs = _cBundleGoImgs; } else { let $items = $('.js-bundle-go-caja-precio').find('.js-bundle-glo-caja-producto'); $items.each(function() { let q = parseInt($(this).data('quantity')); for (var i = 0 ; i < q ; i++) imgs += 'dispositivo desechable'; }); } $('.js-bundle-go-imagenes').empty().html(imgs); } function fnc_checkEstadoBundleGo() { // buscar todos los items del bundle let $items = $('.js-bundle-go-caja-precio').find('.js-bundle-glo-caja-producto'); _cBundleGoUnits = 0; let precio = 0; let oldprice = 0; $items.each(function() { let q = parseInt($(this).data('quantity')); let p = parseFloat($(this).data('price')) * q; let p2 = parseFloat($(this).data('oldprice')) * q; precio += p; oldprice += p2; _cBundleGoUnits += q; if (q < 1) $(this).removeClass('d-flex').addClass('d-none'); else $(this).removeClass('d-none').addClass('d-flex'); }); $('.js-bundle-go-selected-price').empty().html(precio.toFixed(2)+'€'); $('.js-bundle-go-selected-discount').empty().html(oldprice.toFixed(2)+'€'); if (_cBundleGoUnits > 0) $('.js-bundle-go-precio').removeClass('invisible'); else $('.js-bundle-go-precio').addClass('invisible'); fnc_imagenesBundleGo(); } function fnc_agregarBundleGoACarrito() { if (_cBundleGoUnits != _cBundleGoMax) { fnc_show_message('Aviso', 'Debes seleccionar ' + _cBundleGoMax + ' sabores para completar el Kit.', false); return; } if (_addItem_Sem) return; _addItem_Sem = true; _addItem_GoCheckout = $('.js-bundle-go-add-basket').data('gocheckout') == '1' ? true : false; _addItem_ShowCart = $('.js-bundle-go-add-basket').data('showcart') == '1' ? true : false; let variants = ''; let quantities = ''; let $items = $('.js-bundle-go-caja-precio').find('.js-bundle-glo-caja-producto'); $items.each(function() { if ($(this).data('quantity') != '0') { quantities += '|' + $(this).data('quantity'); variants += '|' + $(this).data('variant'); } }); var data = { 'variant' : variants.slice(1), 'quantity' : quantities.slice(1) }; fnc_ajax_send_data( '/ws/micesta_agregar_bundle_go_items', data, 'json', $('.js-bundle-go-add-basket'), $('.js-bundle-go-add-basket').data('gocheckout') == '1', function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); } function fnc_mostrarPopupFichaProductoPLP(e) { $('#modal-ficha-completa .modal-body').empty(); $('.js-id-' + $(e).attr('producto')).appendTo('#modal-ficha-completa .modal-body'); $('#modal-ficha-completa .modal-body').attr('producto', $(e).attr('producto')); $('#modal-ficha-completa').modal('show'); } function fnc_ocultarPopupFichaProductoPLP() { $('.js-id-' + $('#modal-ficha-completa .modal-body').attr('producto')).appendTo('.js-caja-productos-plp'); $('#modal-ficha-completa .modal-body').empty(); $('#modal-ficha-completa .modal-body').attr('producto', ''); } $(document).ready(function($){ if ($('.js-velotrial-showpopup').length > 0) { $('.js-velotrial-showpopup').click(function(e) { e.preventDefault(); $('#modal-velo-trial').modal('show'); }); } fnc_create_discover_vuse_slider_deslite_epen(); $('.js-select-generic-kit-vuse-go').click(function(e) { e.preventDefault(); $('.js-btn-kit-vusego-generic-selected').attr('href', $(this).attr('endpoint')); $('.js-select-generic-kit-vuse-go').find('.check').addClass('d-none'); $('.js-select-generic-kit-vuse-go').addClass('desactivado'); $(this).find('.check').removeClass('d-none'); $(this).removeClass('desactivado'); $('.js-btn-kit-vusego-generic-selected').removeClass('disabled'); }); $('.js-enlace-leer-mas').click(function(e) { e.preventDefault(); $(this).parent().siblings('.js-read-more-content').removeClass('d-none'); $(this).parent().siblings('.js-read-less').removeClass('d-none'); $(this).parent().addClass('d-none'); $(this).parents('.hero-banner-plp').find('.cont-img img').css({'max-height' : 'none','bottom' : '0px','margin' : 'auto'}); }); $('.js-enlace-leer-menos').click(function(e) { e.preventDefault(); $(this).parent().siblings('.js-read-more-content').addClass('d-none'); $(this).parent().siblings('.js-read-more').removeClass('d-none'); $(this).parent().addClass('d-none'); $(this).parents('.hero-banner-plp').find('.cont-img img').css({'max-height' : '350px','bottom' : 'inherit','margin' : 'inherit'}); }); $('.js-product-ab-mas').click(function(e) { e.preventDefault(); fnc_mostrarPopupFichaProductoPLP(this); }); $('#modal-ficha-completa').on('hidden.bs.modal', function () { fnc_ocultarPopupFichaProductoPLP(); }); /*$('.js-filtro-tipo-dispositivo').click(function(e) { e.preventDefault(); $('.js-filtro-tipo-dispo').addClass('d-none'); $(this).parent().toggleClass('active'); $('.js-filtro-tipo-dispositivo').each(function() { if ($(this).parent().hasClass('active')) { $('.js-filtro-'+$(this).data('filter')).removeClass('d-none'); } }); if ($('.container-filter-btn.active').length < 1) $('.js-filtro-tipo-dispo').removeClass('d-none'); });*/ // _cBundleGoImgs = $('.js-bundle-go-imagenes').html(); if ($('.ficha-producto.vuse-go.kit').length > 0) _cBundleGoMax = parseInt($('.ficha-producto.vuse-go.kit').data('maxitems')); $('.js-bundle-go-select').click(function(e) { e.preventDefault(); $('.js-bundle-go-select').removeClass('selected'); $(this).addClass('selected'); show_intensity($(this).data("sabor"), $(this).data("option")) $('.js-bundle-go-add-other').data('variant', $(this).data('variant')); $('.js-bundle-go-add-other').removeClass('invisible'); }); function show_intensity(sabor, option){ let amount = 0; $('.js-selector-intensidades').removeClass("d-none") $('.js-bundle-go-select').each(function() { if ($(this).data("sabor") == sabor){ amount++; } }); $('.contenedor-intensidades').addClass("d-none") $('.contenedor-intensidades').children().removeClass("d-none").children().removeClass("selected") if(amount == 1){ $('.contenedor-intensidades').children().addClass("d-none") $('.contenedor-intensidades').children().each( function(){ if($(this).data("option") == option){ $(this).removeClass("d-none") $(this).children().addClass("selected"); } }); }else{ $('.js-select-intensity').each(function(){ if($(this).data("option") == option){ $(this).addClass("selected"); } }) } $('.contenedor-intensidades').removeClass("d-none") } $('.js-bundle-go-select-v2').click(function(e) { e.preventDefault(); $('.js-bundle-go-select-v2').removeClass('selected'); $(this).addClass('selected'); $('.js-bundle-go-add-other').data('variant', $(this).data('variant')); $('.js-bundle-go-add-other').removeClass('invisible'); }); $('.js-select-intensity-v2').click(function(e) { $('.js-select-intensity-v2').removeClass('selected') $(this).addClass('selected') show_intensity_v2($(this).data('option')) }) function show_intensity_v2(option){ console.log(option) let amount = 0; $('.js-bundle-go-select-v2').parent().addClass('d-none') $('.js-bundle-go-select-v2').each(function() { console.log($(this).data("option")) if ($(this).data("option") == option){ $(this).parent().removeClass('d-none') } }); } $('.js-select-intensity').on("click", function() { let option = $(this).data("option") let sabor = $('.js-bundle-go-select.selected').removeClass("selected").data("sabor") $('.go-' + sabor).each(function(){ $(this).parent().addClass("d-none") if($(this).data("option") == option){ $(this).click().parent().removeClass("d-none"); } }) }) $('.js-bundle-go-add-other .btn-outline-orange').click(function(e) { e.preventDefault(); $('.js-bundle-go-add-other a.new-flavour').empty().html('Añadir otro SABOR'); if (_cBundleGoUnits >= _cBundleGoMax) { fnc_show_message('Aviso', 'Has alcanzado el límite de ' + _cBundleGoMax + ' sabores para completar el Kit.', false); return; } fnc_cambiarCantidadBundleGo($('.js-bundle-go-add-other').data('variant'), 1); }); $('.js-bungle-go-add-minus').click(function(e) { e.preventDefault(); fnc_cambiarCantidadBundleGo($(this).data('variant'), parseInt($(this).data('quantity'))); }); $('.js-bundle-go-eliminar-producto').click(function(e) { e.preventDefault(); let elem = $('.js-bundle-glo-caja-producto[data-variant="'+$(this).data('variant')+'"]'); elem.data('quantity', 0); elem.find('.js-quantity').val(0); elem.removeClass('d-flex').addClass('d-none'); fnc_checkEstadoBundleGo(); }); $('.js-bundle-go-add-basket').click(function(e) { e.preventDefault(); fnc_agregarBundleGoACarrito(); }); $('.container-comments .review-image').each(function () { fnc_corrigeOrientacion(this); }); $('.js-add-minus').click(function(e){ e.preventDefault(); if (_productAddMinus_Sem) return; _productAddMinus_Sem = true; console.log($(".js-id-" + $(this).data('product')), $(".js-id-" + $(this).data('product')+ " .js-quantity")) var quantity = parseInt($(".js-id-" + $(this).data('product') + " .js-quantity").val()) + ($(this).hasClass('minus-button') ? -1 : 1); if ((quantity > 0) && (quantity <= parseInt($(".js-id-" + $(this).data('product') + " .js-quantity").data('maxitems')))) { //console_log('entro 4'); $(".js-id-" + $(this).data('product') + " .js-quantity").val(quantity); $(".js-id-" + $(this).data('product') + " .js-add-basket").data('quantity', quantity); } _productAddMinus_Sem = false; }); $('.js-cesta-subscription-remove').click(function(e) { e.preventDefault(); fnc_ajax_send_data( '/ws/micesta_eliminar_item_suscripcion', { item : $(this).closest('.js-resumen-subscription-item').attr('itemId') }, 'json', false, true, function(data) { fnc_set_waiting_layout(true, true); window.location.reload(true); }, function(e, t) { }); }); $('.js-cesta-subscription-add-minus').click(function(e) { e.preventDefault(); actual_amount = $(this).closest('.js-resumen-subscription-item').attr('quantity'); console.log(actual_amount) fnc_ajax_send_data( '/ws/micesta_modificar_item_suscripcion', { item : $(this).closest('.js-resumen-subscription-item').attr('itemId'), amount : $(this).hasClass('minus-button') ? -1 : 1 }, 'json', false, true, function(data) { //fnc_dlUpdateCart(data.updated, actual_amount); fnc_set_waiting_layout(true, true); window.location.reload(true); }, function(e, t) { }); }); $('.opcion-compra').click(function(e) { $(".js-id-" + $(this).data('product') + " .opcion-compra").removeClass('selected'); $(".js-id-" + $(this).data('product') + " .opcion-compra").attr('aria-selected', 'false'); $(this).addClass('selected'); $(this).attr('aria-selected', 'true'); $(".js-id-" + $(this).data('product') + " .js-add-basket").data('purchase', $(this).data('purchase')); }); // opcion pulsada $('.js-product-option').click(function(e) { if ($(this).data('desactualizado') == 1) { $(".js-id-" + $(this).data('product') + " .js-desactualizado").removeClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-no-desactualizado").addClass('d-none'); } else { $(".js-id-" + $(this).data('product') + " .js-desactualizado").addClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-no-desactualizado").removeClass('d-none'); } if ($(this).hasClass('disabled')) { $(".js-id-" + $(this).data('product') + " .js-grupo-cantidad").addClass('d-none-important'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-disponible").addClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").removeClass('d-none'); } else { $(".js-id-" + $(this).data('product') + " .js-grupo-cantidad").removeClass('d-none-important'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-disponible").removeClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").addClass('d-none'); } if ($(this).hasClass('disabled')) { $(".js-id-" + $(this).data('product') + " .js-add-basket").hide(); $(".js-id-" + $(this).data('product') + " .js-grupo-cantidad").addClass('d-none-important'); $(".js-id-" + $(this).data('product') + " .js-add-basket-disabled").removeClass('d-none'); //return; } else { $(this).siblings().removeClass('checked'); $(this).removeClass('checked'); $(this).addClass('checked'); $(".js-id-" + $(this).data('product') + " .js-add-basket-disabled").addClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-grupo-cantidad").removeClass('d-none-important'); $(".js-id-" + $(this).data('product') + " .js-add-basket").show(); } if ($(this).data('image').includes('sabek')) $('.slider').slick('slickGoTo', parseInt($('.slider img[data-imgrel="'+$(this).data('image').replace('.png', '-shard.png')+'"]').data('position'))); else $('.slider').slick('slickGoTo', parseInt($('.slider img[data-imgrel="'+$(this).data('image')+'"]').data('position'))); $('.js-id-' + $(this).data('product') + ' .js-imagen-sticky').attr('src', $(this).data('image')); if ($(this).data('collection') == 'dispositivos') { // opcion de color $(".js-id-" + $(this).data('product') + " .js-selected-color").removeClass (function (index, className) { return (className.match (/(^|\s)device-\S+/g) || []).join(' '); }); $(".js-id-" + $(this).data('product') + " .js-selected-color").addClass('device-radio device-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-selected-color-name").empty().html($(this).data('color')); } if ($(this).data('collection') == 'personalizacion') { // opcion de color skin $(".js-id-" + $(this).data('product') + " .js-selected-color").removeClass (function (index, className) { return (className.match (/(^|\s)skin-\S+/g) || []).join(' '); }); $(".js-id-" + $(this).data('product') + " .js-selected-color").addClass('skin-radio skin-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-selected-color-name").empty().html($(this).data('color')); } if (($(this).data('collection') == 'recargas') || (($(this).data('collection') == 'dispositivos') && ($(this).hasClass('caja-recarga')))) { // opcion de intensidad $(".js-id-" + $(this).data('product') + " .js-selected-refill").removeClass (function (index, className) { return (className.match (/(^|\s)refill-\S+/g) || []).join(' '); }); if($(this).attr('title') !== 'Agotado'){ $(".js-id-" + $(this).data('product') + " .js-selected-refill").addClass('refill-radio refill-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-product-option").removeClass('selected'); $(".js-id-" + $(this).data('product') + " .js-product-option").attr('aria-selected', 'false'); $(".js-id-" + $(this).data('product') + ' .js-product-option[data-variant="' +$(this).data('variant')+ '"]').addClass('selected'); $(".js-id-" + $(this).data('product') + ' .js-product-option[data-variant="' +$(this).data('variant')+ '"]').attr('aria-selected', 'true'); } else{ $(".js-id-" + $(this).data('product') + " .js-product-option").removeClass('selected'); //$("."+ $(this).attr('device') +"-" + $(this).data('product')).css('background-color', 'transparent'); } } if ($(this).data('option') != '0') $('.js-mostrarBannerVeloTrial').removeClass('d-none'); else $('.js-mostrarBannerVeloTrial').addClass('d-none'); var priceshowed = (($(this).data('oldprice') != '') && ($(this).data('oldprice') != undefined) && ($(this).data('oldprice') != $(this).data('price'))) ? (''+$(this).data('oldprice')+'€'+ $(this).data('price')+'€') : ($(this).data('price')+'€'); $(".js-id-" + $(this).data('product') + " .js-selected-img").attr('src', $(this).data('image')); $(".js-id-" + $(this).data('product') + " .js-selected-link").attr('href', $(this).data('link')); $(".js-id-" + $(this).data('product') + " .js-selected-price").empty().html(priceshowed); $(".js-id-" + $(this).data('product') + " .js-add-basket").data('variant', $(this).data('variant')); $(".js-id-" + $(this).data('product') + ".caja-elemento-desktop").removeClass('st-normal').addClass('st-selected'); $(".js-id-" + $(this).data('product') + ".caja-elemento-mobile").removeClass('st-normal').addClass('st-selected'); }); $('.js-product-option-velo').click(function(e) { //console.log(1); if ($(this).hasClass('disabled')) { $(".js-id-" + $(this).data('product') + " .js-boton-comprar-disponible").addClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").removeClass('d-none'); } else { $(".js-id-" + $(this).data('product') + " .js-boton-comprar-disponible").removeClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").addClass('d-none'); } if ($(this).hasClass('disabled')) { $(".js-id-" + $(this).data('product') + " .js-add-basket-velo").hide(); $(".js-id-" + $(this).data('product') + " .js-add-basket-disabled").removeClass('d-none'); //return; } else { $(this).siblings().removeClass('checked'); $(this).removeClass('checked'); $(this).addClass('checked'); $(".js-id-" + $(this).data('product') + " .js-add-basket-disabled").addClass('d-none'); $(".js-id-" + $(this).data('product') + " .js-add-basket-velo").show(); } $('.js-id-' + $(this).data('product') + ' .js-sticky-sabor').empty().html('Sabor ' + $(this).data('color')); $(".js-id-" + $(this).data('product') + " .js-add-basket-velo").data('variant', $(this).data('variant')); $(".js-id-" + $(this).data('product') + ".caja-elemento-desktop").removeClass('st-normal').addClass('st-selected'); $(".js-id-" + $(this).data('product') + ".caja-elemento-mobile").removeClass('st-normal').addClass('st-selected'); $('.js-id-' + $(this).data('product') + ' .img-producto-gallery-velo_trial[data-position="0"]').attr('src', $(this).data('image')); //console.log($('.js-id-' + $(this).data('product') + ' .img-producto-gallery-velo_trial[data-position="0"]')); console.log($(this).data['image']); }); // opcion pulsada $('.js-product-option-recomendados').click(function(e) { $(this).parent().find('.js-product-option-recomendados').removeClass('selected'); $(this).addClass('selected'); if ($(this).hasClass('disabled')) { $(".js-recomendados-id-" + $(this).data('product') + " .js-grupo-cantidad").addClass('d-none-important'); $(".js-recomendados-id-" + $(this).data('product') + " .js-boton-comprar-disponible").addClass('d-none'); $(".js-recomendados-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").removeClass('d-none'); } else { $(".js-recomendados-id-" + $(this).data('product') + " .js-grupo-cantidad").removeClass('d-none-important'); $(".js-recomendados-id-" + $(this).data('product') + " .js-boton-comprar-disponible").removeClass('d-none'); $(".js-recomendados-id-" + $(this).data('product') + " .js-boton-comprar-nodisponible").addClass('d-none'); } /*if ($(this).data('collection') == 'dispositivos') { // opcion de color $(".js-id-" + $(this).data('product') + " .js-selected-color").removeClass (function (index, className) { return (className.match (/(^|\s)device-\S+/g) || []).join(' '); }); $(".js-id-" + $(this).data('product') + " .js-selected-color").addClass('device-radio device-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-selected-color-name").empty().html($(this).data('color')); } if ($(this).data('collection') == 'personalizacion') { // opcion de color skin $(".js-id-" + $(this).data('product') + " .js-selected-color").removeClass (function (index, className) { return (className.match (/(^|\s)skin-\S+/g) || []).join(' '); }); $(".js-id-" + $(this).data('product') + " .js-selected-color").addClass('skin-radio skin-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-selected-color-name").empty().html($(this).data('color')); } if (($(this).data('collection') == 'recargas') || (($(this).data('collection') == 'dispositivos') && ($(this).hasClass('caja-recarga')))) { // opcion de intensidad $(".js-id-" + $(this).data('product') + " .js-selected-refill").removeClass (function (index, className) { return (className.match (/(^|\s)refill-\S+/g) || []).join(' '); }); if($(this).attr('title') !== 'Agotado'){ $(".js-id-" + $(this).data('product') + " .js-selected-refill").addClass('refill-radio refill-'+$(this).data('option')); $(".js-id-" + $(this).data('product') + " .js-product-option").removeClass('selected'); $(".js-id-" + $(this).data('product') + ' .js-product-option[data-variant="' +$(this).data('variant')+ '"]').addClass('selected'); } else{ $(".js-id-" + $(this).data('product') + " .js-product-option").removeClass('selected'); } }*/ var priceshowed = (($(this).data('oldprice') != '') && ($(this).data('oldprice') != undefined) && ($(this).data('oldprice') != $(this).data('price')) ? ''+$(this).data('oldprice')+'€' : '') + $(this).data('price')+'€'; $(".js-recomendados-id-" + $(this).data('product') + " .js-selected-img").attr('src', $(this).data('image')); $(".js-recomendados-id-" + $(this).data('product') + " .js-selected-img-png").attr('srcset', $(this).data('image')); $(".js-recomendados-id-" + $(this).data('product') + " .js-selected-img-webp").attr('srcset', $(this).data('imagewebp')); $(".js-recomendados-id-" + $(this).data('product') + " .js-selected-link").attr('href', $(this).data('link')); $(".js-recomendados-id-" + $(this).data('product') + " .js-selected-price").empty().html(priceshowed); $(".js-recomendados-id-" + $(this).data('product') + " .js-add-basket").data('variant', $(this).data('variant')); $(".js-recomendados-id-" + $(this).data('product') + ".caja-elemento-desktop").removeClass('st-normal').addClass('st-selected'); $(".js-recomendados-id-" + $(this).data('product') + ".caja-elemento-mobile").removeClass('st-normal').addClass('st-selected'); }); // agregar al carrito $('.js-add-basket').click(function(e) { e.preventDefault(); if (parseInt($(this).data('quantity')) < 1) return; if (_addItem_Sem) return; _addItem_Sem = true; _addItem_GoCheckout = $(this).data('gocheckout') == '1' ? true : false; _addItem_ShowCart = $(this).data('showcart') == '1' ? true : false; var data = { 'variant' : $(this).data('variant'), 'quantity' : $(this).data('quantity') }; var endpoint = $(this).data('purchase') == 'subscription' ? '/ws/micesta_agregar_item_subscription' : '/ws/micesta_agregar_item'; fnc_ajax_send_data( endpoint, data, 'json', $(this), $(this).data('gocheckout') == '1', function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if ($('#modal-ficha-completa').length > 0) $('#modal-ficha-completa').modal('hide'); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); if (!data.popup_skin || (data.popup_skin == '')) { if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); } else { $('.modal').modal('hide'); $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); $('#modalSkin').on('hide.bs.modal', function () { if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); }); } _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); }); function addItemSub(quantity, variant, thiss){ e.preventDefault(); if (parseInt(quantity) < 1) return; if (_addItem_Sem) return; _addItem_Sem = true; _addItem_ShowCart = true; var data = { 'variant' : variant, 'quantity' : quantity }; fnc_ajax_send_data( '/ws/micesta_agregar_item_subscription', data, 'json', thiss, false, function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if ($('#modal-ficha-completa').length > 0) $('#modal-ficha-completa').modal('hide'); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); if (!data.popup_skin || (data.popup_skin == '')) { if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); } else { $('.modal').modal('hide'); $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); $('#modalSkin').on('hide.bs.modal', function () { if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); }); } _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); } // agregar al carrito $('.js-add-basket-velo').click(function(e) { e.preventDefault(); if ($(this).data('subscription') == '') addBasketVeloTrial(this); else addBasketVeloTrialSus(this); }); function addBasketVeloTrial(e) { if (_addItem_Sem) return; _addItem_Sem = true; _addItem_GoCheckout = $(e).data('gocheckout') == '1' ? true : false; _addItem_ShowCart = $(e).data('showcart') == '1' ? true : false; var data = { 'variant' : $(e).data('variant'), 'quantity' : 1 }; var endpoint = '/ws/micesta_agregar_item'; fnc_ajax_send_data( endpoint, data, 'json', $(e), $(e).data('gocheckout') == '1', function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); $('.sticky-comprar').remove(); $('.sticky-comprar-mobile').remove(); $('.js-add-basket-velo').remove(); $('.js-add-basket-added').removeClass('d-none'); if (_addItem_GoCheckout) { window.location.href = '/mi-cesta'; return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (_addItem_ShowCart) fnc_mostrarCesta(); _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); } function addBasketVeloTrialSus(e) { if (_addItem_Sem) return; _addItem_Sem = true; _addItem_GoCheckout = false; _addItem_ShowCart = false; var data = { 'variant' : $(e).data('variant'), 'subscription' : $(e).data('subscription'), }; var endpoint = '/ws/micesta_agregar_velo_mini_trial_subscription'; fnc_ajax_send_data( endpoint, data, 'json', $(e), false, function(data) { $('.sticky-comprar').remove(); $('.sticky-comprar-mobile').remove(); $('.js-add-basket-velo').remove(); $('.js-add-basket-added').removeClass('d-none'); //window.location.href = '/mi-cuenta/suscripciones'; _addItem_Sem = false; fnc_show_message('¡Enhorabuena!', 'Hemos añadido tu muestra gratuita de VELO al siguiente envío de tu suscripción.'); }, function(e, t) { _addItem_Sem = false; } ); } /*$('.js-discount-code-apply').click(function(e) { e.preventDefault(); fnc_message_back_modal(''); fnc_ajax_send_form('form-page-checkout-validate-code', '/ws/micesta_aplicar_codigo', 'json', $('#form-page-checkout-validate-code-send'), true, function(data) { location.reload(true); }, function(e, t) { }); }); $('.js-discount-code-remove').click(function(e) { e.preventDefault(); fnc_message_back_modal(''); fnc_ajax_send_data('/ws/micesta_quitar_codigo', {}, 'json', $(this), false, function(data) { location.reload(true); }, function(e, t) { }); });*/ $('.js-titular-faqs').click(function (e) { let activo = $(this).hasClass('active') ? true : false; $('.opn').addClass('active'); $('.cls').removeClass('active'); $('.js-titular-faqs').removeClass('active'); $('.js-contenido-faqs').removeClass('active'); if (!activo) { $(this).addClass('active'); $(this).find('.opn').removeClass('active'); $(this).find('.cls').addClass('active'); $(this).siblings('.js-contenido-faqs').addClass('active'); } }); $('.js-bundle-reload-dispositivo').click(function(e) { $('.js-bundle-reload-dispositivo').removeClass('selected'); $(this).addClass('selected'); $('.js-bundle-reload-add-cart').data('device', $(this).data('option')); $('.elegir-recarga-box-disabled').remove(); }); $('.js-bundle-reload-recarga').click(function(e) { if ($(this).hasClass('disabled')) return; $('.js-bundle-reload-recarga').removeClass('selected'); $(this).addClass('selected'); $('.js-bundle-reload-add-cart').data('refill', $(this).data('option')); $('.js-bundle-paso3').css('visibility', 'visible'); $('.js-bundle-reload-add-cart').removeClass('disabled'); }); $('.xrecargas1').click(function(e) { $('.xrecargas1').removeClass('disabled selected'); $('.xrecargas1[data-option="'+$(this).data('option')+'"]').addClass('selected'); $('.xrecargas2').removeClass('disabled selected'); $('.xrecargas2[data-option="'+$(this).data('option')+'"]').addClass('selected'); $('.js-imagen-kit-dispositivo').attr('src', $(this).data('fondo')); $('.js-bundle-add-cart').data('device-color', $(this).data('option')); $('.js-bundle-paso2 .elegir-recarga-box-disabled').css('visibility', 'hidden'); fnc_check_bundle_complete(); }); $('.xrecargas2').click(function(e) { $('.xrecargas1').removeClass('disabled selected'); $('.xrecargas1[data-option="'+$(this).data('option')+'"]').addClass('selected'); $('.xrecargas2').removeClass('disabled selected'); $('.xrecargas2[data-option="'+$(this).data('option')+'"]').addClass('selected'); $('.js-imagen-kit-dispositivo').attr('src', $(this).data('fondo')); $('.js-bundle-add-cart').data('device-color', $(this).data('option')); fnc_check_bundle_complete(); }); $('.js-bundle-sabor-select').click(function(e) { $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .device-radio-kits').removeClass('disabled selected'); $(this).addClass('selected'); $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .js-bundle-intensity').show(); $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .refill-option-box img').removeClass('selected'); $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .refill-option-box').hide(); $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .js-bundle-option-'+$(this).data('option')).show(); $('.js-imagen-kit-fondo-'+$(this).data('pack-recargas')).attr('src', $(this).data('fondo')); $('.js-bundle-add-cart').data('refill-'+$(this).data('pack-recargas')+'-variant', ''); fnc_check_bundle_complete(); }); $('.refill-option-box').click(function(e) { if ($(this).hasClass('disabled')) return; $('.js-pack-recargas-'+$(this).data('pack-recargas')+' .refill-option-box img').removeClass('selected'); $(this).find('img').addClass('selected'); //$('.js-imagen-kit-fondo-'+$(this).data('numrecargas')).attr('src', $(this).data('fondo')); $('.js-bundle-add-cart').data('refill-'+$(this).data('numrecargas')+'-variant', $(this).data('variant')); $('.js-bundle-paso3').css('visibility', 'visible'); fnc_check_bundle_complete(); }); $('#agregar-otro-pack-bundle').click(function(e) { e.preventDefault(); $(this).addClass('d-none').removeClass('d-flex'); $('.js-bundle-paso3-1').removeClass('d-none'); $('.div-xrecargas1').hide(); $('.div-xrecargas2').show(); $('.js-selected-price').empty().html($('.js-selected-price').attr('preciox2')); $('.js-bundle-add-cart').data('refill-2-variant', ''); fnc_check_bundle_complete(); }); $('.js-quitar-recarga').click(function(e) { e.preventDefault(); $('#agregar-otro-pack-bundle').removeClass('d-none').addClass('d-flex'); $('.js-bundle-paso3-1').addClass('d-none'); $('.div-xrecargas2').hide(); $('.div-xrecargas1').show(); $('.js-pack-recargas-2 .js-bundle-intensity').hide(); $('.js-pack-recargas-2 .device-radio-kits').removeClass('disabled selected'); $('.js-pack-recargas-2 .refill-option-box img').removeClass('selected'); $('.js-selected-price').empty().html($('.js-selected-price').attr('preciox1')); $('.js-bundle-add-cart').data('refill-2-variant', '-1'); $('.js-imagen-kit-fondo-2').attr('src', $('.js-imagenes-fondo').attr('srcpath')); }); $('.js-bundle-reload-add-cart').click(function(e) { e.preventDefault(); fnc_check_bundle_complete(); if ($(this).hasClass('disabled')) return; if (_addItem_Sem) return; _addItem_Sem = true; var data = { 'bundle_type' : $(this).data('device-bundle'), 'bundle' : $(this).data('bundle-type'), 'dispositivo' : $(this).data('device'), 'recarga' : $(this).data('refill') }; fnc_ajax_send_data( '/ws/micesta_agregar_bundle_reload_item', data, 'json', $(this), false, function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); }); $('.js-bundle-add-cart').click(function(e) { e.preventDefault(); fnc_check_bundle_complete(); if ($(this).hasClass('disabled')) return; if (_addItem_Sem) return; _addItem_Sem = true; var data = { 'bundle_type' : $(this).data('device-bundle'), 'bundle' : $(this).data('bundle-type'), 'color' : $(this).data('device-color'), 'recarga1' : $(this).data('refill-1-variant'), 'recarga2' : $(this).data('refill-2-variant') }; console.log(data); fnc_ajax_send_data( '/ws/micesta_agregar_bundle_item', data, 'json', $(this), false, function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); if (data.popup_engrave && (data.popup_engrave != '')) { $('.modal').modal('hide'); $('#sectionModalEngrave').empty().html(data.popup_engrave); $('#modalGrabado').modal('show'); $('#modalGrabado').on('hide.bs.modal', function () { $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); }); } else if (!data.popup_skin || (data.popup_skin == '')) { $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); } else { $('.modal').modal('hide'); $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); $('#modalSkin').on('hide.bs.modal', function () { $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); }); } _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); }); $("#form-product-review").validate({ ignore: [], rules: { name: {required: true, maxlength: 50}, title: {required: true, maxlength: 50}, description: {required: true, maxlength: 255}, rate: {required: true} }, highlight: function (element, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); }, errorElement: 'small', errorClass: 'input-error', validClass: 'success' }); $("#form-product-review input").keypress(function (event) { if (event.which == 13) { event.preventDefault(); fnc_review_send(); } }); $('#btn-review-send').click(function(e) { e.preventDefault(); fnc_review_send(); }); $('.link-ver-mas').click(function(e) { e.preventDefault(); $('.review-page-' + $(this).data('page')).removeClass('d-none'); $(this).data('page' , parseInt($(this).data('page')+1)); if ($('.review-page-' + $(this).data('page')).length < 1) $(this).remove(); }); $('#image-review').change(function() { var input = document.getElementById('image-review'); // EXIF.getData(input.files[0], function() { // alert(EXIF.getTag(input.files[0], "Orientation")); // }); // fnc_getOrientation(input.files[0], function(orientation) { // alert('orientation: ' + orientation); // //var imageName = Date.now() + '' + Math.floor(Math.random() * 1000) // //fnc_upload_image_review(imageName, orientation); // }); var imageName = Date.now() + '' + Math.floor(Math.random() * 1000) fnc_upload_image_review(imageName); //fnc_upload_thumbnail(imageName); }); $('.btn-review-no-login').click(function(e) { e.preventDefault(e); $('.js-aviso-login-review').removeClass('d-none'); }); $('.btn-review-mostrar-form').click(function(e) { e.preventDefault(e); $('.btn-review-mostrar-form').hide(); $('.form-review-post').show(); }); $('.review-star.is-clickable').click(function(e) { e.preventDefault(); $('.review-star.is-clickable').removeClass('selected star-full').addClass('star-empty'); $('.review-star.is-clickable:lt('+$(this).index()+')').addClass('selected star-full'); $(this).addClass('selected star-full'); $('.form-review-post input[name="rate"]').val($(this).index()+1); $("#form-product-review").valid(); }); $('.btn-open-choice-pack').click(function(e) { e.preventDefault(); $('#choicePack .btn-epen').attr('endpoint', '/cigarros-electronicos-vapeadores/epen-' + $(this).data('kit')); $('#choicePack .btn-epod').attr('endpoint', '/cigarros-electronicos-vapeadores/epod2-' + $(this).data('kit')); $('#choicePack').modal('show'); }); $('.js-btn-choice-device').click(function(e) { e.preventDefault(); $('.js-btn-choice-device').removeClass('selected'); $(this).addClass('selected'); $('#btn-choice-goto').attr('href', $(this).attr('endpoint')); $('#btn-choice-goto').removeClass('disabled'); }); $('.js-desechable-sabor').click(function(e) { e.preventDefault(); location.href = '/vaper-desechable/vuse-go-' + $(this).data('sabor'); }); $('.card-faq').click(function(e) { $(this).toggleClass('active').children('.accordion-plp').toggleClass('active').siblings().toggleClass('active') if($(this).hasClass('faq-5')){ //$(this).children('img').toggleClass('d-none') } }) $('.copy-text-review-code').on("click", function(){ const range = document.createRange() const tableContent = $('.codigo-review')[0] range.selectNode(tableContent) window.getSelection().removeAllRanges() window.getSelection().addRange(range) document.execCommand("copy") window.getSelection().removeAllRanges() navigator.clipboard.writeText($('.codigo-review').text()); }) // Seleccionamos todas las imágenes en la página const imagenes = document.querySelectorAll('img'); // Iteramos sobre cada imagen imagenes.forEach(imagen => { // Verificamos si la imagen no tiene atributo 'alt' if (!imagen.alt) { // Obtenemos el nombre de la imagen sin la extensión const nombreImagen = imagen.src.split('/').pop().split('.')[0]; // Convertimos el nombre de la imagen en palabras separadas const palabras = nombreImagen.split(/(?=[A-Z])/).join(' ').toLowerCase(); // Añadimos el texto obtenido como atributo 'alt' a la imagen imagen.alt = palabras; } }); if($('.body-sin-nicotina').length > 0){ let href = window.location.href href = href.split("#"); if(href.length > 1){ setTimeout(() => { $('html, body').animate({ scrollTop: $('.tipo-dispo.' + href[1]).offset().top - 100 }, 500) }, 500) } } }); var fnc_check_bundle_complete = function() { if (($('.js-bundle-add-cart').data('device-color') == '') || ($('.js-bundle-add-cart').data('refill-1-variant') == '') || ($('.js-bundle-add-cart').data('refill-2-variant') == '')) { $('.js-bundle-add-cart').addClass('disabled'); } else { $('.js-bundle-add-cart').removeClass('disabled'); } } var fnc_review_send = function() { fnc_message_back_modal(''); fnc_ajax_send_form('form-product-review', '/ws/reviews_add', 'json', $('#btn-review-send'), false, function(data) { $('#form-product-review').remove(); $('.review-form-result').show(); if(data.review != false){ $('#popReviewCode .codigo-review').html(data.review); $('#popReviewCode').modal('show'); } }, function(e, t) { }); } var fnc_invalidar_image_review = function () { image_review_validated = false; $(".cambiar-nombre-imagen").removeClass('success'); $(".cambiar-nombre-imagen").empty().html('Sin archivo seleccionado'); $('#form-product-review input[name="image-uploaded"]').val(''); } var fnc_upload_image_review = function(imgName) { if (_waiting_active) return; fnc_invalidar_image_review(); var extensiones = ['image/jpeg', 'image/jpg', 'image/png']; var extension = ''; if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { fnc_show_message('Ups!', 'Este navegador no soporta el envío de archivos.', false); return; } var input = document.getElementById('image-review'); if (!input) { fnc_show_message('Ups!', "No podemos encontrar el archivo.", false); return; } if (!input.files) { fnc_show_message('Ups!', "Este navegador no soporta el envío de archivos.", false); return; } if (!input.files[0]) { fnc_show_message('Ups!', "Por favor, selecciona un archivo antes de enviar", false); return; } if(extensiones.indexOf(input.files[0].type) <= -1) { fnc_show_message('Ups!', "Tipo de archivo no permitido, solo JPG y PNG", false); return; } else{ var archivo = input.files[0].name.split("."); extension = archivo[archivo.length - 1]; } if(input.files[0].size > 10000000) { fnc_show_message('Ups!', "Tamaño máximo de imagen 10MB", false); return; } //$(".cambiar-nombre-imagen").text(input.files[0].name); var fileType = input.files[0].type; var data = {}; if ($('#image_review').attr('defaultuser') == '') { fnc_show_message('Ups!', "Antes de enviar la imagen debes estar identificado.", false); return; } var reviewImage = null; var reader = new FileReader(); reader.onload = function() { reviewImage = reader.result; data = { image64: reviewImage, imageName: imgName, imageType: input.files[0].type, }; fnc_set_waiting(true); fnc_set_waiting_layout(true, true); jQuery.ajax({ //url: 'https://bthiv4u0kk.execute-api.eu-west-1.amazonaws.com/prod/image_upload', url: 'https://l3nld19k04.execute-api.eu-west-1.amazonaws.com/default/vuse-upload-review', data: JSON.stringify(data), contentType: "application/json", dataType: 'json', type: 'POST', // For jQuery < 1.9 }) .done(function(data){ data = data.data; fnc_set_waiting(false); fnc_set_waiting_layout(false, true); if (data.error != 0) { fnc_show_message('Error', data.message, false); return; } $(".cambiar-nombre-imagen").addClass('success'); $(".cambiar-nombre-imagen").empty().html('Archivo correcto'); $('.js-aviso-dni-verificando').removeClass('d-none'); $('#image-uploaded').val(data.file_name +"."+ extension); var thumbnailImage = null; //Hacemos resize de la imagen subida por el usuario y la previsualizamos var loadingImage = loadImage( input.files[0], function (img) { thumbnailImage = img.toDataURL(); $('#image-preview').attr('src', thumbnailImage); $('.label-preview').removeClass('d-block'); $('.label-preview').addClass('d-none'); $('.image-preview-content').removeClass('d-none'); $('.image-preview-content').addClass('d-block'); fnc_upload_thumbnail(imgName, thumbnailImage, extension); }, {orientation: 1, maxWidth: 150, maxHeight: 150} ); if (!loadingImage) { var reader = new FileReader(); reader.onload = function(e) { thumbnailImage = e.target.result; $('#image-preview').attr('src', thumbnailImage); $('.label-preview').removeClass('d-block'); $('.label-preview').addClass('d-none'); $('.image-preview-content').removeClass('d-none'); $('.image-preview-content').addClass('d-block'); fnc_upload_thumbnail(imgName, thumbnailImage, extension); }; reader.readAsDataURL(input.files[0]); } type_imagen64 = this.files[0].type; image_review_validated = true; }) .fail(function (jqXHR, textStatus) { fnc_set_waiting(false); fnc_set_waiting_layout(false, true); fnc_show_message('Ups!', 'Ha ocurrido un error al subir la imagen. Redúcela de tamaño e inténtalo de nuevo.'); }); }; reader.readAsDataURL(input.files[0]); } var fnc_upload_thumbnail = function(imgName, thumbnailImage, extension) { var input = document.getElementById('image-review'); var data = {} //Enviamos la imagen de la thumbnail al s3 if(thumbnailImage){ data = { image64: thumbnailImage, imageName: 'th-'+imgName, imageType: input.files[0].type, }; fnc_set_waiting(true); fnc_set_waiting_layout(true, true); jQuery.ajax({ //url: 'https://bthiv4u0kk.execute-api.eu-west-1.amazonaws.com/prod/image_upload', url: 'https://l3nld19k04.execute-api.eu-west-1.amazonaws.com/default/vuse-upload-review', data: JSON.stringify(data), contentType: "application/json", dataType: 'json', type: 'POST', // For jQuery < 1.9 }) .done(function(data){ data = data.data; fnc_set_waiting(false); fnc_set_waiting_layout(false, true); if (data.error != 0) { fnc_show_message('Error', data.message, false); return; } $('#thumbnail-uploaded').val('th-'+ imgName +"."+ extension); }) .fail(function (jqXHR, textStatus) { fnc_set_waiting(false); fnc_set_waiting_layout(false, true); fnc_show_message('Ups!', 'Ha ocurrido un error al subir la imagen. Redúcela de tamaño e inténtalo de nuevo.'); }); } } function fnc_corrigeOrientacion(elem) { return; EXIF.getData(elem, function() { var datos = EXIF.getAllTags(this); //console_log(datos); }); return; EXIF.getData(elem, function() { //console_log(elem); var orientation = EXIF.getTag(elem, "Orientation"); //console_log(orientation); switch (orientation) { case 2: $(elem).css('transform', "scaleX(-1)"); break; case 3: $(elem).css('transform', "rotate(180deg)"); break; case 4: $(elem).css('transform', "rotate(180deg) scaleX(-1)"); break; case 5: $(elem).css('transform', "rotate(-90deg) scaleX(-1)"); break; case 6: $(elem).css('transform', "rotate(90deg)"); break; case 7: $(elem).css('transform', "rotate(90deg) scaleX(-1)"); break; case 8: $(elem).css('transform', "rotate(-90deg)"); break; default: break; } }); } function fnc_getOrientation(file, callback) { var reader = new FileReader(); reader.onload = function(e) { var view = new DataView(e.target.result); if (view.getUint16(0, false) != 0xFFD8) { return callback(-2); } var length = view.byteLength, offset = 2; while (offset < length) { if (view.getUint16(offset+2, false) <= 8) return callback(-1); var marker = view.getUint16(offset, false); offset += 2; if (marker == 0xFFE1) { if (view.getUint32(offset += 2, false) != 0x45786966) { return callback(-1); } var little = view.getUint16(offset += 6, false) == 0x4949; offset += view.getUint32(offset + 4, little); var tags = view.getUint16(offset, little); offset += 2; for (var i = 0; i < tags; i++) { if (view.getUint16(offset + (i * 12), little) == 0x0112) { return callback(view.getUint16(offset + (i * 12) + 8, little)); } } } else if ((marker & 0xFF00) != 0xFF00) { break; } else { offset += view.getUint16(offset, false); } } return callback(-1); }; reader.readAsArrayBuffer(file); } /*SLIDER DESPLEGABLE PRO ONE*/ document.addEventListener('DOMContentLoaded', function() { const slider = document.querySelector('.cont-slider'); const slides = document.querySelectorAll('.slide'); const progressBar = document.querySelector('.progress'); let currentTranslate = 0; let slideWidth = 0; let maxTranslate = 0; // Calcular dimensiones function calculateDimensions() { if (window.innerWidth <= 768) { // Mobile - sin slider, resetear transform slider.style.transform = 'translateX(0)'; currentTranslate = 0; return; } // Calcular el ancho total considerando cards expandidas let totalWidth = 0; const containerWidth = slider.parentElement.offsetWidth; const gap = 15; slides.forEach((slide, index) => { if (slide.classList.contains('expanded')) { // Card expandida: 60% del contenedor totalWidth += containerWidth * 0.6; } else { // Card normal: 30% del contenedor totalWidth += containerWidth * 0.3; } // Agregar gap excepto en la última if (index < slides.length - 1) { totalWidth += gap; } }); // Calcular slideWidth base (para navegación) slideWidth = (containerWidth * 0.3) + gap; // Calcular máximo translate (cuánto podemos mover a la izquierda) maxTranslate = Math.max(0, totalWidth - containerWidth); console.log('Dimensiones calculadas:', { totalWidth, containerWidth, maxTranslate, expandedCards: document.querySelectorAll('.slide.expanded').length }); updateProgressBar(); } // Actualizar barra de progreso function updateProgressBar() { if (window.innerWidth <= 768) return; if (maxTranslate === 0) { // Si no hay scroll necesario, progreso 100% if (progressBar) progressBar.style.width = '100%'; return; } const progress = Math.min(100, Math.max(0, (currentTranslate / maxTranslate) * 100)); if (progressBar) { progressBar.style.width = progress + '%'; } console.log('Progreso actualizado:', { currentTranslate, maxTranslate, progress: progress + '%' }); } // Animar hacia una posición function slideTo(targetTranslate, duration = 300) { if (window.innerWidth <= 768) return; // Asegurar que el target esté dentro de los límites targetTranslate = Math.max(0, Math.min(maxTranslate, targetTranslate)); currentTranslate = targetTranslate; slider.style.transition = `transform ${duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`; slider.style.transform = `translateX(-${currentTranslate}px)`; setTimeout(() => { slider.style.transition = ''; }, duration); updateProgressBar(); console.log('SlideTo ejecutado:', { targetTranslate, currentTranslate, maxTranslate, withinLimits: targetTranslate >= 0 && targetTranslate <= maxTranslate }); } // Centrar una slide específica function centerSlide(slideIndex) { if (window.innerWidth <= 768) return; const slide = slides[slideIndex]; const containerWidth = slider.parentElement.offsetWidth; const gap = 15; // Calcular posición acumulada hasta la slide objetivo let positionToSlide = 0; for (let i = 0; i < slideIndex; i++) { if (slides[i].classList.contains('expanded')) { positionToSlide += containerWidth * 0.6; } else { positionToSlide += containerWidth * 0.3; } positionToSlide += gap; } // Calcular ancho de la slide actual const currentSlideWidth = slide.classList.contains('expanded') ? containerWidth * 0.6 : containerWidth * 0.3; // Centrar: posición de la slide - (mitad del contenedor - mitad de la slide) const targetPosition = positionToSlide - (containerWidth / 2) + (currentSlideWidth / 2); console.log('Centrando slide:', { slideIndex, positionToSlide, currentSlideWidth, targetPosition, isExpanded: slide.classList.contains('expanded') }); slideTo(targetPosition, 400); } // Recalcular después de expandir/contraer function recalculateAndCenter(slideIndex) { setTimeout(() => { calculateDimensions(); centerSlide(slideIndex); }, 50); // Tiempo para que CSS termine de aplicarse } // Forzar reposicionamiento si estamos fuera de límites function enforceConstraints() { setTimeout(() => { calculateDimensions(); if (currentTranslate > maxTranslate) { console.log('Reposicionando: currentTranslate > maxTranslate', { currentTranslate, maxTranslate, adjustment: maxTranslate }); slideTo(maxTranslate, 300); } }, 50); } // Toggle de cards document.addEventListener('click', function(e) { if (e.target.closest('.toggle-btn')) { e.preventDefault(); const button = e.target.closest('.toggle-btn'); const slide = button.closest('.slide'); const handler = button.querySelector('.handler'); const slideIndex = Array.from(slides).indexOf(slide); // Cerrar todas las demás cards slides.forEach((otherSlide, index) => { if (index !== slideIndex) { otherSlide.classList.remove('expanded'); const otherHandler = otherSlide.querySelector('.handler'); if (otherHandler) { otherHandler.textContent = '+'; } } }); // Toggle de la card actual slide.classList.toggle('expanded'); if (slide.classList.contains('expanded')) { handler.textContent = '−'; // Solo centrar si estamos en desktop (≥ 767px) if (window.innerWidth > 768) { recalculateAndCenter(slideIndex); } } else { handler.textContent = '+'; // Solo recalcular si estamos en desktop (≥ 767px) if (window.innerWidth > 768) { enforceConstraints(); } } } }); // Navegación con flechas const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); if (prevBtn) { prevBtn.addEventListener('click', () => { if (window.innerWidth <= 768) return; slideTo(currentTranslate - slideWidth, 300); }); } if (nextBtn) { nextBtn.addEventListener('click', () => { if (window.innerWidth <= 768) return; slideTo(currentTranslate + slideWidth, 300); }); } // Navegación con drag mejorada let startX = 0; let isDragging = false; slider.addEventListener('mousedown', (e) => { if (window.innerWidth <= 768) return; startX = e.clientX; isDragging = true; slider.style.cursor = 'grabbing'; }); document.addEventListener('mousemove', (e) => { if (!isDragging || window.innerWidth <= 768) return; const deltaX = startX - e.clientX; const newTranslate = currentTranslate + deltaX; if (newTranslate >= 0 && newTranslate <= maxTranslate) { slider.style.transform = `translateX(-${newTranslate}px)`; } }); document.addEventListener('mouseup', (e) => { if (!isDragging || window.innerWidth <= 768) return; const deltaX = startX - e.clientX; currentTranslate = Math.max(0, Math.min(maxTranslate, currentTranslate + deltaX)); slider.style.transform = `translateX(-${currentTranslate}px)`; slider.style.cursor = ''; isDragging = false; updateProgressBar(); }); // Inicializar y eventos de resize calculateDimensions(); window.addEventListener('resize', () => { setTimeout(calculateDimensions, 100); }); // Prevenir selección de texto durante drag slider.addEventListener('selectstart', (e) => e.preventDefault()); console.log('Slider nativo inicializado correctamente'); }); $('#acordeon-desplegable-mob .accordion-item .accordion-button').on("click", function(){ $('#acordeon-desplegable-mob .accordion-item .accordion-button').closest('.accordion-header').addClass('d-block').removeClass('d-none'); $(this).closest('.accordion-header').removeClass('d-block').addClass('d-none'); /*$('html, body').animate({ scrollTop: $(this).closest('.accordion-item').offset().top - 154 }, 1000);*/ $('.accordion-collapse').on('shown.bs.collapse', function () { var $acordeon = $(this).closest('.accordion-item'); $('html, body').animate({ scrollTop: $acordeon.offset().top - 154 }, 500); // duración: 600ms }); }); /*FIN SLIDER DESPLEGABLE PRO ONE*/ var fnc_dlEvent = function(event) { //console.log('Event'); //console.log(event); dataLayer.push({ 'event': event }); } var fnc_dlEventAction = function(event, eventAction, eventLabel) { //console.log('EventAction'); //console.log(event); //console.log(eventAction); //console.log(eventLabel); dataLayer.push({ 'event': event, 'eventAction': eventAction, 'eventLabel': eventLabel, }); } var fnc_dlLogOut = function() { dataLayer.push({ 'event': 'account', 'eventAction': 'logout', 'eventLabel': 'success', 'eventCallback': function() { window.location = '/mi-cuenta/logout'; } }); } var fnc_datalayer_init = function() { // Prev event //$('.js-dlProductClick').click(function(e) { $('.js-selected-link').click(function(e) { e.preventDefault(); if (typeof _dlProducts === 'undefined') return; var index = $(this).parents('.js-product-box').find('.js-product-option, .js-product-option-recomendados').attr('data-variant') $(this).parents('.js-product-box').find('.js-product-option, .js-product-option-recomendados').each(function(){ if($(this).hasClass('selected')){ index = $(this).attr('data-variant'); } }) var data = _dlProducts[index]; var url = $(this).attr('href'); if (typeof data === 'undefined'){ window.location.href = url; return } console.log(data); // console.log('productClick'); // console.log(data); //console.log(_dlProducts) console.log({ 'event': 'select_item', 'ecommerce': { 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], //'item_list_name' : data['item_list_name'], 'index' : data['index'], 'quantity': 1 }] }, }) dataLayer.push({'ecommerce' : null}); dataLayer.push({ 'event': 'select_item', 'ecommerce': { 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], //'item_list_name' : data['item_list_name'], 'index' : data['index'], 'quantity': 1 }] }, 'eventCallback': function() { window.location = url; } }); // OLD LAYER no se usaba // if (typeof _dlProducts === 'undefined') // return; // var data = _dlProducts[$(this).data('dlproduct')]; // var url = $(this).attr('href'); // console.log('productClick'); // console.log(data); // dataLayer.push({ // 'event': 'productClick', // 'ecommerce': { // 'click': { // 'products': [{ // 'name': data['name'], // 'id': data['id'], // 'price': data['price'], // 'brand': data['brand'], // 'category': data['category'], // 'variant': data['variant'], // 'position': 0, // 'format': data['format'], // 'flavour': data['flavour'], // 'nicotine': data['nicotine'], // 'SystemType': data['SystemType'], // 'Subscription': data['Subscription'], // 'ServerSideTampstamp': Date.now() // }] // } // }, // 'eventCallback': function() { // window.location.href = url; // } // }); }); //view item selecting other variant // $('.js-product-option').click(function(e){ // if (typeof _dlProducts === 'undefined') // return; // let index = $(this).data('variant') // var data = _dlProducts[index]; // console.log(data); // console.log({ // 'event' : 'view_item', // 'ecommerce' : { // 'items' : { // 'item_name' : data['name'], // 'item_id': data['item_id'], // 'price': data['item_variant'] ? data['price'] : '---', // 'item_brand': 'Vuse', // 'item_category': data['category'], // 'item_variant': data['item_variant'] ? data['item_variant'] : '---', // 'item_list_name': data['item_list_name'], // 'quantity' : data['quantity'], // } // }} // ) // }) $('.js-registro-compra-dl').click(function(e) { let index = $(this).data('dlindex'); if(index != 4) fnc_dlCheckout_Step_push({ 'event' : 'checkout', 'eventCategory' : 'ecommerce', 'eventAction' : 'checkout', 'eventLabel' : 'step' + $(this).data('dlindex') }); }); } var fnc_dlAddCart = function(item, quantity) { // Old // if (typeof _dlProducts === 'undefined') // return; // var data = _dlProducts[item['elem']]; // console.log('addToCart'); // console.log({ // 'event': 'addToCart', // 'ecommerce': { // 'currencyCode':'EUR', // 'add': { // 'products': [{ // 'name': data['name'], // 'id': data['id'], // 'price': data['price'], // 'brand': data['brand'], // 'category': data['category'], // 'variant': data['variant'], // 'quantity': quantity, // 'format': data['format'], // 'flavour': data['flavour'], // 'nicotine': data['nicotine'], // 'SystemType': data['SystemType'], // 'Subscription': item['subscription'] ? 'True' : 'False', // 'ServerSideTampstamp': Date.now() // }] // } // } // }); // dataLayer.push({ // 'event': 'addToCart', // 'ecommerce': { // 'currencyCode':'EUR', // 'add': { // 'products': [{ // 'name': data['name'], // 'id': data['id'], // 'price': data['price'], // 'brand': data['brand'], // 'category': data['category'], // 'variant': data['variant'], // 'quantity': quantity, // 'format': data['format'], // 'flavour': data['flavour'], // 'nicotine': data['nicotine'], // 'SystemType': data['SystemType'], // 'Subscription': item['subscription'] ? 'True' : 'False', // 'ServerSideTampstamp': Date.now() // }] // } // } // }); if (typeof _dlProducts === 'undefined') return; var data = _dlProducts[item['elem']]; //console.log(data); console.log({ 'event': 'add_to_cart', 'ecommerce': { 'currency': 'EUR', 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], 'quantity': quantity, }] } }); dataLayer.push({'ecommerce' : null}); dataLayer.push({ 'event': 'add_to_cart', 'ecommerce': { 'currency': 'EUR', 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], 'quantity': quantity, }] } }); } var fnc_dlUpdateCart = function(item, previous_quantity) { if (item.previous_quantity) previous_quantity = item.previous_quantity; if (previous_quantity > item['quantity']) fnc_dlRemoveCart(item, previous_quantity - item['quantity']); else if (previous_quantity < item['quantity']) fnc_dlAddCart(item, item['quantity'] - previous_quantity); } var fnc_dlRemoveCart = function(item, quantity) { // OLD // if (typeof _dlProducts === 'undefined') // return; // var data = _dlProducts[item['elem']]; // //console.log('removeFromCart'); // dataLayer.push({ // 'event': 'removeFromCart', // 'ecommerce': { // 'remove': { // 'products': [{ // 'name': data['name'], // 'id': data['id'], // 'price': data['price'], // 'brand': data['brand'], // 'category': data['category'], // 'variant': data['variant'], // 'quantity': quantity, // 'format': data['format'], // 'flavour': data['flavour'], // 'nicotine': data['nicotine'], // 'SystemType': data['SystemType'], // 'Subscription': item['subscription'] ? 'True' : 'False', // 'ServerSideTampstamp': Date.now() // }] // } // } // }); if (typeof _dlProducts === 'undefined') return; var data = _dlProducts[item['elem']]; console.log({ 'event': 'remove_from_cart', 'ecommerce': { 'currency': 'EUR', 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], 'quantity': quantity, }] } }); dataLayer.push({'ecommerce' : null}); dataLayer.push({ 'event': 'remove_from_cart', 'ecommerce': { 'currency': 'EUR', 'items': [{ 'item_name' : data['item_name'], 'item_id' : '' + data['item_id'], 'price' : data['price'], 'item_brand' : data['item_brand'], 'item_category': data['item_category'], 'item_category2': data['item_category2'], 'item_category3': data['item_category3'], 'item_category4': data['item_category4'], 'item_variant' : data['item_variant'], 'quantity': quantity, }] } }); } var fnc_dlCheckout_Step = function() { //console.log('Checkout_Step'); if (typeof _dlCheckoutProducts !== 'undefined') { dataLayer.push({'ecommerce' : null}); //console.log(_dlCheckoutProducts); dataLayer.push(_dlCheckoutProducts); } } var fnc_dlCheckout_Step_push = function(step) { //console.log(step) dataLayer.push(step); } fnc_datalayer_init(); var console_log = function (e) { console.log(e);} var fnc_cambiar_img_bg_left = function() {} var fnc_cambiar_img_left = function() {} var fnc_js_mega_menu_slick = function(){ $('.js-slider-mega-menu-slick').slick({ infinite: false, slidesToShow: 6, slidesToScroll: 1, arrows: false, nextArrow: '', prevArrow: '', swipeToSlide: false, touchMove: false, variableWidth: true, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 6, slidesToScroll: 1, infinite: false, arrows: false, swipeToSlide: true, touchMove: true } }, { breakpoint: 870, settings: { slidesToShow: 5, slidesToScroll: 1, infinite: false, arrows: true, swipeToSlide: true, touchMove: true } }, { breakpoint: 768, settings: { slidesToShow: 4, slidesToScroll: 1, infinite: false, arrows: true, swipeToSlide: true, touchMove: true } }, { breakpoint: 576, settings: { slidesToShow: 2, slidesToScroll: 1, infinite: false, arrows: true, swipeToSlide: true, touchMove: true } } ] }) }; var fnc_js_show_menu_hover = function(){ $('.btn-mega-menu').hover(function() { $('.js-mega-menu').removeClass('active'); $('.js-mega-menu-' + $(this).attr('enlace')).addClass('active'); $('.mega-menu-background-select').show(); }); return; var array = [['dispositivos', 'dispositivos'], ['recargas', 'recargas'], ['desechables', 'desechables'], ['personalizar', 'personalizar'], ['calidad', 'calidad'], ['descubre', 'descubre']] array.forEach(set_menu); // $('.js-vapeadores').hover( // function(){ // $('.js-mega-menu-dispositivos').addClass('active'); // } // ); }; function set_menu(element, index, array){ $('.js-mega-menu-btn-' + element[0]).hover( function(){ $('.js-mega-menu-' + element[1]).addClass('active'); check_active_menu(element[1]); $('.mega-menu-background-select').show(); } ); }; function fnc_salir_mega_menu() { $('.mega-menu-dropdowns').removeClass('active'); $('.mega-menu-background-select').hide(); } $('.section-header-redesign').on('mouseenter', function(){ fnc_salir_mega_menu(); }); $('.mega-menu-background-select').on('mouseenter', function(){ fnc_salir_mega_menu(); }); $('.container-mega-menu-dropdowns').on('mouseleave', function(){ fnc_salir_mega_menu(); $('.mega-menu-background-select').hide(); }); function check_active_menu(menu){ $('.container-mega-menu-dropdowns').children().each(function(){ if(!$(this).hasClass('js-mega-menu-' + menu)){ $(this).removeClass('active'); } }); }; var fnc_js_menu_mobile_open = function(){ $('.js-menu-mobile-open').click(function() { $(this).toggleClass('open') }); $('.js-btn-collapsed-mobile-minus').click(function() { $(this).toggleClass('collapsed'); $(this).toggleClass('open'); $(this).find('.js-plus-transform-minus').toggleClass('open'); }); $('.js-btn-collapsed-mobile-minus-links').click(function() { $(this).toggleClass('collapsed'); $(this).toggleClass('open'); $(this).find('.js-plus-transform-minus-links-mobile').toggleClass('open'); }); } var fnc_activar_animaciones = function() { if ($('.animate-elem').length < 1) return; $('.animate-elem').each(function() { let animElem = $(this); let animTime = parseInt(animElem.attr('animateTime')==undefined ? '500' : animElem.attr('animateTime')); setTimeout(function() { animElem.addClass('animate'); }, animTime); }); } var show_info_promo = function (banner) { var message = ''; var title = 'Promoción'; switch (banner) { case 'number1_dispositivos1': title = 'Vuse
es la marca #1 mundial de Vapeo'; message = '
*Basado en el valor de mercado de Vype/Vuse en Precio de Venta al Público (RRP) en el retail de vapers (es decir, el valor total de la categoría de vapers en las ventas al por menor) en los principales mercados de vapor: EE.UU., Canadá, Francia, Reino Unido, Alemania a partir de mayo de 2022.
'; break; case 'skin_1euro_recargas': message = 'Por la compra de esta recarga puedes añadir a tu cesta una Skin de ePod2 a tan solo 1 €. Cuando la añadas al carrito podrás seleccionar el color de Skin que prefieras.'; break; case 'skin_1euro_dispositivos': message = 'Por la compra de este dispositivo puedes añadir a tu cesta una Skin de ePod2 a tan solo 1 €. Cuando lo añadas al carrito podrás seleccionar el color de Skin que prefieras.'; break; case 'skin_1euro_promocion': message = 'Al utilizar el código WELCOME-EPOD puedes añadir a tu cesta una Skin de ePod2 a tan solo 1 €. Recuerda, después de añadir este código promocional en tu cesta podrás seleccionar el color de Skin que prefieras.'; break; case 'skin_1euro_5x4': message = 'Al utilizar la promoción de 5x4 en recargas de ePod2 puedes añadir a tu cesta una Skin de ePod2 a tan solo 1 €. Recuerda, después de añadir la promoción a tu cesta podrás seleccionar el color de Skin que prefieras.'; break; case 'skin_gratis_suscripcion': message = 'Al crear una suscripción puedes añadir a tu cesta una Skin de ePod2 gratis.'; break; } if (message != '') fnc_show_message(title, message, false); } var fnc_elementVisibleOnScreen = function(e) { var elementTop = $(e).offset().top + 100; var elementBottom = elementTop + $(e).outerHeight()-200; var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; } var fnc_show_element_with_eye = function(){ $('.js-icon-eye').click(function() { if ($(this).hasClass('icon__eye-off')) { $(this).addClass('icon__eye').removeClass('icon__eye-off'); $(this).siblings('input').attr('type', 'text'); } else { $(this).removeClass('icon__eye').addClass('icon__eye-off'); $(this).siblings('input').attr('type', 'password'); } }); } var lanzadoEventoCallForEvidence = false; var fnc_lanzarEventoCallForEvidence = function() { if (lanzadoEventoCallForEvidence) return; if (fnc_elementVisibleOnScreen('.banner-call-for-evidence')) { //console_log('es visible'); lanzadoEventoCallForEvidence = true; fnc_dlEvent('banner-call-for-evidence'); } } var fnc_activateVideoBannerHome = function() { if ($(window).width() >= 768) $('#banner_video_home iframe').attr('src', 'https://player.vimeo.com/video/' + $('#banner_video_home').data('videodesktop') + '&autoplay=1&loop=1&autopause=0&muted=1&controls=0&dnt=1'); else $('#banner_video_home iframe').attr('src', 'https://player.vimeo.com/video/' + $('#banner_video_home').data('videomobile') + '&autoplay=1&loop=1&autopause=0&muted=1&controls=0&dnt=1'); } var fnc_resize_videoBanner = function() { if (($(window).width() >= 768) && ($('#banner_video_home').data('device1') != 'desktop')) { $('#banner_video_home').data('device1', 'desktop'); fnc_activateVideoBannerHome(); } else if (($(window).width() < 768) && ($('#banner_video_home').data('device1') != 'mobile')) { $('#banner_video_home').data('device1', 'mobile'); fnc_activateVideoBannerHome(); } } var fnc_launchPopupGloHome = function() { if (($('#popAgeGate').length > 0) || ($('#cookie-reminder').length > 0)) fnc_activateVideoBannerHome(); $(window).resize(function() { fnc_resize_videoBanner(); }); fnc_resize_videoBanner(); return; if ($('#popGloHome').length < 1) return; setTimeout(function() { $('#popGloHome').modal('show'); fnc_cookies_set($('#popGloHome').attr('cookieval'), 1, 365); }, 60000); } var fnc_launchPopupHome = function() { fnc_activar_animaciones(); if ($('#popInfoHome').length < 1) { fnc_launchPopupGloHome(); return; } setTimeout(function() { let cookievalue = 1 if($('#popInfoHome').attr('cookieval') == 'popup_home_suscripciones_vuse_2_pods'){ fnc_launchPopupsuscripcionesVuse2Pods() return } $('#popInfoHome').modal('show'); fnc_cookies_set($('#popInfoHome').attr('cookieval'), cookievalue, 365); if ($('#popInfoHome').attr('datalayerid') != '') dataLayer.push({'event' : $('#popInfoHome').attr('datalayerid')}); $('#popInfoHome').on('hidden.bs.modal', function () { fnc_launchPopupGloHome(); }); }, 15000); } var fnc_launchPopupsuscripcionesVuse2Pods = function() { let cookievalue = fnc_cookies_get($('#popInfoHome').attr('cookieval')) >= 1 ? parseInt(fnc_cookies_get($('#popInfoHome').attr('cookieval'))) + 1 : 1; if(cookievalue >= 4){ return; } $('#popInfoHome').modal('show'); if($('body').attr('id') == 'tienda-online'){ $('#popInfoHome .link-popinfoHome').attr('href', '#'); fnc_cookies_set($('#popInfoHome').attr('cookieval'), 4, 365); } if ($('#popInfoHome').attr('datalayerid') != '') dataLayer.push({'event' : $('#popInfoHome').attr('datalayerid')}); $('#popInfoHome').on('hidden.bs.modal', function () { fnc_launchPopupGloHome(); }); } function fnc_thr_ga() { $.ajax({url: '/ws/thr_rueda_ga', data: { action: 'banner', value : 'click' }, type: 'POST', dataType: 'text'}); } function fnc_quiz_ga(a, v) { $.ajax({url: '/ws/thr_quiz_ga', data: { action: a, value : v }, type: 'POST', dataType: 'text'}); } function slider_mov() { var actual = parseInt($('.js-img-gif-animation-engraves').data('actual')); //console_log(actual); if (actual == 6) { $('.js-img-gif-animation-engraves .engraves-part').fadeOut(1000); $('.js-img-gif-animation-engraves .engrave-part-1').fadeIn(500); $('.js-img-gif-animation-engraves').data('actual', '2'); } else { $('.js-img-gif-animation-engraves .engrave-part-'+(actual-1)).fadeOut(500); $('.js-img-gif-animation-engraves .engrave-part-'+actual).fadeIn(500); $('.js-img-gif-animation-engraves').data('actual', actual+1); } setTimeout(function(e) { slider_mov(); } , 1500); } $(document).ready(function($){ $('.CS_Record').click(function() { dataLayer.push({'event': 'ETR Session'}); //console.log('event ETR Session'); }); if ($('.CS_Page_Record').length > 0) { dataLayer.push({'event': 'ETR Session'}); //console.log('event ETR Session'); }; $(window).on('resize', function(){ if($(window).width() < 500){ $(".seleccion-dispositivo-slick").slick('slickSetOption', 'centerPadding', $(window).width() * 40 / 375 + 'px'); } if($(window).width() >= 500 && $(window).width() < 768){ $(".seleccion-dispositivo-slick").slick('slickSetOption', 'centerPadding', $(window).width() * 140 / 991 + 'px'); } if($(window).width() >= 768 && $(window).width() < 992){ $(".seleccion-dispositivo-slick").slick('slickSetOption', 'centerPadding', $(window).width() * 250 / 991 + 'px'); } if($(window).width() < 992){ $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 0 ); } }); if ($('#seccion-suscripciones').hasClass('aviso-suscripciones-paradas')) fnc_show_message('Aviso', '

Actualmente estamos teniendo problemas con nuestra pasarela de pago para suscripciones, estamos trabajando en ello para resolverlo lo más pronto posible.

Para ayudarte con esto, por favor contacta con nuestro call center: 900 922 280

', false); if (!$('#barra-info-registro-dispositivo').hasClass('no-fixed')) { $(window).bind('scroll', function() { var navHeight = 84; if ($(window).scrollTop() > navHeight) { $('#barra-info-registro-dispositivo').removeClass('no-fixed').addClass('fixed'); } else { $('#barra-info-registro-dispositivo').removeClass('fixed').addClass('no-fixed'); } }); } $('.seleccion-dispositivo-slick .ficha .btn-primario, #banner_plp_banner_suscripciones .btn-container .ancla-suscrip').click(function (e) { var anchoPantalla = $(document).width(); var bajarHasta; if(anchoPantalla < 768){ bajarHasta = 130; }else{ bajarHasta = 150; } var sec = $(this).data('sec'); $('html, body').animate({ scrollTop: $("#" + sec).offset().top-bajarHasta }, 500); }); $('.js-close-barra-info').click(function (e) { $('#barra-info-registro-dispositivo').addClass('d-none'); }); $( "#btn-buscar-mobile").click(function() { $('#buscador-mobile').css('display', 'block'); }); $( "#btn-buscar-mobile2").click(function() { $('#buscador-mobile').css('display', 'block'); }); $( "#cancelar-buscar-mobile" ).click(function() { $('#buscador-mobile').css('display', 'none'); }); $('.sticky-comprar-mobile').hide(); $('.sticky-comprar').hide(); if ($('.js-img-gif-animation-waves').length > 0) { setInterval(function(e) { var actual = parseInt($('.js-img-gif-animation-waves').data('actual')); if (actual == 4) { $('.js-img-gif-animation-waves picture').fadeIn(); $('.js-img-gif-animation-waves').data('actual', '0'); } else { $('.js-img-gif-animation-waves .wave-part-'+actual).fadeOut(1000); $('.js-img-gif-animation-waves').data('actual', actual+1); } }, 1500); } if ($('.js-img-gif-animation-engraves').length > 0) { slider_mov(); } if ($('.js-img-gif-animation').length > 0) { setInterval(function(e) { $('.js-img-gif-animation picture').each(function() { if ($(this).hasClass('img-gif-animation-hide')) $(this).removeClass('img-gif-animation-hide'); else $(this).addClass('img-gif-animation-hide'); } ); }, 3000); } if ($('#popEPodLEP').length > 0) { $('#popEPodLEP').modal('show'); $('#popEPodLEP').on('hide.bs.modal', function () { fnc_cookies_set('popupEPODLep', 1, 365); }); } if (!$('#popAgeGate').hasClass('d-block')) { if ($('#hero_home_carrusel').length > 0) crear_homeHeroSlider(); fnc_launchPopupHome(); } //if($('#popInfoHome').length >= 1){ // if($('#popInfoHome').attr('cookieval') == 'popup_home_suscripciones_vuse_2_pods'){ // fnc_launchPopupHome(); // } //} if($('.banner-call-for-evidence').length > 0) { $(window).scroll(function() { fnc_lanzarEventoCallForEvidence(); }); $(window).blur(function() { fnc_lanzarEventoCallForEvidence(); }); fnc_lanzarEventoCallForEvidence(); } $('#btn-menu-buscar').click(function(e) { e.preventDefault(); if ($('#form-header-buscador input[name="cadena"]').val().trim() != '') { $('#form-header-buscador').submit(); $('#waiting').show(); } }); $('#form-header-buscador').submit(function(e) { if ($('#form-header-buscador input[name="cadena"]').val().trim() == '') { e.preventDefault(); return; } $('#waiting').show(); }); $('#btn-menu-buscar-mobile').click(function(e) { console.log("fhdsjufh") e.preventDefault(); if ($('#form-header-buscador-mobile input[name="cadena"]').val().trim() != '') { $('#form-header-buscador-mobile').submit(); $('#waiting').show(); } }); $('#form-header-buscador-mobile').submit(function(e) { if ($('#form-header-buscador-mobile input[name="cadena"]').val().trim() == '') { e.preventDefault(); return; } $('#waiting').show(); }); // Set data-src Lazyload if (!$('body').hasClass('nolazy')) { $("img").each(function() { if (!$(this).hasClass('nolazy')) { $(this).addClass("lazy"); $(this).attr("data-src",$(this).attr("src")); $(this).removeAttr("src"); } }); // Set data-src Lazyload var pictureSource = $(document).find('source'); $(pictureSource).each(function() { if (!$(this).hasClass('nolazy')) { $(this).addClass("lazy"); $(this).attr("data-src",$(this).attr("srcset")); $(this).removeAttr("srcset"); } }); // Load Lazyload var myLazyLoad = new LazyLoad(); myLazyLoad.update(); } // add link class $('a').addClass('is-link'); // HEADER const $dropdown = $(".dropdown"); const $dropdownToggle = $(".dropdown-toggle"); const $dropdownMenu = $(".dropdown-menu"); const showClass = "show"; $(window).on("load resize", function() { if (this.matchMedia("(min-width: 768px)").matches) { $dropdown.hover( function() { const $this = $(this); $this.addClass(showClass); $this.find($dropdownToggle).attr("aria-expanded", "true"); $this.find($dropdownMenu).addClass(showClass); }, function() { const $this = $(this); $this.removeClass(showClass); $this.find($dropdownToggle).attr("aria-expanded", "false"); $this.find($dropdownMenu).removeClass(showClass); } ); } else { $dropdown.off("mouseenter mouseleave"); } }); // ACCORDION NAV MOBILE MENU function toggleIcon(e) { $(e.target) .prev('.panel-heading') .find(".more-less") .toggleClass('icon-plus icon-minus'); $(e.target) .prev('.panel-heading') .find(".footer-more-less") .toggleClass('footer-icon-plus footer-icon-minus'); $(e.target) .prev('.panel-heading') .find(".btn-more-less.vertical") .toggleClass('animate'); } $('.panel-group').on('hidden.bs.collapse', toggleIcon); $('.panel-group').on('shown.bs.collapse', toggleIcon); // FIN ACCORDION NAV MOBILE MENU // MEGA MENU 2023 fnc_js_mega_menu_slick(); fnc_js_show_menu_hover(); fnc_js_menu_mobile_open(); // SHOW WITH EYE ICON fnc_show_element_with_eye(); var ancho = window.innerWidth; if (window.innerWidth > 768) { $('.js-item-supermenu div').hover(function(e) { $('.js-megamenu').addClass('d-none'); let parent = $(this).parent(); if (parent.data('supermenu')) $('#megamenu-'+parent.data('supermenu')).removeClass('d-none'); }); $('#contendor-supermenu').mouseleave(function() { $('.js-megamenu').addClass('d-none'); }); } // FIN HEADER // PREGUNTAS FRECUENTES $('.js-titular-faqs').click(function (e) { let activo = $(this).hasClass('active') ? true : false; $('.opn').addClass('active'); $('.cls').removeClass('active'); $('.js-titular-faqs').removeClass('active'); $('.js-contenido-faqs').removeClass('active'); if (!activo) { $(this).addClass('active'); $(this).find('.opn').removeClass('active'); $(this).find('.cls').addClass('active'); $(this).siblings('.js-contenido-faqs').addClass('active'); } }); // FIN PREGUNTAS FRECUENTES //HERO HOME $('.hero-slider-vuse').removeClass("invisible"); //if ($('#hero_home_carrusel').length > 0) // crear_homeHeroSlider(); // PRODUCTOS RECOMENDADOS HOME var productosRecomendadosSlider = $('.productos-recomendados').slick({ centerMode: true, centerPadding: '110px', dots: true, infinite: false, speed: 300, slidesToShow: 4, slidesToScroll: 4, nextArrow: '
siguiente
', prevArrow: '
previo
', responsive: [ { breakpoint: 5000, settings: { slidesToShow: 5, slidesToScroll: 5, centerMode: false } }, { breakpoint: 1200, settings: { slidesToShow: 4, slidesToScroll: 4, dots: true, centerMode: false } }, { breakpoint: 992, settings: { slidesToShow: 3, slidesToScroll: 3, dots: true, centerMode: false } }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1, dots: true, centerMode: false } }, { breakpoint: 500, settings: { slidesToShow: 1, slidesToScroll: 1, dots: true } } //{ breakpoint: 420, settings: { slidesToShow: 1, slidesToScroll: 1, dots: true } } ] }); // FIN PRODUCTOS RECOMENDADOS HOME // PRODUCTOS RECOMENDADOS BLOG var productosRecomendadosSlider = $('.productos-recomendados-blog').slick({ centerMode: true, centerPadding: '0px', dots: true, infinite: false, speed: 300, slidesToShow: 4, slidesToScroll: 4, nextArrow: '
siguiente
', prevArrow: '
previo
', responsive: [ { breakpoint: 5000, settings: { slidesToShow: 4, slidesToScroll: 4, dots: true, centerMode: false } }, { breakpoint: 1200, settings: { slidesToShow: 4, slidesToScroll: 4, dots: true, centerMode: false } }, { breakpoint: 992, settings: { slidesToShow: 3, slidesToScroll: 3, dots: true, centerMode: false } }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1, dots: true, centerMode: false } }, { breakpoint: 600, settings: { slidesToShow: 1, slidesToScroll: 1, dots: true } } ] }); // FIN PRODUCTOS RECOMENDADOS BLOG //SLIDER DE PRODUCTOS CON SUSCRIPCIONES!!! //ACTUAL CON TRES PRODUCTOS var productosSuscripcionesSlider = $('.seleccion-dispositivo-slick').slick({ centerMode: true, centerPadding: $(window).width() * 140 / 991 + 'px', dots: true, arrows: false, infinite: true, speed: 300, slidesToShow: 4, slidesToScroll: 1, initialSlide: 1, responsive: [ { breakpoint: 5000, settings: { slidesToShow: 4, slidesToScroll: 1, centerMode: false, dots: false} }, { breakpoint: 1200, settings: { slidesToShow: 3, slidesToScroll: 1, centerMode: false, dots: false} }, { breakpoint: 992, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 250 / 991 + 'px'} }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 140 / 991 + 'px' } }, { breakpoint: 500, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 40 / 375 + 'px' } }, ] }); if(($(window).width() < 992) || ($(window).width() >= 1200)){ $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 0 ); } if(992 <= $(window).width() < 1200){ $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 1 ); } //FIN ACTUAL CON TRES PRODUCTOS //NUEVO CON CINCO PRODUCTOS //var productosSuscripcionesSlider = $('.seleccion-dispositivo-slick').slick({ // centerMode: true, // centerPadding: $(window).width() * 120 / 991 + 'px', // dots: true, // arrows: false, // infinite: true, // speed: 300, // slidesToShow: 3, // slidesToScroll: 1, // responsive: [ // { breakpoint: 1440, settings: { slidesToShow: 3, slidesToScroll: 1, centerMode: true, centerPadding: $(window).width() * 70 / 991 + 'px', dots//: true} }, // { breakpoint: 1200, settings: { slidesToShow: 3, slidesToScroll: 1, centerMode: true, centerPadding: $(window).width() * 70 / 991 + 'px', //dots: true} }, // { breakpoint: 992, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 250 / 991 + 'px'} }, // { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 140 / 991 + 'px' } }, // { breakpoint: 500, settings: { slidesToShow: 1, slidesToScroll: 1, centerPadding: $(window).width() * 40 / 375 + 'px' } }, // ] //}); //if($(window).width() < 992){ // $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 0 ); //} // //if(($(window).width() >= 992) && ($(window).width() < 1439)){ // $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 1 ); //} // //if($(window).width() >= 1440){ // $('.seleccion-dispositivo-slick').slick( 'slickGoTo', 1 ); //} //FIN NUEVO CON CINCO PRODUCTOS //FIN SLIDER DE PRODUCTOS CON SUSCRIPCIONES!!! var players_pdp = {}; if ($('.iframe-pdp').length > 0) { $('.iframe-pdp').each(function() { players_pdp[this.id] = new Vimeo.Player(this); }); function iniciarVideoIFramePDP(id) { for(frameIdPDP in players_pdp) { if (frameIdPDP == id) players_pdp[frameIdPDP].play(); else { players_pdp[frameIdPDP].setCurrentTime(0); players_pdp[frameIdPDP].pause(); } } } } // TIENDA $(document).ready(function(){ $("#headingSuscripcionVuse").click(function(){ var showMoreDesktop = $('.option-showmore'); var showMoreMobile= $('.option-showmore-mobile'); $(showMoreDesktop).text($(showMoreDesktop).text() == 'Saber más' ? 'Mostrar menos' : 'Saber más'); $(showMoreMobile).text($(showMoreMobile).text() == 'Saber más' ? 'Mostrar menos' : 'Saber más'); }); }); // SLIDER IMAGE FICHA PRODUCTOS $('.slider').slick({ arrows:true, dots: false, infinite:true, speed:500, autoplay:false, autoplaySpeed: 3000, slidesToShow:1, slidesToScroll:1, nextArrow: '
siguiente
', prevArrow: '
previo
' }); $('.slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){ if ($(slick.$slides.get(nextSlide)).attr('esvideo') == '1') { iniciarVideoIFramePDP($(slick.$slides.get(nextSlide)).find('iframe').attr('id')); } else { iniciarVideoIFramePDP(''); //$('.js-video-product-slider').attr('src', ''); } }); $('.slider-nav > div').click(function() { $('.slider').slick('slickGoTo',$(this).index()); }) // FIN SLIDER IMAGE FICHA PRODUCTO // FIN TIENDA $('.btn-mobile-menu').on('click', function(){ var x = document.getElementById("menu-name"); if (x.innerHTML === "Menú") { x.innerHTML = "Cerrar"; } else { x.innerHTML = "Menú"; } }); $('.js-filters-open').on('click', function(){ fnc_mostrarFilters(); }); $('.basket-nav').on('click', function(){ if ($('#cesta-checkout').length < 1) fnc_mostrarCesta(); }); //document.addEventListener('touchstart', onTouchStart, {passive: true}); $('#dropdownMenuLinkUser').click(function(e) { e.stopPropagation(); e.preventDefault(); $('#dropdownMenuUser').toggleClass('show'); if($('#dropdownMenuUser').hasClass('show')){ $('#background-gray').addClass('background-gray'); }else{ $('#background-gray').removeClass('background-gray'); } }); $('html').click(function() { if($('#dropdownMenuUser').hasClass('show')){ $('#dropdownMenuUser').toggleClass('show'); $('#background-gray').removeClass('background-gray'); } }) $(".txt-despliega").click(function(e) { e.preventDefault(); $('.descripcion.version-desk .leer-mas').toggle(); $('.txt-despliega').toggle(); }); $(".js-despliega-descubre-menu-mob").click(function(e) { e.preventDefault(); $('.enlaces').toggle(); }); var stickyTop = $('#descuento-encuentra-tu-vuse, #barra-info').offset().top; var menu_height; if(window.innerWidth < 1200){ menu_height = 126; }else{ menu_height = 134; } $(window).on( 'scroll', function(){ if ($(window).scrollTop() >= stickyTop - menu_height) { $('#descuento-encuentra-tu-vuse, #barra-info').css({position: "sticky", top: menu_height+"px", width: "100%"}); $('#descuento-encuentra-tu-vuse, #barra-info').css('zIndex', '9'); } else { $('#descuento-encuentra-tu-vuse, #barra-info').css({position: "relative", top: "0px"}); } }); $('.velo-link').click(function(e) { e.preventDefault(); var anchoPantalla = $( document ).width(); var bajarHasta; if(anchoPantalla < 768){ bajarHasta = 130; }else{ bajarHasta = 150; } $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top-bajarHasta }, 500); }); }); $(window).on("scroll resize", function() { var actualPos = $(this).scrollTop(); var docWidth = $(this).width(); var btnPos = $('.btn-carrito-main').length > 0 ? $('.btn-carrito-main').offset().top : 0; if (actualPos > btnPos) { if(docWidth >= 768){ $('.sticky-comprar').fadeIn(); $('.sticky-comprar-mobile').fadeOut(); } else{ $('.sticky-comprar-mobile').fadeIn(); $('.sticky-comprar').fadeOut(); } } else { $('.sticky-comprar-mobile').fadeOut(); $('.sticky-comprar').fadeOut(); } }); //fcn_windowResize(); var fnc_mostrarCesta = function() { $('#popup-basket .overlay').show(); $('#mi-cesta').addClass('showed'); }; var fnc_mostrarFilters = function() { $('#popup-basket .overlay').show(); $('#filtros-sidebar').addClass('showed'); $('#filtros-sidebar').attr('aria-hidden', 'false'); }; var fnc_ocultarCesta = function() { $('#mi-cesta').removeClass('showed'); $('#filtros-sidebar').removeClass('showed'); $('#filtros-sidebar').attr('aria-hidden', 'true'); $('#popup-basket .overlay').hide(); }; // Ocular y Mostrar contraseña, Cambiar eye icon //var fcn_see_password = function(){ $(document).ready(function() { $(".show_hide_password a").on('click', function(event) { var imagen_on = _cdn_url+'img/sections/icons/icon-password-on.svg'; var imagen_off = _cdn_url+'img/sections/icons/icon-password-off.svg'; event.preventDefault(); if($('.show_hide_password input').attr("type") == "text"){ $('.show_hide_password input').attr('type', 'password'); $('.show_hide_password i').addClass( "fa-eye-slash" ); $('.show_hide_password img').attr("src", imagen_off); $('.show_hide_password i').removeClass( "fa-eye" ); $('.show_hide_password img').addClass( "pt-3" ); $('.show_hide_password img').removeClass( "pt-2" ); }else if($('.show_hide_password input').attr("type") == "password"){ $('.show_hide_password input').attr('type', 'text'); $('.show_hide_password i').removeClass( "fa-eye-slash" ); $('.show_hide_password i').addClass( "fa-eye" ); $('.show_hide_password img').removeClass( "pt-3" ); $('.show_hide_password img').addClass( "pt-2" ); $('.show_hide_password img').attr("src", imagen_on); } }); }); //} // mi-cesta/datos $( ".card-header" ).click(function() { $(this).find('i').toggleClass('icon-plus icon-minus'); }); // fin mi-cesta/datos $( ".question-header" ).click(function() { var id = $(this).attr('id'); $('#'+ id +'-list').toggleClass('unselect select'); $('#'+ id +' .button-qa').toggleClass('hide-qa show-qa'); $('#'+ id +'-info').toggleClass('hide-info show-info'); }); $("#form-page-blog .control input").focus(function() { $("#form-page-blog .input-group-btns .search-icon-navbar").css('border-bottom', '2px solid black'); }); $("#form-page-blog .control input").focusout(function() { $("#form-page-blog .input-group-btns .search-icon-navbar").css('border-bottom', 'none'); }); $(document).ready(function(){ if ($('#popCoupon').length > 0) { $('.modal').modal('hide'); $('#popCoupon').modal('show'); } if ($('.js-video-sabek').length > 0) { $(".container-video-by-sabek").click(function(){ $(this).addClass('open'); $(".container-video-by-sabek .container-video").empty().html(''); }); } if ($('.js-video-sabek-landing').length > 0) { $(".sec-video-sabek").click(function(){ $(this).addClass('open'); $(".sec-video-sabek .container-video").empty().html(''); }); } $('.js-checkout-remove-vusegokit').click(function(e) { e.preventDefault(); fnc_ajax_send_data( '/ws/micesta_eliminar_vusegokit', { lineitem : $(this).closest('.js-resumen-lineitem-vusegokit').attr('lineId') }, 'json', false, true, function(data) { fnc_dlUpdateCart(data.updated, 0); fnc_set_waiting_layout(true, true); window.location.reload(true); }, function(e, t) { }); }); }); var fnc_mostrar_pop_codigo_promo = function() { } var fnc_aplicar_descuento_directo = function(codigo) { fnc_message_back_modal(''); fnc_ajax_send_data('/ws/micesta_aplicar_codigo', { discount_code : codigo } , 'json', false, false, function(data) { window.location.href = '/mi-cesta'; }, function(e, t) { } ); } var seconds_to_go = 0; var cd_minutes = 0; var cd_seconds = 0; function countDown() { seconds_to_go--; cd_seconds--; if (seconds_to_go < 0 || (cd_seconds < 0 && cd_minutes == 0)) { clearInterval(_countDown_interval); $('.js_codigo_carrito_info').hide(); $('.js_info_envio').show(); return; } if (cd_seconds < 0) { cd_seconds = 59; cd_minutes--; } if (cd_minutes < 1) $(".ctd-time").html(cd_seconds + 's'); else $(".ctd-time").html(cd_minutes + 'm ' + (cd_seconds < 10 ? '0' : '') + cd_seconds + 's'); } var _countDown_interval = $(".ctd-time").length > 0 ? setInterval('countDown()', 1000) : false; var e_seconds_to_go = 0; var e_cd_minutes = 0; var e_cd_seconds = 0; function countDownEncuentra() { e_seconds_to_go--; e_cd_seconds--; if (e_seconds_to_go < 0 || (e_cd_seconds < 0 && e_cd_minutes == 0)) { clearInterval(_countDownEnc_interval); $('.js-caja-codigo-encuentra-tu-vuse').hide(); return; } if (e_cd_seconds < 0) { e_cd_seconds = 59; e_cd_minutes--; } if (e_cd_minutes < 1) $(".ctd-time.encuentra").html(e_cd_seconds + ' seg'); else $(".ctd-time.encuentra").html(e_cd_minutes + ' min ' + (e_cd_seconds < 10 ? '0' : '') + e_cd_seconds + ' seg'); } var _countDownEnc_interval = $(".ctd-time.encuentra").length > 0 ? setInterval('countDownEncuentra()', 1000) : false; if (_alt_title_page != '') { $('img').each(function() { if (($(this).attr('alt') == undefined) || ($(this).attr('alt') == '')) $(this).attr('alt', _alt_title_page); else $(this).attr('alt', $(this).attr('alt') + ' ' + _alt_title_page); if (($(this).attr('title') == undefined) || ($(this).attr('title') == '')) $(this).attr('title', _alt_title_page); else $(this).attr('title', $(this).attr('title') + ' ' + _alt_title_page); }); } // SUPERMENU MOBILE OPEN HIDE BUBBLES $(document).ready(function() { $('.collapse-bubble-mobile').click(function() { $('.' + $(this).data('collapse')).show().animate({ right: '0px' }, 500); // Muestra y desliza desde la derecha }); $('.close-collapse-bubbles-menu').click(function() { $(this).parents('.collapse-bubbles-menu').animate({ right: '-300px' }, 500, function() { // Desliza hacia la derecha y oculta $(this).hide(); }); }); }); var homeHeroSlider = false; function crear_homeHeroSlider() { if (homeHeroSlider) return; homeHeroSlider = $('#hero_home_carrusel').slick({ dots: true, infinite: true, speed: 300, autoplay:true, autoplaySpeed: 10000, slidesToShow: 1, slidesToScroll: 1, adaptiveHeight: true, arrows: false, nextArrow: '
siguiente
', prevArrow: '
previo
' }); } if ($('#nieve.active').length > 0) { const nieve = () => { let e = document.createElement('copo') let x = innerWidth * Math.random() let size = (Math.random() * 20) + 2 let z = Math.round(Math.random()) * 100 let delay = Math.random() * 5 let anima = (Math.random() * 10) + 5 let rotate = Math.floor(Math.random() * 90) + 1 let animX = Math.floor(Math.random() * 3) + 1 e.style.left = x + 'px' e.style.width = size + 'px' e.style.height = size + 'px' e.style.zIndex = z e.style.animationDelay = delay + 's' e.style.animationDuration = anima + 's' e.style.rotate = rotate + "deg" e.classList.add('anim'+animX); document.getElementById('nieve').appendChild(e); setTimeout(() => { e.remove() }, anima * 1000) } setInterval(nieve, 50); } let allowInfiniteScroll = true; $(document).ready(function() { if($('#barra-info').hasClass('animated')){ const elemento = '#barra-info .container-info-barra' animate_barra_info(0, elemento, $(elemento).length) console.log(0, elemento, $(elemento).length); } }); function animate_barra_info(a_barra_info, elemento, cantidad){ const element = $(elemento).eq(a_barra_info % cantidad); element.css("right", "+" + $(window).innerWidth() + "px"); element.removeClass("d-none"); element.animate({right: '+0'}, 2000); let b_barra_info = setTimeout(function(){ element.animate({right: "-" + $(window).innerWidth() + "px"}, 2000); setTimeout(function(){ element.addClass("d-none"); }, 3000); a_barra_info++; animate_barra_info(a_barra_info, elemento, cantidad); }, 10000) } /*! * tabbable 6.2.0 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.tabbable,o=e.tabbable={};t(o),o.noConflict=function(){return e.tabbable=n,o}}())}(this,(function(e){"use strict";var t=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],n=t.join(","),o="undefined"==typeof Element,r=o?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,a=!o&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},i=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},u=function(e,t,o){if(i(e))return[];var a=Array.prototype.slice.apply(e.querySelectorAll(n));return t&&r.call(e,n)&&a.unshift(e),a=a.filter(o)},c=function e(t,o,a){for(var u=[],c=Array.from(t);c.length;){var l=c.shift();if(!i(l,!1))if("SLOT"===l.tagName){var s=l.assignedElements(),d=e(s.length?s:l.children,!0,a);a.flatten?u.push.apply(u,d):u.push({scopeParent:l,candidates:d})}else{r.call(l,n)&&a.filter(l)&&(o||!t.includes(l))&&u.push(l);var f=l.shadowRoot||"function"==typeof a.getShadowRoot&&a.getShadowRoot(l),b=!i(f,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(l));if(f&&b){var v=e(!0===f?l.children:f.children,!0,a);a.flatten?u.push.apply(u,v):u.push({scopeParent:l,candidates:v})}else c.unshift.apply(c,l.children)}}return u},l=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},s=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!l(e)?0:e.tabIndex},d=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},f=function(e){return"INPUT"===e.tagName},b=function(e){return function(e){return f(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||a(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;nsummary:first-of-type")?e.parentElement:e;if(r.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return v(e)}else{if("function"==typeof o){for(var u=e;e;){var c=e.parentElement,l=a(e);if(c&&!c.shadowRoot&&!0===o(c))return v(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=u}if(function(e){var t,n,o,r,i=e&&a(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(u)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&u;){var l,s,d;c=!(null===(s=u=null===(l=i=a(u))||void 0===l?void 0:l.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},h=function(e,t){return!(t.disabled||i(t)||function(e){return f(e)&&"hidden"===e.type}(t)||p(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n=0)},g=function e(t){var n=[],o=[];return t.forEach((function(t,r){var a=!!t.scopeParent,i=a?t.scopeParent:t,u=function(e,t){var n=s(e);return n<0&&t&&!l(e)?0:n}(i,a),c=a?e(t.candidates):i;0===u?a?n.push.apply(n,c):n.push(i):o.push({documentOrder:r,tabIndex:u,item:t,isScope:a,content:c})})),o.sort(d).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},w=t.concat("iframe").join(",");e.focusable=function(e,t){return(t=t||{}).getShadowRoot?c([e],t.includeContainer,{filter:h.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):u(e,t.includeContainer,h.bind(null,t))},e.getTabIndex=s,e.isFocusable=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==r.call(e,w)&&h(t,e)},e.isTabbable=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==r.call(e,n)&&m(t,e)},e.tabbable=function(e,t){var n;return n=(t=t||{}).getShadowRoot?c([e],t.includeContainer,{filter:m.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:y}):u(e,t.includeContainer,m.bind(null,t)),g(n)},Object.defineProperty(e,"__esModule",{value:!0})})), /*! * focus-trap 7.6.5 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE */ function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tabbable")):"function"==typeof define&&define.amd?define(["exports","tabbable"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.focusTrap,o=e.focusTrap={};t(o,e.tabbable),o.noConflict=function(){return e.focusTrap=n,o}}())}(this,(function(e,t){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n0){var n=e[e.length-1];n!==t&&n._setPausedState(!0)}var o=e.indexOf(t);-1===o||e.splice(o,1),e.push(t)},c=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)},l=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},s=function(e){return l(e)&&!e.shiftKey},d=function(e){return l(e)&&e.shiftKey},f=function(e){return setTimeout(e,0)},b=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{},n=t.hasFallback,o=void 0!==n&&n,a=t.params,u=void 0===a?[]:a,c=m[e];if("function"==typeof c&&(c=c.apply(void 0,i(u))),!0===c&&(c=void 0),!c){if(void 0===c||!1===c)return c;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var l=c;if("string"==typeof c){try{l=r.querySelector(c)}catch(t){throw new Error("`".concat(e,'` appears to be an invalid selector; error="').concat(t.message,'"'))}if(!l&&!o)throw new Error("`".concat(e,"` as selector refers to no known node"))}return l},T=function(){var e=N("initialFocus",{hasFallback:!0});if(!1===e)return!1;if(void 0===e||e&&!t.isFocusable(e,m.tabbableOptions))if(w(r.activeElement)>=0)e=r.activeElement;else{var n=y.tabbableGroups[0];e=n&&n.firstTabbableNode||N("fallbackFocus")}else null===e&&(e=N("fallbackFocus"));if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},E=function(){if(y.containerGroups=y.containers.map((function(e){var n=t.tabbable(e,m.tabbableOptions),o=t.focusable(e,m.tabbableOptions),r=n.length>0?n[0]:void 0,a=n.length>0?n[n.length-1]:void 0,i=o.find((function(e){return t.isTabbable(e)})),u=o.slice().reverse().find((function(e){return t.isTabbable(e)})),c=!!n.find((function(e){return t.getTabIndex(e)>0}));return{container:e,tabbableNodes:n,focusableNodes:o,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:a,firstDomTabbableNode:i,lastDomTabbableNode:u,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=n.indexOf(e);return a<0?r?o.slice(o.indexOf(e)+1).find((function(e){return t.isTabbable(e)})):o.slice(0,o.indexOf(e)).reverse().find((function(e){return t.isTabbable(e)})):n[a+(r?1:-1)]}}})),y.tabbableGroups=y.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),y.tabbableGroups.length<=0&&!N("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(y.containerGroups.find((function(e){return e.posTabIndexesFound}))&&y.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},S=function(e){var t=e.activeElement;if(t)return t.shadowRoot&&null!==t.shadowRoot.activeElement?S(t.shadowRoot):t},F=function(e){!1!==e&&e!==S(document)&&(e&&e.focus?(e.focus({preventScroll:!!m.preventScroll}),y.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(e)&&e.select()):F(T()))},O=function(e){var t=N("setReturnFocus",{params:[e]});return t||!1!==t&&e},P=function(e){var n=e.target,o=e.event,r=e.isBackward,a=void 0!==r&&r;n=n||v(o),E();var i=null;if(y.tabbableGroups.length>0){var u=w(n,o),c=u>=0?y.containerGroups[u]:void 0;if(u<0)i=a?y.tabbableGroups[y.tabbableGroups.length-1].lastTabbableNode:y.tabbableGroups[0].firstTabbableNode;else if(a){var s=y.tabbableGroups.findIndex((function(e){var t=e.firstTabbableNode;return n===t}));if(s<0&&(c.container===n||t.isFocusable(n,m.tabbableOptions)&&!t.isTabbable(n,m.tabbableOptions)&&!c.nextTabbableNode(n,!1))&&(s=u),s>=0){var d=0===s?y.tabbableGroups.length-1:s-1,f=y.tabbableGroups[d];i=t.getTabIndex(n)>=0?f.lastTabbableNode:f.lastDomTabbableNode}else l(o)||(i=c.nextTabbableNode(n,!1))}else{var b=y.tabbableGroups.findIndex((function(e){var t=e.lastTabbableNode;return n===t}));if(b<0&&(c.container===n||t.isFocusable(n,m.tabbableOptions)&&!t.isTabbable(n,m.tabbableOptions)&&!c.nextTabbableNode(n))&&(b=u),b>=0){var p=b===y.tabbableGroups.length-1?0:b+1,h=y.tabbableGroups[p];i=t.getTabIndex(n)>=0?h.firstTabbableNode:h.firstDomTabbableNode}else l(o)||(i=c.nextTabbableNode(n))}}else i=N("fallbackFocus");return i},x=function(e){var t=v(e);w(t,e)>=0||(b(m.clickOutsideDeactivates,e)?o.deactivate({returnFocus:m.returnFocusOnDeactivate}):b(m.allowOutsideClick,e)||e.preventDefault())},k=function(e){var n=v(e),o=w(n,e)>=0;if(o||n instanceof Document)o&&(y.mostRecentlyFocusedNode=n);else{var r;e.stopImmediatePropagation();var a=!0;if(y.mostRecentlyFocusedNode)if(t.getTabIndex(y.mostRecentlyFocusedNode)>0){var i=w(y.mostRecentlyFocusedNode),u=y.containerGroups[i].tabbableNodes;if(u.length>0){var c=u.findIndex((function(e){return e===y.mostRecentlyFocusedNode}));c>=0&&(m.isKeyForward(y.recentNavEvent)?c+1=0&&(r=u[c-1],a=!1))}}else y.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return t.getTabIndex(e)>0}))}))||(a=!1);else a=!1;a&&(r=P({target:y.mostRecentlyFocusedNode,isBackward:m.isKeyBackward(y.recentNavEvent)})),F(r||(y.mostRecentlyFocusedNode||T()))}y.recentNavEvent=void 0},I=function(e){(m.isKeyForward(e)||m.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];y.recentNavEvent=e;var n=P({event:e,isBackward:t});n&&(l(e)&&e.preventDefault(),F(n))}(e,m.isKeyBackward(e))},R=function(e){var t;"Escape"!==(null==(t=e)?void 0:t.key)&&"Esc"!==(null==t?void 0:t.key)&&27!==(null==t?void 0:t.keyCode)||!1===b(m.escapeDeactivates,e)||(e.preventDefault(),o.deactivate())},D=function(e){var t=v(e);w(t,e)>=0||b(m.clickOutsideDeactivates,e)||b(m.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},A=function(){if(y.active)return u(h,o),y.delayInitialFocusTimer=m.delayInitialFocus?f((function(){F(T())})):F(T()),r.addEventListener("focusin",k,!0),r.addEventListener("mousedown",x,{capture:!0,passive:!1}),r.addEventListener("touchstart",x,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",I,{capture:!0,passive:!1}),r.addEventListener("keydown",R),o},C=function(){if(y.active)return r.removeEventListener("focusin",k,!0),r.removeEventListener("mousedown",x,!0),r.removeEventListener("touchstart",x,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",I,!0),r.removeEventListener("keydown",R),o},G="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===y.mostRecentlyFocusedNode}))}))&&F(T())})):void 0,j=function(){G&&(G.disconnect(),y.active&&!y.paused&&y.containers.map((function(e){G.observe(e,{subtree:!0,childList:!0})})))};return o={get active(){return y.active},get paused(){return y.paused},activate:function(e){if(y.active)return this;var t=g(e,"onActivate"),n=g(e,"onPostActivate"),o=g(e,"checkCanFocusTrap");o||E(),y.active=!0,y.paused=!1,y.nodeFocusedBeforeActivation=S(r),null==t||t();var a=function(){o&&E(),A(),j(),null==n||n()};return o?(o(y.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!y.active)return this;var t=a({onDeactivate:m.onDeactivate,onPostDeactivate:m.onPostDeactivate,checkCanReturnFocus:m.checkCanReturnFocus},e);clearTimeout(y.delayInitialFocusTimer),y.delayInitialFocusTimer=void 0,C(),y.active=!1,y.paused=!1,j(),c(h,o);var n=g(t,"onDeactivate"),r=g(t,"onPostDeactivate"),i=g(t,"checkCanReturnFocus"),u=g(t,"returnFocus","returnFocusOnDeactivate");null==n||n();var l=function(){f((function(){u&&F(O(y.nodeFocusedBeforeActivation)),null==r||r()}))};return u&&i?(i(O(y.nodeFocusedBeforeActivation)).then(l,l),this):(l(),this)},pause:function(e){return y.active?(y.manuallyPaused=!0,this._setPausedState(!0,e)):this},unpause:function(e){return y.active?(y.manuallyPaused=!1,h[h.length-1]!==this?this:this._setPausedState(!1,e)):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return y.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),y.active&&E(),j(),this}},Object.defineProperties(o,{_isManuallyPaused:{value:function(){return y.manuallyPaused}},_setPausedState:{value:function(e,t){if(y.paused===e)return this;if(y.paused=e,e){var n=g(t,"onPause"),o=g(t,"onPostPause");null==n||n(),C(),j(),null==o||o()}else{var r=g(t,"onUnpause"),a=g(t,"onPostUnpause");null==r||r(),E(),A(),j(),null==a||a()}return this}}}),o.updateContainerElements(e),o}})); //CODIGO ACCESIBILIDAD $(document).ready(function($){ $(document).on('keydown', '[role="button"]', function(e) { if (e.key === 'Enter') { if ($(this).is('img')) { $(this).trigger('mouseover'); } $(this).click(); } }); $('img:not([alt])').each(function () { $(this).attr('alt', ''); }); $('a[href="javascript:void(0)"]').not('[role="button"]').attr({ 'role': 'button', 'tabindex': 0 }); }) function createTrap(element){ return focusTrap.createFocusTrap(element, { escapeDeactivates: true, returnFocusOnDeactivate: true, clickOutsideDeactivates: true }); } //element(jquery) clase(La clase que tiene que tener para que se haga focus trap) function createObserver(element, clase){ const trap = createTrap(element[0]); const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'attributes' && mutation.attributeName === 'class') { if (element.hasClass(clase)) { trap.activate(); return; } trap.deactivate(); } }); }); observer.observe(element[0], { attributes: true }); } var _waiting_active = false; var fnc_set_waiting = function(active) { if (_waiting_active && active) return; _waiting_active = active; } var fnc_set_waiting_layout = function(active, force) { if (active) { if (force) $('#waiting').show(); else if (parseInt($('#waiting').data('delay')) > 0) $('#waiting').show(); } else { if (force) $('#waiting').hide(); else setTimeout(function() { $('#waiting').hide(); }, parseInt($('#waiting').data('delay'))); } } var fnc_has_waiting = function(e) { return (e.hasClass('waiting') || e.hasClass('done') || e.hasClass('error')) ? true : false; } var fnc_set_button_status = function(e, status) { if(!e) return; e.removeClass('done error waiting'); switch (status) { case 'done': case 'error': //if (e.data('msg-'+status) != undefined) e.empty().html(e.data('msg-'+status)); setTimeout(function(){ if (e.data('msg-default') != undefined) e.empty().html(e.data('msg-default')); e.find('.dots').remove(); e.removeClass('done error dot-flashing'); }, 100); case 'waiting': if (e.hasClass('btn-primario') || e.hasClass('btn-secundario'))// || ((e.data('msg-waiting') != undefined)) { e.addClass('dot-flashing'); e.append('
'); // } e.addClass(status); break; } } var fnc_in_array = function(elem, array) { var length = array.length; for(var i = 0; i < length; i++) { if(array[i] == elem) return true; } return false; } var fnc_date_valid = function(year, month, day) { if ((year == '') || (month == '') || (day == '')) { fnc_show_message('Datos incompletos', 'Debes indicar una fecha de nacimiento.'); return false; } if (!fnc_check_date(year, month, day)) { fnc_show_message('Datos erróneos', 'La fecha de nacimiento no es correcta.'); return false; } return true; } var fnc_pad_left = function(str, len) { str += ''; while(str.length < len) str = '0' + str; return str; } var fnc_check_date = function(year, month, day) { if (year < 1900) return false; if ((fnc_pad_left(year, 2)+'-'+fnc_pad_left(month,2)+'-'+fnc_pad_left(day, 2)) > _fecha_hoy) return false; if (month < 1 || month > 12) return false; if (day < 1 || day > 31) return false; if (day == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) return false; if (day >= 30 && month == 2) return false; if ((month == 2) && (day == 29) && (!(year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)))) return false; return true; } var fnc_check_birthday = function(year, month, day, elem_birthday) { /*let date_elem = elem.val().split("/"); year = date_elem[2]; month = date_elem[1]; day = date_elem[0];*/ if (!fnc_date_valid(year, month, day)) return false; var date = fnc_pad_left(year, 4) + '-' + fnc_pad_left(month,2) + '-' + fnc_pad_left(day, 2); $(elem_birthday).val(date); //if (elem.attr('max') < date) if ($(elem_birthday).attr('minbirthday') < date) { fnc_show_message('Dato incorrecto', 'Debes ser mayor de edad.'); return false; } return true; } var fnc_show_message = function(title, message, redirect) { $('.modal').modal('hide'); $('#popGenericoTitulo').empty().html(title); $('#popGenericoDescripcion').empty().html(message); if(redirect) { $(document).on('hidden.bs.modal','#popGenerico', function () { fnc_set_waiting_layout(true, true); if (redirect == 'reload') location.reload(true); else window.location = redirect; }); } $('#popGenerico').modal('show'); } var fnc_message_back_modal = function(returnTo) { $('#popGenerico').data('backModal', returnTo); } var fnc_ajax_send_form = function(form_id, endpoint, resultType, button, hayRedireccion, callback_ok, callback_error) { if (!$('#'+form_id).valid()) { //fnc_show_invalid_fields(form_id); return; } var $form_inputs = $('#'+form_id).find(':input'); var form_data = {}; $form_inputs.each(function () { if (this.type == 'checkbox') form_data[this.name] = $(this).is(':checked') ? 1 : 0; else form_data[this.name] = $(this).val(); }); fnc_ajax_send_data(endpoint, form_data, resultType, button, hayRedireccion, callback_ok, callback_error); } var fnc_ajax_send_data = function(endpoint, data, resultType, button, hayRedireccion, callback_ok, callback_error) { if (_waiting_active) return; fnc_set_waiting(true); if (!button) fnc_set_waiting_layout(true, true); data['security_c_name'] = fnc_cookies_get('security_c_name'); $.ajax({url: endpoint, data: data, type: 'POST', dataType: resultType, beforeSend: fnc_set_button_status(button, 'waiting')}) .done(function (data) { fnc_set_waiting(false); fnc_set_waiting_layout(false, true); if (data && (data.error == 0)) { fnc_set_button_status(button, 'done'); if (!hayRedireccion){ } callback_ok(data); return; } callback_error(button, data.message); fnc_set_button_status(button, 'error'); fnc_show_message('Ups!', (data && data.message) ? data.message : 'Ha ocurrido un error. Recarga la página e inténtalo de nuevo.'); }) .fail(function (jqXHR, textStatus) { fnc_set_waiting(false); fnc_set_waiting_layout(false, true); fnc_set_button_status(button, 'error'); fnc_show_message('Ups!', 'Ha ocurrido un error. Recarga la página e inténtalo de nuevo.'); callback_error(jqXHR, textStatus); }); } var _error_messages = { 'firstName': 'Nombre', 'lastName': 'Apellidos', 'gender': 'Género', 'telefono': 'Teléfono (teléfono con formato de España sin código de país, ej: 612345678)', 'phone': 'Teléfono (teléfono con formato de España sin código de país, ej: 612345678)', 'birthdayDay': 'Fecha de nacimiento: día', 'birthdayMonth': 'Fecha de nacimiento: mes', 'birthdayYear': 'Fecha de nacimiento: año', 'email': 'Email', 'password': 'Contraseña (6 caracteres mínimo, siendo válidos letras mayúsculas y minúsculas, números y los símbolos ?, -, _, ., &, %, #, $, !, *)', 'password2': 'Repetir Contraseña no coincide con Contraseña', 'terms': 'Términos y condiciones', 'confirma': 'Debes confirmar la baja', 'code': 'Número de dispositivo no correcto', 'product': 'Dispositivo', 'product_color': 'Color de dispositivo', 'address1': 'Direccion', 'address2': 'Apartamento, casa, empresa, etc.', 'addressPhone': 'Teléfono en la dirección de envío (teléfono con formato de España sin código de país, ej: 612345678)', 'province': 'Provincia/Estado', 'city': 'Ciudad', 'zip': 'Código Postal', 'terms': 'Términos y condiciones', 'acceptsMarketing_email': 'Recibir alertas y notificaciones por email', 'acceptsMarketing_tfn': 'Recibir alertas y notificaciones por email/SMS/Whatsapp', 'busqueda': 'Debes indicarnos una o varias palabras para buscar el producto deseado.' }; var fnc_show_invalid_fields = function(form_id) { var errors = ''; $.each($('#'+ form_id + ' .input-error'), function(i, element){ if ($(element).attr('name') in _error_messages) errors += '
  • ' + _error_messages[$(element).attr('name')] + '
  • '; }); if (errors == '') errors= '

    Por favor, revisa el formulario y completa todos los campos.

    '; fnc_show_message('Campos incorrectos', '

    Por favor, revisa los siguientes campos:

      ' + errors + '
    ', false); } var fnc_calculate_price = function(quantity, price) { quantity = parseInt(quantity); price = parseFloat(price.replace(',', '.')); var newPrice = parseFloat(quantity * price); return fnc_number_format(newPrice, 2, ',', '.'); } function fnc_number_format (number, decimals, decPoint, thousandsSep) { number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number; var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals); var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep; var dec = (typeof decPoint === 'undefined') ? '.' : decPoint; var s = ''; var toFixedFix = function (n, prec) { if (('' + n).indexOf('e') === -1) { return +(Math.round(n + 'e+' + prec) + 'e-' + prec); } else { var arr = ('' + n).split('e'); var sig = ''; if (+arr[1] + prec > 0) { sig = '+'; } return (+(Math.round(+arr[0] + 'e' + sig + (+arr[1] + prec)) + 'e-' + prec)).toFixed(prec); } } s = (prec ? toFixedFix(n, prec).toString() : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec); } $(document).ready(function($){ $('.ver-spot').click(function(e){ e.preventDefault(); $('.cont-poster').addClass("d-none"); $('.cont-video').removeClass("d-none"); }); $('#popGenerico').on('hidden.bs.modal', function () { if ($(this).data('backModal') != '') $('#'+$(this).data('backModal')).modal('show'); }); }); var fnc_aplicar_descuento_directo25_send = function() { fnc_message_back_modal(''); fnc_ajax_send_data( '/ws/micesta_aplicar_codigo', { discount_code : 'recarga25' }, 'json', false, false, function(data) { $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); if (data.popup_skin != '') { $('.modal').modal('hide'); $('#sectionModalSkin').empty().html(data.popup_skin); $('#modalSkin').modal('show'); $('#modalSkin').on('hide.bs.modal', function () { setTimeout(function() { fnc_show_message('¡Enhorabuena!', 'Descuento aplicado al carrito'); dataLayer.push({ 'event' : 'PopUpSuccess' }); }, 500); }); } else { fnc_show_message('¡Enhorabuena!', 'Descuento aplicado al carrito'); dataLayer.push({ 'event' : 'PopUpSuccess' }); } }, function(e, t) { dataLayer.push({ 'event' : 'PopUpError' }); }); } var fnc_updatelogindata_send = function() { $('.js-error-lostdata small').empty(); fnc_message_back_modal(''); var year = $('#form-actualizar-datoslost select[name="dob_year"]').val(); var month = $('#form-actualizar-datoslost select[name="dob_month"]').val(); var day = $('#form-actualizar-datoslost select[name="dob_day"]').val(); if ((year != '') && (month != '') && (day != '')) { if (!fnc_check_date(year, month, day)) { $('.js-error-lostdata small').empty().html('La fecha de nacimiento no es correcta.'); return false; } var date = fnc_pad_left(year, 4) + '-' + fnc_pad_left(month,2) + '-' + fnc_pad_left(day, 2); $('#form-actualizar-datoslost input[name="birthday"]').val(date); if ($('#form-actualizar-datoslost input[name="birthday"]').attr('minbirthday') < date) { $('.js-error-lostdata small').empty().html('Debes ser mayor de edad.'); return false; } } fnc_ajax_send_form('form-actualizar-datoslost', '/ws/usuario_actualizar2', 'json', $('#form-actualizar-datoslost-send'), true, function(data) { fnc_message_back_modal(''); fnc_show_message('Datos actualizados', 'Tus datos se han guardado correctamente.', $('#form-actualizar-datoslost-send').attr('endpoint')); }, function(e, t) { }); } $(document).ready(function($) { // UPDATE DATA $("#form-actualizar-datoslost").validate({ ignore: [], rules: { //gender: {required: true}, //phone: {required: true, telefono: true, maxlength: 9, minlength: 9}, dob_day: {required: true}, dob_month: {required: true}, dob_year: {required: true}, }, highlight: function (element, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); $('.js-error-lostdata small').empty(); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); $('.js-error-lostdata small').empty(); }, errorElement: 'small', errorClass: 'input-error', validClass: 'success' }); $("#form-actualizar-datoslost input").keypress(function (event) { $('.js-error-lostdata small').empty(); if (event.which == 13) { event.preventDefault(); fnc_updatelogindata_send(); } }); $("#form-actualizar-datoslost select").change(function (event) { $('.js-error-lostdata small').empty(); }); $('#form-actualizar-datoslost-send').click(function(e) { e.preventDefault(); $('.js-error-lostdata small').empty(); fnc_updatelogindata_send(); }); }); function addItemDirect(elem) { if (parseInt($(elem).data('quantity')) < 1) return; if (_addItem_Sem) return; _addItem_Sem = true; var data = { 'variant' : $(elem).data('variant'), 'quantity' : $(elem).data('quantity') }; fnc_ajax_send_data( '/ws/micesta_agregar_item', data, 'json', $(elem), false, function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if ($('#modal-ficha-completa').length > 0) $('#modal-ficha-completa').modal('hide'); if (data.added) for (var i = 0 ; i < data.added.length ; i++) fnc_dlAddCart(data.added[i], data.added[i]['quantity']); $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); } function activarCompraUnica() { $('.js-moveToSus').addClass('d-none'); $('.js-moveToSusX').removeClass('d-none'); $('.caja-anadir-suscrip').addClass('d-none').removeClass('d-flex'); $('.js-btn-compraunica').addClass('active'); $('.js-btn-comprasus').removeClass('active'); } function activarCompraSuscripcion() { $('.js-moveToSus').removeClass('d-none'); $('.js-moveToSusX').addClass('d-none'); $('.caja-anadir-suscrip').removeClass('d-none').addClass('d-flex'); $('.js-btn-compraunica').removeClass('active'); $('.js-btn-comprasus').addClass('active'); } function checkNumMoveToSus() { let count = 0; $('.js-check-movetosus').each(function () { if ($(this).is(':checked')) count++; }); $('#moverSusNumero').empty().html(count + (count == 1 ? ' producto seleccionado':' productos seleccionados') + ' para suscripcion'); } function moverASuscripcion(reload) { if (_addItem_Sem) return; _addItem_Sem = true; let form_inputs = $('.js-check-movetosus'); let form_data = {}; let count = 0; form_inputs.each(function () { if ($(this).is(':checked')) { form_data['tosus'+count] = this.value; count++; } }); if (count < 1){ activarCompraUnica(); return; } fnc_ajax_send_data( '/ws/micesta_cambiar_a_suscripcion', form_data, 'json', false, false, function(data) { fnc_cookies_set('basket_not_empty', 1, 1); if (reload) { location.reload(true); return; } $('#mi-cesta').empty().html(data.basket); $('#menu-header-basket-quantity').empty().html(data.quantity); $('#menu-header-basket-price').empty().html(data.price + '€'); $('#menu-header-mobile-basket-quantity').empty().html(data.quantity); $('#menu-header-mobile-basket-price').empty().html(data.price); fnc_mostrarCesta(); _addItem_Sem = false; }, function(e, t) { _addItem_Sem = false; } ); }var _discover_vuse_slider_preguntas_frecuentes = false; var fnc_create_discover_vuse_slider_preguntas_frecuentes = function(){ if (_discover_vuse_slider_preguntas_frecuentes) return; _discover_vuse_slider_preguntas_frecuentes = true; $('.faqs-destacados-slick').slick({ infinite: false, arrows: false, dots: true, speed: 500, autoplay: false, autoplaySpeed: 3000, slidesToShow: 1, slidesToScroll: 1, mobileFirst: true, //centerMode: false, //centerPadding: '0px', // nextArrow: '
    siguiente
    ', // prevArrow: '
    previo
    ', responsive: [ { breakpoint: 992, settings: "unslick", }, { breakpoint: 768, settings: { dots: true, slidesToShow: 2, slidesToScroll: 1, } } ] }); } function fnc_formatStr(str){return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().replaceAll(" ", "").toLowerCase()} $(document).ready(function($){ fnc_create_discover_vuse_slider_preguntas_frecuentes(); $('#faqs-search-input').on("input", function(){ let text = $('#faqs-search-input').val(); if(text == ''){ $('.faqs-container').removeClass('d-none'); $('.faqs-lista-busqueda').addClass('d-none'); return; } $('.faqs-container').addClass('d-none'); $('.faqs-lista-busqueda').removeClass('d-none'); $('.faq-completa').addClass('d-none'); $('.faq-completa').find('.pregunta').each(function(i) { if(fnc_formatStr($(this).text()).includes(fnc_formatStr(text))){ $(this).parents('.faq-completa').removeClass('d-none') } }) $('.faq-completa.d-none').find('.respuesta').each(function(i) { if(fnc_formatStr($(this).text()).includes(fnc_formatStr(text))){ $(this).parents('.faq-completa').removeClass('d-none') } }) }); $('.btn-faq-destacado11').on('click', function(){ console.log($(this).data('id')) const id = $(this).data('id'); const pregunta = $(this).data('pregunta'); $('.faq-completa').addClass('d-none'); $('.faqs-lista-busqueda').removeClass('d-none'); $('[data-id='+ id +'][data-pregunta="' + pregunta + '"]').removeClass('d-none') console.log('[data-id='+ id +'][data-pregunta="' + pregunta + '"]') $("html, body").animate({ scrollTop: $(".faqs-lista-busqueda").offset().top - 500 }, 800); setTimeout(() => { let elemento = $('[data-id=' + id + '][data-pregunta="' + pregunta + '"]').find('.collapse-anim'); console.log(elemento.attr('aria-expanded')) if (elemento.hasClass('collapsed') || !elemento.find('.vertical').hasClass('animate')) { elemento.click(); } }, 1000); }) });