1$(document).ready(function () { 2 3 $(".form-control").on("focus",function() { 4 oculta_error_input_contact($(this)); 5 }); 6 7 //home 8 //initParallaxBanners(); 9 //initBannerBlog(); 10 11 /* 12 $('.video_mobile').on('play', function(e){ 13 getFullscreen(this); 14 }); 15 */ 16 17 if ($('.auction-lots-view-expo').length) { 18 dinamicTopSticky(); 19 } 20 21 $("#country").change(function () { 22 var selected_country = $("#frmRegister-adv #country").val(); 23 if (selected_country == "ES") { 24 $('#dni').prop("required", true); 25 $('#cpostal').prop("required", true); 26 } else { 27 $('#dni').removeAttr("required"); 28 $('#cpostal').removeAttr("required"); 29 } 30 }); 31 32 $('.lazy').Lazy({ 33 // your configuration goes here 34 scrollDirection: 'vertical', 35 effect: 'fadeIn', 36 visibleOnly: true, 37 onError: function (element) { 38 console.log('error loading ' + element.data('src')); 39 } 40 }); 41 42 $('.switcher').click(function () { 43 $(this).toggleClass('switcher-active'); 44 45 }); 46 47 $('.tabs-custom ul li').click(function (e) { 48 49 var elFather = $(this).parents('.tabs-custom'); 50 var elBro = $(elFather).siblings('.tab-content'); 51 52 53 $(elBro).fadeOut(200); 54 $('.loading-page').show(500); 55 if ($('.adj').length) { 56 $('.adj').hide(); 57 } 58 59 }); 60 $(document).scroll(function (e) { 61 if ($(document).scrollTop() > 100) { 62 $('.button-up').show(500) 63 } 64 if ($(document).scrollTop() <= 100) { 65 $('.button-up').hide(500) 66 } 67 }) 68 69 70 $('.button-up').click(function () { 71 72 $('html,body').animate({ scrollTop: 0 }, 500); 73 }); 74 75 $("#owl-carousel-responsive").owlCarousel({ 76 items: 1, 77 autoplay: false, 78 margin: 20, 79 dots: true, 80 nav: false, 81 responsiveClass: true, 82 }); 83 84 $("#accerder-user-form input[name='password']").on('keyup', function (e) { 85 if (e.keyCode == 13) { 86 $("#accerder-user").click() 87 } 88 }); 89 90 $("#accerder-user-form-responsive input[name='password']").on('keyup', function (e) { 91 if (e.keyCode == 13) { 92 $("#accerder-user-responsive").click() 93 } 94 }); 95 96 $('.login').on('click', function () { 97 $.magnificPopup.close(); 98 $('#loginResponsive').removeClass('fadeOutDown'); 99 $('#loginResponsive').show().addClass('animated fadeInDown'); 100 }); 101 $('#closeResponsive').on('click', function () { 102 $('#loginResponsive').addClass('animated fadeOutDown').removeClass('fadeInDown'); 103 setTimeout(function () { 104 $('#loginResponsive').hide(); 105 }, 1000); 106 107 }) 108 109 $('#btnResponsive').on('click', function () { 110 $('#menuResponsive').show().addClass('animated fadeInLeft').removeClass('fadeOutLeft'); 111 }); 112 $('#btnResponsiveClose').on('click', function () { 113 $('#menuResponsive').addClass('animated fadeOutLeft').removeClass('fadeInLeft'); 114 }); 115 116 $('.btn_login_desktop').on('click', function () { 117 $.magnificPopup.close(); 118 $('.login_desktop').fadeToggle("fast"); 119 }); 120 $('.closedd').on('click', function () { 121 $('.login_desktop').fadeToggle("fast"); 122 }); 123 124 $("#accerder-user").click(function () { 125 $.ajax({ 126 type: "POST", 127 url: '/login_post_ajax', 128 data: $('#accerder-user-form').serialize(), 129 success: function (response) { 130 if (response.status == 'success') { 131 location.reload(); 132 } else { 133 $(".message-error-log").text('').append(messages.error[response.msg]); 134 } 135 136 } 137 }); 138 }); 139 140 $('#newsletter-btn').on('click', newsletterSuscription); 141 $('#newsletterForm').on('submit', newsletterFormSuscription); 142 143 $('#frmUpdateUserPasswordADV').validator().on('submit', function (e) { 144 145 if (e.isDefaultPrevented()) { 146 // formulario incorrecto 147 } else { 148 149 e.preventDefault(); 150 var $this = $(this); 151 152 $('button', $this).attr('disabled', 'disabled'); 153 // Datos correctos enviamos ajax 154 $.ajax({ 155 type: "POST", 156 url: '/api-ajax/client/update/password', 157 data: $('#frmUpdateUserPasswordADV').serialize(), 158 beforeSend: function () { 159 //$('#btnRegister').prepend(' <i class="fa fa-spinner fa-pulse fa-fw margin-bottom"></i> '); 160 }, 161 success: function (response) { 162 163 $('button', $this).attr('disabled', false); 164 165 res = jQuery.parseJSON(response); 166 167 if (res.err == 1) { 168 $('.insert_msg').html('<div class="alert alert-danger">' + messages.error[res.msg] + '</div>'); 169 } else { 170 $('.insert_msg').html('<div class="alert alert-success">' + messages.success[res.msg] + '</div>'); 171 } 172 173 } 174 }); 175 176 } 177 }); 178 179 $('#frmUpdateUserInfoADV').validator().on('submit', function (e) { 180 181 if (e.isDefaultPrevented()) { 182 // formulario incorrecto 183 } else { 184 185 e.preventDefault(); 186 var $this = $(this); 187 188 $('button', $this).attr('disabled', 'disabled'); 189 // Datos correctos enviamos ajax 190 $.ajax({ 191 type: "POST", 192 url: '/api-ajax/client/update', 193 data: $('#frmUpdateUserInfoADV').serialize(), 194 beforeSend: function () { 195 $('#btnRegister').prepend(' <i class="fa fa-spinner fa-pulse fa-fw margin-bottom"></i> '); 196 }, 197 success: function (response) { 198 199 $('button', $this).attr('disabled', false); 200 201 res = jQuery.parseJSON(response); 202 203 if (res.err == 1) { 204 $('.col_reg_form').html('<div class="alert alert-danger">' + messages.error[res.msg] + '</div>'); 205 } else { 206 $('.col_reg_form').html('<div class="alert alert-success">' + messages.success[res.msg] + '</div>'); 207 } 208 } 209 210 }); 211 212 $('button', $this).attr('disabled', false); 213 214 } 215 }); 216 217 $("#confirm_orden").click(function () { 218 imp = $("#bid_modal_pujar").val(); 219 $.ajax({ 220 type: "POST", 221 url: routing.ol + '-' + cod_sub, 222 data: { cod_sub: cod_sub, ref: ref, imp: imp }, 223 success: function (data) { 224 if (data.status == 'error') { 225 226 $("#insert_msg_title").html(""); 227 $("#insert_msg").html(data.msg_1); 228 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 229 } else if (data.status == 'success') { 230 $("#tuorden").html(data.imp); 231 $("#text_actual_no_bid").addClass("hidden"); 232 $("#text_actual_max_bid").removeClass("hidden"); 233 $("#actual_max_bid").html(data.open_price); 234 $("#insert_msg_title").html(""); 235 $("#insert_msg").html(data.msg); 236 $(".hist_new").removeClass("hidden"); 237 $(".custom").removeClass("hidden"); 238 $("#bid_modal_pujar").val(data.imp_actual); 239 if (data.winner) { 240 $(".no_winner").addClass("hidden"); 241 $(".winner").removeClass("hidden"); 242 } else { 243 $(".no_winner").removeClass("hidden"); 244 $(".winner").addClass("hidden"); 245 } 246 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 247 } 248 249 } 250 }); 251 252 253 }); 254 255 $("#confirm_orden_lotlist").click(function () { 256 imp = $(".precio_orden").html(); 257 ref = $(".ref_orden").html(); 258 $.ajax({ 259 type: "POST", 260 url: routing.ol + '-' + cod_sub, 261 data: { cod_sub: cod_sub, ref: ref, imp: imp }, 262 success: function (data) { 263 if (data.status == 'error') { 264 265 $("#insert_msg_title").html(""); 266 $("#insert_msg").html(data.msg_1); 267 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 268 } else if (data.status == 'success') { 269 $("#insert_msg_title").html(""); 270 $("#insert_msg").html(data.msg); 271 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 272 } 273 274 } 275 }); 276 277 278 }); 279 280 $("#accerder-user-responsive").click(function (event) { 281 event.preventDefault(); 282 $.ajax({ 283 type: "POST", 284 url: '/login_post_ajax', 285 data: $('#accerder-user-form-responsive').serialize(), 286 success: function (response) { 287 if (response.status == 'success') { 288 location.reload(); 289 } else { 290 $(".message-error-log").text('').append(messages.error[response.msg]); 291 } 292 293 } 294 }); 295 }); 296 297 $('.lot-action_comprar_lot').on('click', function (e) { 298 e.stopPropagation(); 299 $.magnificPopup.close(); 300 if (typeof cod_licit == 'undefined' || cod_licit == null) { 301 $("#insert_msg").html(""); 302 $("#insert_msg").html(messages.error.mustLogin); 303 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 304 } else { 305 $.magnificPopup.open({ items: { src: '#modalComprarFicha' }, type: 'inline' }, 0); 306 } 307 308 }); 309 310 $(window).resize(function () { 311 if ($(window).width() < 1200) {
312 $('.small_square .item_lot').removeClass('col'); 313 } 314 315 if ($('.auction-lots-view-expo').length) { 316 dinamicTopSticky(); 317 } 318 }); 319 320 $("#save_change_orden").click(function () { 321 322 var cod_sub = $(this).attr('cod_sub'); 323 var ref = $(this).attr('ref'); 324 var order = $(this).attr('order'); 325 $.ajax({ 326 type: "POST", 327 url: url_orden + '-' + cod_sub, 328 data: { cod_sub: cod_sub, ref: ref, imp: order }, 329 success: function (res) { 330 if (res.status == 'success') { 331 $("#modalMensaje #insert_msg").html(''); 332 $("#modalMensaje #insert_msg").html(res.msg); 333 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 334 change_price_saved_offers(); 335 } else { 336 $("#modalMensaje #insert_msg").html(''); 337 $("#modalMensaje #insert_msg").html(res.msg_1); 338 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 339 } 340 } 341 342 }); 343 }); 344 345 $('.save_orders').validator().on('submit', function (e) { 346 var order; 347 if (e.isDefaultPrevented()) { 348 349 } else { 350 e.preventDefault() 351 var save_orders = $(this).serializeArray(); 352 $.each(save_orders, function (i, field) { 353 $("#save_change_orden").attr(field.name, field.value); 354 if (field.name == 'order') { 355 order = field.value 356 } 357 }); 358 $(".precio_orden").html(''); 359 $(".precio_orden").html(order); 360 361 $.magnificPopup.open({ items: { src: '#changeOrden' }, type: 'inline' }, 0); 362 } 363 }); 364 365 $(".confirm_delete").click(function () { 366 var ref = $(this).attr("ref"); 367 var sub = $(this).attr("sub"); 368 $.magnificPopup.close(); 369 $.ajax({ 370 type: "POST", 371 url: '/api-ajax/delete_order', 372 data: { ref: ref, sub: sub }, 373 success: function (response) { 374 res = jQuery.parseJSON(response); 375 if (res.status == 'success') { 376 $("#" + res.respuesta).remove(); 377 $("#insert_msg").html(messages.success[res.msg]); 378 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 379 change_price_saved_offers(); 380 } else { 381 if ($(res.respuesta).empty()) { 382 $("#" + res.respuesta + " .form-group-custom input").addClass("has-error-custom"); 383 } 384 $("#insert_msg").html(messages.error[res.msg]); 385 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 386 } 387 388 } 389 390 }); 391 }); 392 393 $(".delete_order").click(function () { 394 var ref = $(this).attr("ref"); 395 var sub = $(this).attr("sub"); 396 $(".confirm_delete").attr("price", $("#" + sub + "-" + ref + " input").val()); 397 $(".confirm_delete").attr("ref", ref); 398 $(".confirm_delete").attr("sub", sub); 399 $("#insert_msg_delete").html(messages.neutral.confirm_delete); 400 $.magnificPopup.open({ items: { src: '#modalMensajeDelete' }, type: 'inline' }, 0); 401 }); 402 403 $("#form-valoracion-adv").submit(async function (event) { 404 405 event.preventDefault(); 406 407 var max_size = 20; 408 var size = 0; 409 $(event.target.files.files).each(function (index, element) { 410 size = parseInt((element.size / 1024 / 1024).toFixed(2)) + parseInt(size); 411 }); 412 413 const captcha = await isValidCaptcha(); 414 formData = new FormData(this); 415 416 if ((size < max_size) && captcha) { 417 $.ajax({ 418 type: "POST", 419 url: "valoracion-articulos-adv", 420 data: formData, 421 enctype: 'multipart/form-data', 422 processData: false, 423 contentType: false, 424 success: function (result) { 425 if (result.status == 'correct') { 426 window.location.href = result.url; 427 } else if (result.status == 'error_size') { 428 $("#modalMensaje #insert_msg").html(''); 429 $("#modalMensaje #insert_msg").html(messages.error[result.msg]); 430 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 431 } else { 432 $(".msg_valoracion").removeClass('hidden'); 433 } 434 }, 435 error: function (result) { 436 $(".msg_valoracion").removeClass('hidden'); 437 } 438 }); 439 } else { 440 $("#insert_msg").html(messages.error.max_size_img); 441 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 442 } 443 }); 444 445 $('.content_item_mini').hover(function (e) { 446 447 var el, newPos, capaOculta, vwCapaOculta, vwWindow; 448 el = $(this) 449 posEl = el.offset() 450 capaOculta = $(this).siblings($('.capaOculta')) 451 capaOculta.show() 452 posLeft = posEl.left 453 vwWindow = $(window).width() / 2 454 455 if (posLeft > vwWindow) { 456 vwCapaOculta = ($('.capaOculta').width() / 2); 457 newPos = posLeft - vwCapaOculta; 458 newpos2 = ($('.capaOculta').offset().left - vwCapaOculta) - 90 459 capaOculta.css("left", newpos2 + 'px'); 460 461 462 } else { 463 464 newpos2 = 0 465 } 466 capaOculta.css("left", newpos2 + 'px'); 467 468 var posElTop = el.offset().top 469 vhWindow = $(window).height() / 2 470 471 if (posElTop > vhWindow) { 472 console.log(vhWindow) 473 if ($(document).scrollTop() > 200) { 474 475 } 476 477 var newPosTop = -400 + ($(document).scrollTop()); 478 479 capaOculta.css("top", '-400px'); 480 481 } 482 483 484 }, function () { 485 var capaOculta = $(this).siblings($('.capaOculta')) 486 capaOculta.hide() 487 }) 488 489 $('input[type=file]#files').change(updateImageDisplay); 490 491 $('#admin_settings_box').on('click', '.desplegable', function () { 492 if ($('#admin_settings_box').hasClass('opened_box')) { 493 $('#admin_settings_box').removeClass('opened_box'); 494 $('[data-id="left"]', this).addClass('hidden'); 495 $('[data-id="right"]', this).removeClass('hidden'); 496 } else { 497 $('#admin_settings_box').addClass('opened_box'); 498 $('[data-id="right"]', this).addClass('hidden'); 499 $('[data-id="left"]', this).removeClass('hidden'); 500 501 } 502 }); 503 504}); 505 506/** 507 * @deprecated 508 */ 509function initParallaxBanners() { 510 const bansParallax = $('.bann-parallax'); 511 512 if (typeof bansParallax == 'undefined') { 513 return; 514 } 515 516 window.addEventListener('scroll', function () { 517 518 if (window.innerWidth < 768) { 519 return; 520 } 521 522 const value = window.scrollY; 523 const value2 = value - 1200; 524 525 for (const ban of bansParallax) { 526 if ($(ban).css('min-height') == '500px') { 527 ban.style.backgroundPosition = 'center ' + -value2 * 0.25 + 'px'; 528 } 529 else { 530 ban.style.backgroundPosition = 'center ' + -value * 0.25 + 'px'; 531 } 532 } 533 }); 534} 535 536/** 537* @deprecated 538*/ 539function initBannerBlog() { 540 $('#blog-home').slick({ 541 slidesToScroll: 1, 542 rows: 1, 543 centerMode: true, 544 centerPadding: '400px', 545 /*slidesPerRow: 4,*/ 546 slidesToShow: 1,
547 arrows: false, 548 autoplay: true, 549 autoplaySpeed: 5000, 550 swipeToSlide: true, 551 responsive: [ 552 { 553 breakpoint: 1400, 554 settings: { 555 centerPadding: '250px', 556 } 557 }, 558 { 559 breakpoint: 1024, 560 settings: { 561 centerPadding: '200px', 562 } 563 }, 564 { 565 breakpoint: 780, 566 settings: { 567 centerPadding: '175px', 568 } 569 }, 570 { 571 breakpoint: 600, 572 settings: { 573 centerMode: false, 574 //centerPadding: '150px', 575 } 576 }, 577 { 578 breakpoint: 480, 579 settings: { 580 centerMode: false, 581 //centerPadding: '75px', 582 } 583 } 584 585 ] 586 }); 587} 588 589function cerrarLogin() { 590 $('.login_desktop').fadeToggle("fast"); 591} 592 593function ajax_carousel(key, replace, centerMode = false) { 594 595 $("#" + key).siblings().removeClass('hidden'); 596 getCarousel(key, {...replace, view: true}) 597 .then((result) => { 598 $("#" + key).siblings('.loader').addClass('hidden'); 599 $("#" + key).html(result); 600 if (centerMode) { 601 carrousel_centerMode($("#" + key)); 602 } 603 else { 604 carrousel_molon($("#" + key)); 605 } 606 $('[data-countdown]').each(function () { 607 $(this).data('ini', new Date().getTime()); 608 countdown_timer($(this)); 609 }); 610 }); 611}; 612 613function ajax_newcarousel(key, replace, lang) { 614 615 getCarousel(key, {...replace, view: true}) 616 .then((result) => { 617 618 if (result === '') { 619 $("#" + key + '-content').hide(); 620 } 621 $("#" + key).siblings('.loader').addClass('hidden'); 622 $("#" + key).html(result); 623 624 $('[data-countdown]').each(function (event) { 625 var countdown = $(this); 626 countdown.data('ini', new Date().getTime()); 627 countdown_timer(countdown); 628 }); 629 630 if (key === 'lotes_destacados') { 631 carrousel_molon($("#" + key)); 632 } else { 633 carrousel_molon_new($("#" + key)); 634 } 635 }); 636 637}; 638 639function format_date(fecha) { 640 641 var horas = fecha.getHours(); 642 var minutos = fecha.getMinutes(); 643 var mes; 644 if (horas < 10) { 645 horas = '0' + horas 646 } 647 if (minutos < 10) { 648 minutos = '0' + minutos 649 } 650 651 $.each(traductions, function (key, value) { 652 if (key == $.datepicker.formatDate("M", fecha)) { 653 mes = value; 654 } 655 }); 656 657 var formatted = $.datepicker.formatDate("dd ", fecha) + mes + " " + horas + ":" + minutos; 658 return formatted; 659} 660 661function carrousel_centerMode(carrousel) { 662 663 if (carrousel.data('hasSlick')) { 664 carrousel.slick('unslick'); 665 } 666 667 var rows = 1; 668 /*Si se añaden más de una fila, estas no cambian al reducir pantalla 669 //Establecer desde el inicio 670 if(window.innerWidth < 1024){ 671 rows = 1; 672 }*/ 673 674 /** 675 * Si se utilizan más de un row, se tiene en cuenta slidesPerRow 676 * En caso de usar un solo row, se utiliza slidesToShow 677 * Utilizar los dos, crea conflictos... 678 */ 679 680 carrousel.slick({ 681 slidesToScroll: 1, 682 rows: rows, 683 centerMode: true, 684 centerPadding: '200px', 685 /*slidesPerRow: 4,*/ 686 slidesToShow: 3, 687 arrows: false, 688 autoplay: true, 689 autoplaySpeed: 3000, 690 swipeToSlide: true, 691 responsive: [ 692 { 693 breakpoint: 1400, 694 settings: { 695 centerPadding: '175px', 696 } 697 }, 698 { 699 breakpoint: 1024, 700 settings: { 701 centerPadding: '100px', 702 } 703 }, 704 { 705 breakpoint: 900, 706 settings: { 707 slidesToShow: 1, 708 centerPadding: '175px', 709 } 710 }, 711 { 712 breakpoint: 780, 713 settings: { 714 slidesToShow: 1, 715 centerPadding: '175px', 716 } 717 }, 718 { 719 breakpoint: 600, 720 settings: { 721 slidesToShow: 1, 722 centerPadding: '150px', 723 } 724 }, 725 { 726 breakpoint: 480, 727 settings: { 728 slidesToShow: 1, 729 centerPadding: '75px', 730 } 731 } 732 733 ] 734 }); 735 736 carrousel.data('hasSlick', true); 737} 738 739function carrousel_molon(carrousel) { 740 741 if (carrousel.data('hasSlick')) { 742 carrousel.slick('unslick'); 743 } 744 745 var rows = 1; 746 /*Si se añaden más de una fila, estas no cambian al reducir pantalla 747 //Establecer desde el inicio 748 if(window.innerWidth < 1024){ 749 rows = 1; 750 }*/ 751 752 /** 753 * Si se utilizan más de un row, se tiene en cuenta slidesPerRow 754 * En caso de usar un solo row, se utiliza slidesToShow 755 * Utilizar los dos, crea conflictos... 756 */ 757 758 carrousel.slick({ 759 slidesToScroll: 1, 760 rows: rows, 761 autoplay: true, 762 /*slidesPerRow: 4,*/ 763 slidesToShow: 4, 764 arrows: true, 765 dots: true, 766 prevArrow: $('.fa-chevron-left'), 767 nextArrow: $('.fa-chevron-right'), 768 responsive: [ 769 { 770 breakpoint: 1024, 771 settings: { 772 slidesToShow: 3, 773 slidesToScroll: 3, 774 infinite: true, 775 776 rows: 1, 777 slidesPerRow: 3, 778 } 779 }, 780 { 781 breakpoint: 600, 782 settings: { 783 slidesToShow: 2, 784 slidesToScroll: 2, 785 rows: 1, 786 slidesPerRow: 2, 787 788 } 789 }, 790 { 791 breakpoint: 480, 792 settings: { 793 slidesToShow: 1, 794 slidesToScroll: 1, 795 rows: 1, 796 slidesPerRow: 1, 797 } 798 } 799 800 ] 801 }); 802 803 carrousel.data('hasSlick', true); 804} 805 806function carrousel_molon_new(carrousel) { 807 808 if (carrousel.data('hasSlick')) { 809 carrousel.slick('unslick'); 810 } 811 812 carrousel.slick({ 813 slidesToScroll: 3, 814 slidesToShow: 3,
815 arrows: false, 816 dots: true, 817 infinite: true, 818 swipeToSlide: false, 819 responsive: [ 820 { 821 breakpoint: 1200, 822 settings: { 823 slidesToShow: 2, 824 slidesToScroll: 2, 825 dots: false, 826 } 827 }, 828 { 829 breakpoint: 600, 830 settings: { 831 slidesToShow: 1, 832 slidesToScroll: 1, 833 dots: false, 834 } 835 } 836 ] 837 }); 838 839 carrousel.data('hasSlick', true); 840} 841 842 843function password_recovery(lang) { 844 var pass_recov = $("#password_recovery").serialize(); 845 $.ajax({ 846 type: "POST", 847 url: '/' + lang + '/ajax-send-password-recovery', 848 data: pass_recov, 849 success: function (data) { 850 if (data.status == 'error') { 851 $(".error-recovery").html(data.msg); 852 } else if (data.status == 'succes') { 853 $("#password_recovery").html(data.msg); 854 } 855 } 856 }); 857}; 858 859function format_date_large(fecha, text) { 860 861 var horas = fecha.getHours(); 862 var minutos = fecha.getMinutes(); 863 var mes; 864 if (horas < 10) { 865 horas = '0' + horas 866 } 867 if (minutos < 10) { 868 minutos = '0' + minutos 869 } 870 871 $.each(traduction_large, function (key, value) { 872 if (key == $.datepicker.formatDate("M", fecha)) { 873 mes = value; 874 } 875 }); 876 877 var formatted = $.datepicker.formatDate("dd ", fecha) + mes + " " + text + " " + horas + ":" + minutos + " h"; 878 return formatted; 879} 880 881 882 883function close_modal_session() { 884 885 $("#closeResponsive").trigger("click"); 886} 887 888 889 890 891function action_fav_modal(action) { 892 893 /* $('.button-follow').show(); 894 $('.button-follow-responsive').show(); */ 895 896 $.magnificPopup.close(); 897 if (typeof cod_licit == 'undefined' || cod_licit == null) { 898 $("#insert_msg").html(messages.error.mustLogin); 899 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 900 return; 901 } else { 902 $.ajax({ 903 type: "GET", 904 url: routing.favorites + "/" + action, 905 data: { cod_sub: cod_sub, ref: ref, cod_licit: cod_licit }, 906 success: function (data) { 907 /* $('.button-follow').hide(); 908 $('.button-follow-responsive').hide(); */ 909 910 if (data.status == 'error') { 911 $("#insert_msg").html(""); 912 $("#insert_msg").html(messages.error[data.msg]); 913 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 914 } else if (data.status == 'success') { 915 $("#insert_msg").html(""); 916 $("#insert_msg").html(messages.success[data.msg]); 917 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 918 if (action == 'add') { 919 $("#add_fav").addClass('hidden'); 920 $("#del_fav").removeClass('hidden'); 921 $(".slider-thumnail-container #add_fav").addClass('hidden'); 922 $(".slider-thumnail-container #del_fav").removeClass('hidden'); 923 924 925 } else { 926 $("#del_fav").addClass('hidden'); 927 $("#add_fav").removeClass('hidden'); 928 $(".slider-thumnail-container #add_fav").removeClass('hidden'); 929 $(".slider-thumnail-container #del_fav").addClass('hidden'); 930 931 } 932 933 } 934 935 } 936 }); 937 } 938}; 939 940function action_fav_lote(action, ref, cod_sub, cod_licit) { 941 routing.favorites = '/api-ajax/favorites'; 942 //$.magnificPopup.close(); 943 944 $.ajax({ 945 type: "GET", 946 url: routing.favorites + "/" + action, 947 data: { cod_sub: cod_sub, ref: ref, cod_licit: cod_licit }, 948 success: function (data) { 949 950 if (data.status == 'error') { 951 952 $("#insert_msg").html(""); 953 $("#insert_msg").html(messages.error[data.msg]); 954 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 955 } else if (data.status == 'success') { 956 $("#insert_msg").html(""); 957 $("#insert_msg").html(messages.success[data.msg]); 958 $.magnificPopup.open({ items: { src: '#modalMensaje' }, type: 'inline' }, 0); 959 $('.' + ref + '-' + cod_sub).remove(); 960 if (action == 'remove' && $('#heading-' + cod_sub + ' #' + cod_sub + ' .user-accout-items-content .user-accout-item-wrapper').length <= 0) { 961 $('#heading-' + cod_sub).remove(); 962 } 963 964 } 965 966 } 967 }); 968 969}; 970 971function change_price_saved_offers() { 972 var precio = 0; 973 $('input[name=order]').each(function () { 974 precio = parseInt($(this).val()) + parseInt(precio); 975 }) 976 $("#change_price").html(''); 977 $("#change_price").html(parseFloat(precio, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString()); 978} 979 980function reload_carrito() { 981 982 $.each(info_lots, function (index_sub, value_sub) { 983 var precio_envio = 0; 984 var sum_precio_envio = 0;
985 var precio_final = 0; 986 $.each(value_sub.lots, function (index, value) { 987 precio_final = precio_final + value.himp + value.iva + value.base; 988 sum_precio_envio = sum_precio_envio + value.himp + value.base; 989 }); 990 if (sum_precio_envio > 0) { 991 $.ajax({ 992 type: "POST", 993 async: false, 994 url: '/api-ajax/gastos_envio', 995 data: { 'precio_envio': sum_precio_envio }, 996 success: function (data) { 997 precio_envio = data.imp + data.iva; 998 999 } 1000 }); 1001 } 1002 $(".text-gasto-envio-" + index_sub).text(precio_envio); 1003 precio_final = parseFloat(precio_final) + parseFloat(precio_envio); 1004 $(".precio_final_" + index_sub).text(precio_final.toFixed(2).replace(".", ",")); 1005 if (precio_final <= 0) { 1006 $('.submit_carrito[cod_sub="' + index_sub + '"]').attr("disabled", "disabled"); 1007 } else { 1008 $('.submit_carrito[cod_sub="' + index_sub + '"]').removeAttr("disabled"); 1009 } 1010 }); 1011} 1012 1013function getFullscreen(element) { 1014 if (element.requestFullscreen) { 1015 element.requestFullscreen(); 1016 } else if (element.mozRequestFullScreen) { 1017 element.mozRequestFullScreen(); 1018 } else if (element.webkitRequestFullscreen) { 1019 element.webkitRequestFullscreen(); 1020 } else if (element.msRequestFullscreen) { 1021 element.msRequestFullscreen(); 1022 } 1023} 1024 1025function showLogin() { 1026 if (window.matchMedia("(max-width: 1200px)").matches) { 1027 $('.login').trigger('click'); 1028 } else { 1029 $('.btn_login_desktop').trigger('click'); 1030 } 1031} 1032 1033async function newsletterSuscription(event) { 1034 1035 const captcha = await isValidCaptcha(); 1036 if(!captcha){ 1037 showMessage(messages.error.recaptcha_incorrect); 1038 return; 1039 } 1040 1041 const email = $('.newsletter-input').val(); 1042 const lang = $('#lang-newsletter').val(); 1043 1044 if (!$('#condiciones').prop("checked") || !$('#comercial').prop("checked")) { 1045 $("#insert_msgweb").html(''); 1046 $("#insert_msgweb").html(messages.neutral.accept_condiciones); 1047 $.magnificPopup.open({ items: { src: '#modalMensajeWeb' }, type: 'inline' }, 0); 1048 return; 1049 } 1050 1051 const newsletters = {}; 1052 document.querySelectorAll(".js-newletter-block [name^=families]").forEach((element) => { 1053 if (element.checked || element.type === "hidden") { 1054 newsletters[`families[${element.value}]`] = '1'; 1055 } 1056 }); 1057 1058 const data = { 1059 email, 1060 lang, 1061 condiciones: 1, 1062 ...newsletters 1063 } 1064 1065 if($('[name="captcha_token"]').length) { 1066 data.captcha_token = $('[name="captcha_token"]').val(); 1067 } 1068 1069 addNewsletter(data); 1070} 1071 1072async function newsletterFormSuscription(event) { 1073 event.preventDefault(); 1074 1075 const captcha = await isValidCaptcha(); 1076 if(!captcha){ 1077 showMessage(messages.error.hasErrors); 1078 return; 1079 } 1080 1081 if (!$("[name=condiciones]").prop("checked")) { 1082 $("#insert_msgweb").html(''); 1083 $("#insert_msgweb").html(messages.neutral.accept_condiciones); 1084 $.magnificPopup.open({ items: { src: '#modalMensajeWeb' }, type: 'inline' }, 0); 1085 return; 1086 } 1087 const data = $(event.target).serialize(); 1088 1089 addNewsletter(data); 1090} 1091 1092function addNewsletter(data) { 1093 $.ajax({ 1094 type: "POST", 1095 data: data, 1096 url: '/api-ajax/newsletter/add', 1097 success: function (msg) { 1098 if (msg.status == 'success') { 1099 $('.insert_msg').html(messages.success[msg.msg]); 1100 } else { 1101 $('.insert_msg').html(messages.error[msg.msg]); 1102 } 1103 $.magnificPopup.open({ items: { src: '#newsletterModal' }, type: 'inline' }, 0); 1104 }, 1105 error: function (error) { 1106 $('.insert_msg').html(messages.error.message_500); 1107 $.magnificPopup.open({ items: { src: '#newsletterModal' }, type: 'inline' }, 0); 1108 } 1109 }); 1110} 1111 1112$(document).on("change", ".add_factura", function () { 1113 reload_facturas(); 1114}); 1115 1116$(document).on("click", "#submit_fact", function () { 1117 payFacs(); 1118}); 1119 1120function reload_facturas() { 1121 1122 var total = 0; 1123 1124 for (const factura of pendientes) { 1125 1126 if ($(`#checkFactura-${factura.anum_pcob}-${factura.num_pcob}-${factura.efec_pcob}`).is(":checked")) { 1127 total += parseFloat(factura.imp_pcob); 1128 } 1129 } 1130 1131 if (total > 0) { 1132 $("#submit_fact").removeClass('hidden'); 1133 } else { 1134 $("#submit_fact").addClass('hidden'); 1135 } 1136 $("#total_bills").html(change_currency(total)); 1137 // Hacer la lÃnea $("#total_bills").html(change_currency(total)); sin jquery 1138 1139} 1140 1141function payFacs(button) { 1142 1143 $("#btoLoader").siblings().addClass('hidden'); 1144 $("#btoLoader").removeClass('hidden'); 1145 1146 var pay_fact = $('#pagar_fact').serializeArray(); 1147 var total = 0; 1148 1149 for (const factura of pendientes) { 1150 if ($(`#checkFactura-${factura.anum_pcob}-${factura.num_pcob}-${factura.efec_pcob}`).is(":checked")) { 1151 total += parseFloat(factura.imp_pcob); 1152 } 1153 } 1154 1155 if (total > 0) { 1156 $.ajax({ 1157 type: "POST", 1158 url: '/gateway/pagarFacturasWeb', 1159 data: pay_fact, 1160 success: function (data) { 1161 if (data.status == 'success') { 1162 window.location.href = data.msg; 1163 } else 1164 if (data.status == 'error') {
1165 $("#modalMensaje #insert_msg").html(''); 1166 $("#modalMensaje #insert_msg").html(messages.error.generic); 1167 $.magnificPopup.open({ 1168 items: { 1169 src: '#modalMensaje' 1170 }, 1171 type: 'inline' 1172 }, 0); 1173 1174 } 1175 $("#btoLoader").siblings().removeClass('hidden'); 1176 $("#btoLoader").addClass('hidden'); 1177 1178 }, 1179 error: function (response) { 1180 $("#modalMensaje #insert_msg").html(''); 1181 $("#modalMensaje #insert_msg").html(messages.error.generic); 1182 $.magnificPopup.open({ 1183 items: { 1184 src: '#modalMensaje' 1185 }, 1186 type: 'inline' 1187 }, 0); 1188 $("#btoLoader").siblings().removeClass('hidden'); 1189 $("#btoLoader").addClass('hidden'); 1190 } 1191 }); 1192 1193 } 1194}; 1195 1196function change_currency(price) { 1197 var price = numeral(price).format('0,0.00'); 1198 return price; 1199}; 1200 1201$(document).on("click", ".panel-collapse", openCloseToggle); 1202 1203function openCloseToggle() { 1204 let condition = $(this).find(".toggle-open").css("display") != "none" && $(this).find(".label-open").css("display") != "none"; 1205 1206 if (condition) { 1207 $(this).find(".toggle-open").hide(); 1208 $(this).find(".toggle-close").show(); 1209 $(this).find(".label-open").hide(); 1210 $(this).find(".label-close").show(); 1211 } else { 1212 $(this).find(".toggle-close").hide(); 1213 $(this).find(".toggle-open").show(); 1214 $(this).find(".label-close").hide(); 1215 $(this).find(".label-open").show(); 1216 } 1217} 1218 1219$(document).on("click", "#button-open-user-menu", function () { 1220 $('#user-account-ul').toggle() 1221}); 1222 1223/** 1224 * Mantiene los filtros del grid en la posición correcta 1225 * @returns {void} 1226 */ 1227function dinamicTopSticky() { 1228 if (window.innerWidth < 992) { 1229 return; 1230 } 1231 1232 const heightExpoElement = document.querySelector('.expo-container').offsetHeight; 1233 const stickyElement = document.querySelector('.auction-lots-view-expo'); 1234 const top = heightExpoElement + 30; 1235 stickyElement.style.setProperty('--top-position', `-${top}px`); 1236} 1237 1238function clickControl(el){ 1239 1240 const posScroll = $('.slider-thumnail-container').scrollTop(); 1241 1242 let positionMove = $('.ficha-thumnail').outerHeight(); 1243 if($(el).hasClass('row-up')) { 1244 positionMove = -positionMove; 1245 } 1246 1247 $('.slider-thumnail-container').animate({ 1248 scrollTop: posScroll + positionMove, 1249 }, 200); 1250 1251} 1252 1253 1254function oculta_error_input_contact(campo) { 1255 1256 id = $(campo).attr("id"); 1257 1258 $(campo).addClass('has-content'); 1259 1260 $("label[for="+id+"]").removeClass('has-error'); 1261 $(campo).removeClass('has-error'); 1262 $(campo).removeClass('is-invalid'); 1263 1264 if (campo.value != "" && campo.value != null) { 1265 $(campo).addClass('has-content'); 1266 } 1267 else { 1268 $(campo).removeClass('has-content'); 1269 $(campo).parent().removeClass('has-content'); 1270 } 1271 1272} 1273 1274 1275/****************************************************************************************/ 1276/************************* FIN FUNCIONES SOBRE PANTALLA CONTACTO ************************/ 1277/****************************************************************************************/ 1278 1279function updateImageDisplay() { 1280 const preview = document.querySelector(".contact-images-preview"); 1281 const input = document.querySelector("input[type=file]#files"); 1282 1283 while (preview.firstChild) { 1284 preview.removeChild(preview.firstChild); 1285 } 1286 1287 const curFiles = input.files; 1288 if (curFiles.length === 0) { 1289 const para = document.createElement("p"); 1290 para.textContent = "No files currently selected for upload"; 1291 preview.appendChild(para); 1292 } else { 1293 const list = document.createElement("ul"); 1294 preview.appendChild(list); 1295 1296 for (const file of curFiles) { 1297 const listItem = document.createElement("li"); 1298 const para = document.createElement("p"); 1299 if (validFileType(file)) { 1300 para.textContent = `File size ${returnFileSize( 1301 file.size, 1302 )}.`; 1303 const image = document.createElement("img"); 1304 image.src = URL.createObjectURL(file); 1305 image.alt = image.title = file.name; 1306 1307 listItem.appendChild(image); 1308 listItem.appendChild(para); 1309 } else { 1310 para.textContent = `File name ${file.name}: Not a valid file type. Update your selection.`; 1311 listItem.appendChild(para); 1312 } 1313 1314 list.appendChild(listItem); 1315 } 1316 } 1317} 1318 1319const fileTypes = [ 1320 "image/apng", 1321 "image/bmp", 1322 "image/gif", 1323 "image/jpeg", 1324 "image/pjpeg", 1325 "image/png", 1326 "image/svg+xml", 1327 "image/tiff", 1328 "image/webp", 1329 "image/x-icon", 1330]; 1331 1332function validFileType(file) { 1333 return fileTypes.includes(file.type); 1334} 1335 1336function returnFileSize(number) { 1337 if (number < 1024) { 1338 return `${number} bytes`; 1339 } else if (number >= 1024 && number < 1048576) { 1340 return `${(number / 1024).toFixed(1)} KB`; 1341 } else if (number >= 1048576) { 1342 return `${(number / 1048576).toFixed(1)} MB`; 1343 } 1344} 1345 1346/** 1347 * @var {int} timer - Tiempo en segundos 1348 */ 1349time_format = function(timer, format) { 1350 const days = calc_day(timer); 1351 const hours = calc_hour(timer); 1352 const totalHours = timer / 3600; 1353 const minutes = calc_minute(timer); 1354 const seconds = calc_seconds(timer); 1355 1356 if(totalHours >= 24) { 1357 return format.replace('%D', days) 1358 .replace('%H', hours) 1359 .replace('%Mm', '') 1360 .replace('%Ss', ''); 1361 } 1362 else if(totalHours >= 1) { 1363 return format.replace('%H', hours) 1364 .replace('%M', minutes) 1365 .replace('%Dd', '') 1366 .replace('%Ss', ''); 1367 } 1368 else { 1369 return format.replace('%M', minutes) 1370 .replace('%S', seconds) 1371 .replace('%Dd', '') 1372 .replace('%Hh', ''); 1373 1374 } 1375}
1375 1376 1377function showModal(name) { 1378 $.magnificPopup.open({ items: { src: name }, type: 'inline' }, 0); 1379}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.