1$(document).ready(function () { 2 3 $(document).on('click', '.btn-pop-cobertura', function () { 4 $('#popup-check-cobertura').modal('show'); 5 }); 6 7 $('.select_shop21').each(function () { 8 $('.select_shop21').css('display', 'block'); 9 $(this).closest('.searchShop').find('.nice-select.selectpickers:last').remove(); 10 }); 11 12 13 $('#boxSearch').val(''); 14 $('#boxSearch').on('input', function () { 15 $('ul.ui-autocomplete').css('z-index', '4'); 16 $('ul.ui-autocomplete').css('width', '300px!important'); 17 // $('ul.ui-autocomplete').remoteAttr('style'); 18 19 var textBox = $("#boxSearch").val(); 20 var textBoxEspacion = textBox.replace(/ /g, '%20'); 21 22 $("#boxSearch").autocomplete({ 23 delay: 300, 24 source: function (request, response) { 25 $.ajax({ 26 url: baseUrl + 'getAllNews', 27 type: "POST", 28 data: { 29 textBox: textBoxEspacion.toLowerCase() 30 }, 31 success: function (data) { 32 response($.map(data, function (item) { 33 return { 34 label: item.title, 35 value: item.title, 36 url: item.url, 37 hash: item.hash 38 }; 39 })); 40 } 41 }); 42 }, select: function (e, ui) { 43 $('#newUrl').val(ui.item.hash); 44 }, 45 }).data("ui-autocomplete")._renderItem = function (ul, item) { 46 return $("<li></li>") 47 .data("item.autocomplete", item) 48 .append('<a class="elementSearch" href="' + item.url + '">' + item.label + '</a>') 49 .appendTo(ul); 50 }; 51 52 }); 53 54 55 $('.buscar_cp_inner').click(function () { 56 var cp = $('#cp').val(); 57 if (cp.length == 5 && cp != '' && cp != undefined) { 58 var href = baseUrl + 'buscar-delegacion/' + cp; 59 window.location.href = href; 60 return false; 61 } 62 }); 63 $('.nice-select.selectpickers.select_producto:last').each(function () { 64 $('.select_producto').css('display', 'block'); 65 $(this).remove(); 66 }); 67 68 $('.select_bloque1').each(function () { 69 $('.select_bloque1').css('display', 'block'); 70 $(this).closest('.blockBloque').find('.nice-select.selectpickers:last').remove(); 71 }); 72 $('.select_puerta1').each(function () { 73 $('.select_puerta1').css('display', 'block'); 74 $(this).closest('.blockPuerta').find('.nice-select.selectpickers:last').remove(); 75 }); 76 $('.select_escalera1').each(function () { 77 $('.select_escalera1').css('display', 'block'); 78 $(this).closest('.blockEscalera').find('.nice-select.selectpickers:last').remove(); 79 }); 80 $('.select_planta1').each(function () { 81 $('.select_planta1').css('display', 'block'); 82 $(this).closest('.blockPlanta').find('.nice-select.selectpickers:last').remove(); 83 }); 84 $('.select_puerta21').each(function () { 85 $('.select_puerta21').css('display', 'block'); 86 $(this).closest('.blockPuerta2').find('.nice-select.selectpickers:last').remove(); 87 }); 88 $('.select_det_puerta1').each(function () { 89 $('.select_det_puerta1').css('display', 'block'); 90 $(this).closest('.blockDetPuerta').find('.nice-select.selectpickers:last').remove(); 91 }); 92 $('.select_bis1').each(function () { 93 $('.select_bis1').css('display', 'block'); 94 $(this).closest('.blockBis').find('.nice-select.selectpickers:last').remove(); 95 }); 96 97 $('.select_letra1').each(function () { 98 $('.select_letra1').css('display', 'block'); 99 $(this).closest('.blockLetra').find('.nice-select.selectpickers:last').remove(); 100 }); 101 102 $('.select_provincia_franq1').each(function () { 103 $('.select_provincia_franq1').css('display', 'block'); 104 $(this).closest('.blockProvinciaFranq').find('.nice-select.selectpickers:last').remove(); 105 }); 106 107 $('.select_local_franq1').each(function () { 108 $('.select_local_franq1').css('display', 'block'); 109 $(this).closest('.blockLocalFranq').find('.nice-select.selectpickers:last').remove(); 110 }); 111 112 $('.select_exper_franq1').each(function () { 113 $('.select_exper_franq1').css('display', 'block'); 114 $(this).closest('.blockExperFranq').find('.nice-select.selectpickers:last').remove(); 115 }); 116 117 var url = $('.urlloquiero').attr('href'); 118 var direccionComprobar = "/hire/comprobar-cobertura?"; 119 var newUrl1 = ""; 120 //BOTONES IVA E IGIC 121 $('.home-price').click(function () { 122 if ($('.priceRate')) { 123 $('.priceRate').show(); 124 $('.home-price').addClass('active show'); 125 $('.urlloquiero').each(function () { 126 if ($(this).attr('href')) { 127 var split = $(this).attr('href').split('/'); 128 if ($(this).data('original-href')) { 129 split = $(this).data('original-href').split('/'); 130 } 131 var contSplit = split.length; 132 if (split[contSplit - 1] == 'igic' || split[contSplit - 1] == 'iva') { 133 if (split[0] != '') { 134 if (split[1] != 'es' && split[1] != 'en') { 135 split = split.slice(0, -1).join('/'); 136 } else { 137 split = split.slice(1, -1).join('/'); 138 } 139 } else { 140 if (split[1] != 'es' && split[1] != 'en') { 141 split = split.slice(1, -1).join('/'); 142 } else { 143 split = split.slice(2, -1).join('/'); 144 } 145 } 146 } else { 147 split = split.join('/'); 148 } 149 var newUrl = split + '/iva'; 150 $(this).attr('href', newUrl); 151 } 152 }); 153 newUrl1 = '/iva'; 154 } 155 if ($('.priceIGICRate')) { 156 157 // $('.urlloquiero').attr('href', url); 158 $('.priceIGICRate').hide(); 159 $('.home-price-igic').removeClass('active show'); 160 } 161 162 }); 163 164 $('.home-price-igic').click(function () { 165 console.log('click'); 166 if ($('.priceRate')) { 167 // $('.urlloquiero').attr('href', url); 168 $('.priceRate').hide(); 169 $('.home-price').removeClass('active show'); 170 } 171 if ($('.priceIGICRate')) { 172 $('.urlloquiero').each(function () { 173 if ($(this).attr('href')) { 174 var split = $(this).attr('href').split('/'); 175 176 if ($(this).data('original-href')) { 177 split = $(this).data('original-href').split('/'); 178 } 179 var contSplit = split.length; 180 if (split[contSplit - 1] == 'iva' || split[contSplit - 1] == 'igic') { 181 if (split[0] != '') { 182 if (split[1] != 'es' && split[1] != 'en') { 183 split = split.slice(0, -1).join('/'); 184 } else { 185 split = split.slice(1, -1).join('/'); 186 } 187 } else { 188 if (split[1] != 'es' && split[1] != 'en') { 189 split = split.slice(1, -1).join('/'); 190 } else { 191 split = split.slice(2, -1).join('/'); 192 } 193 } 194 } else { 195 split = split.join('/'); 196 } 197 var newUrl = split + '/igic'; 198 $(this).attr('href', newUrl); 199 } 200 }); 201 newUrl1 = '/igic'; 202 $('.priceIGICRate').show(); 203 $('.home-price-igic').addClass('active show'); 204 } 205 206 }); 207 208 209 $('.botonCheckClient').click(function () { 210 var hash = $(this).attr('data-hash'); 211
212 $('.hashBonoExtra').val(hash); 213 var direccion = direccionComprobar + hash; 214 if (newUrl1 != '') { 215 direccion = direccion + newUrl1; 216 } 217 $('.contratarTv').attr('href', direccion); 218 }); 219 220 221 //BOTONES MÃVIL 222 223 $('#movil-price').click(function () { 224 $('#movil-price').addClass('activeButtonMovil'); 225 $('#movil').addClass('show active'); 226 $('#movil').removeClass('hidden-Tab'); 227 $('#compartir-price').removeClass('activeButtonMovil'); 228 $('#bonos-movil').removeClass('activeButtonMovil'); 229 $('#compartir').removeClass('show active'); 230 $('#compartir').addClass('hidden-Tab'); 231 $('#bonos').removeClass('show active'); 232 $('#bonos').addClass('hidden-Tab'); 233 234 }); 235 236 $('#compartir-price').click(function () { 237 $('#compartir-price').addClass('activeButtonMovil'); 238 $('#compartir').addClass('show active'); 239 $('#compartir').removeClass('hidden-Tab'); 240 $('#movil-price').removeClass('activeButtonMovil'); 241 $('#bonos-movil').removeClass('activeButtonMovil'); 242 $('#movil').removeClass('show active'); 243 $('#movil').addClass('hidden-Tab'); 244 245 $('#bonos').removeClass('show active'); 246 $('#bonos').addClass('hidden-Tab'); 247 248 }); 249 250 $('#bonos-movil').click(function () { 251 $('#bonos-movil').addClass('activeButtonMovil'); 252 $('#bonos').addClass('show active'); 253 $('#bonos').removeClass('hidden-Tab'); 254 $('#compartir-price').removeClass('activeButtonMovil'); 255 $('#movil-price').removeClass('activeButtonMovil'); 256 $('#compartir').removeClass('show active'); 257 $('#compartir').addClass('hidden-Tab'); 258 $('#movil').removeClass('show active'); 259 $('#movil').addClass('hidden-Tab'); 260 261 }); 262 // 263 // $(document).on('click', '.btn-contratar-bono', function () { 264 // var hash = $(this).attr('data-hash'); 265 // $("#hashBonoExtra").val(hash); 266 // }); 267 $(document).on('click', '.buttonDetails', function () { 268 var hash = $(this).attr('data-hash'); 269 $.ajax({ 270 url: baseUrl + '/detailRate/' + hash, 271 dataType: 'json', 272 delay: 250, 273 data: {}, 274 success: function (data) { 275 console.log(data) 276 277 if (data) { 278 279 if (data.length > 0) { 280 $.each(data, function (i, item) { 281 $('.titleModal').empty() 282 $('.descriptionRate').empty() 283 $('#myModal').modal('show'); 284 var title = ''; 285 var description = ''; 286 if (item.name != '') { 287 title = item.name; 288 } 289 if (item.popup_text != '') { 290 description = item.popup_text; 291 } 292 $('.titleModal').append(title); 293 $('.descriptionRate').append(description); 294 }); 295 // if(data.name != '') 296 297 } else { 298 $('.titleModal').empty() 299 $('.descriptionRate').empty() 300 $('#kt_modal_rate').modal('show'); 301 $('.titleModal').append('No hay detalles para esta tarifa.'); 302 } 303 304 } 305 } 306 }); 307 }); 308 309 $('#buttonLanguage').click(function () { 310 console.log($(this).closest('.nav-item').find('.listLanguage')); 311 $(this).closest('.nav-item').find('.listLanguage').css('top', '1vw'); 312 }); 313 314 // $('#ya_cliente_2.check_iscliente_solicita').prop('checked', true); 315 // 316 // $('input[type=radio].check_iscliente_solicita').closest('#contactform').find('.emailLabel').hide(); 317 // 318 // $('input[type=radio].check_iscliente_solicita').change(function () { 319 // if (this.value == 'Y') { 320 // $(this).closest('#contactform').find('.emailLabel').show(); 321 // $(this).closest('#contactform').find('#email').prop('required', true); 322 // } else if (this.value == 'N') { 323 // $(this).closest('#contactform').find('.emailLabel').hide(); 324 // $(this).closest('#contactform').find('#email').prop('required', false); 325 // } 326 // }); 327 328 var $form = $('#callYou').find('#contactform'); 329 var $blocks = $form.find('#dynamicBlocks'); 330 331 var $chooseMsg = $blocks.find('#chooseOptionMsg'); 332 var $msgNoCliente = $blocks.find('#msgNoCliente'); 333 // var $msgYaCliente = $blocks.find('#msgYaCliente'); 334 var $phoneWrapper = $blocks.find('#phoneWrapper'); 335 var $emailWrapper = $blocks.find('#emailWrapper'); 336 var $submitBtn = $blocks.find('#submit'); 337 var $dividerNoCliente = $blocks.find('#dividerNoCliente'); 338 var $dividerYaCliente = $blocks.find('#dividerYaCliente'); 339 var $callBoxLlamanos = $blocks.find('#callBoxLlamanos'); 340 var $legalText = $form.find('#legalText'); 341 342 var nuevoAlto = $('.description').outerHeight(); 343 $('.thumb').css({ 'bottom': nuevoAlto + 30 + 'px' }); 344 345 // Reordena fÃsicamente los elementos dentro de dynamicBlocks 346 function applyOrder(order) { 347 order.forEach(function ($el, index) { 348 $el.appendTo($blocks); 349 // $el.css('order', index); 350 }); 351 } 352 353 //estado inicial, nada seleccionado y todo oculto 354 function resetToInitialState() { 355 $('input[type=radio].check_iscliente_solicita').prop('checked', false).data('wasSelected', false); 356 $blocks.children().hide(); 357 $chooseMsg.show(); 358 $legalText.hide(); 359 } 360 resetToInitialState(); 361 362 $('input[type=radio].check_iscliente_solicita').on('click', function () { 363 if ($(this).data('wasSelected')) { 364 resetToInitialState(); 365 } 366 }); 367 368 $('input[type=radio].check_iscliente_solicita').change(function () { 369 370 // Teléfono del bloque "Llámanos GRATIS" según tipo de cliente 371 if ($callBoxLlamanos.length) { 372 var phoneToShow = (this.value == 'Y') ? $callBoxLlamanos.attr('data-phone-client') : $callBoxLlamanos.attr('data-phone-default'); 373 if (phoneToShow) { 374 $callBoxLlamanos.attr('href', 'tel:' + phoneToShow); 375 $callBoxLlamanos.find('.call-number').text(phoneToShow); 376 } 377 } 378 379 $('input[type=radio].check_iscliente_solicita').data('wasSelected', false); 380 $(this).data('wasSelected', true); 381 $chooseMsg.hide(); 382 $legalText.show(); 383 384 if (this.value == 'Y') { 385 386 // email (lógica igual que antes) 387 $form.find('.emailLabel').css("display", "block");
388 $form.find('#email').next('.invalid-feedback').css("display", "block"); 389 $form.find('#email').prop('required', true); 390 $form.find('#email').prop('disabled', false); 391 392 // orden: tÃtulo -> llámanos gratis -> divisor -> teléfono -> botón 393 // applyOrder([$msgYaCliente, $callBoxLlamanos, $dividerYaCliente, $phoneWrapper, $emailWrapper, $submitBtn]); 394 applyOrder([$callBoxLlamanos, $dividerYaCliente, $phoneWrapper, $emailWrapper, $submitBtn]); 395 396 $msgNoCliente.hide(); 397 $dividerNoCliente.hide(); 398 399 // $msgYaCliente.show(); 400 $callBoxLlamanos.show(); 401 $dividerYaCliente.show(); 402 $emailWrapper.show(); 403 $phoneWrapper.show(); 404 $submitBtn.show(); 405 406 var nuevoAlto = $('.description').outerHeight(); 407 $('.thumb').css({ 'bottom': nuevoAlto + 30 + 'px' }); 408 409 } else if (this.value == 'N') { 410 411 $form.find('.emailLabel').css("display", "none"); 412 $form.find('#email').prop('required', false); 413 $form.find('#email').prop('disabled', true); 414 $form.find('#email').next('.invalid-feedback').css("display", "none"); 415 416 // orden: tÃtulo -> teléfono -> botón -> divisor -> llámanos gratis 417 applyOrder([$msgNoCliente, $phoneWrapper, $submitBtn, $dividerNoCliente, $callBoxLlamanos]); 418 419 // $msgYaCliente.hide(); 420 $dividerYaCliente.hide(); 421 $emailWrapper.hide(); 422 423 $msgNoCliente.show(); 424 $phoneWrapper.show(); 425 $submitBtn.show(); 426 $dividerNoCliente.show(); 427 $callBoxLlamanos.show(); 428 429 var nuevoAlto = $('.description').outerHeight(); 430 $('.thumb').css({ 'bottom': (nuevoAlto) + 25 + 'px' }); 431 } 432 }); 433 434 $('.llamada-accion-desktop').on('click', function () { 435 436 $('.llamada-accion-call-desktop').removeClass('active'); 437 $('details').removeClass('open'); 438 439 if ($(this).hasClass('active')) { 440 $(".llamada-accion-desktop.active").removeClass("active"); 441 } else { 442 $(this).addClass("active", {duration: 150}); 443 } 444 }); 445 $('.llamada-accion-call-desktop').on('click', function (e) { 446 // e.preventDefault(); 447 $('.llamada-accion-call-desktop').addClass('active', {duration: 150}); 448 $(".llamada-accion-desktop.active").removeClass("active"); 449 // $('.contenedorSwipe').find('details').removeClass('open'); 450 $('.contenedorSwipeModal').find('details').removeAttr('open'); 451 }); 452 453 454 $(document).on('click', '.card-link a, .card-link button', function(e) { 455 e.stopPropagation(); 456 }); 457 458 $(document).on('click', '.card-link', function (e) { 459 const $card = $(this); 460 461 e.stopPropagation(); 462 463 // Busca primero el botón info, si no existe usa el CTA genérico 464 const $linkInfo = $card.find('.buttonDetails').first(); 465 const $linkContratar = $card.find('.buttonUrl.urlloquiero').first(); 466 467 // Si no es modal, navega si hay href válido 468 const url2 = $linkInfo.attr('href'); 469 console.log(url2); 470 if (url2 && url2 !== 'javascript:;') { 471 window.location.href = url2; 472 } else{ 473 474 const url3 = $linkContratar.attr('href'); 475 console.log(url3); 476 if (url3 && url3 !== 'javascript:;') { 477 window.location.href = url3; 478 } 479 } 480 }); 481 482 $(document).on('click', '.card-modal a, .card-modal button', function(e) { 483 e.stopPropagation(); 484 }); 485 486 $(document).on('click', '.card-modal', function (e) { 487 const modalTarget = $(this).data('modal-target'); 488 if (modalTarget) { 489 $(modalTarget).modal('show'); 490 } 491 }); 492 493 /*menu lateral*/ 494 495 $('.navbar-toggler').on('click', function () { 496 $('#navbarSupportedContent').toggleClass('open'); 497 }); 498 499 // Cerrar al hacer click fuera del panel 500 $('#navbarSupportedContent').on('click', function (e) { 501 502 if (e.target === this) { 503 $(this).removeClass('open'); 504 } 505 }); 506 507 $('.close-menu-btn').on('click', function () { 508 $('#navbarSupportedContent').removeClass('open'); 509 }); 510 511 /* verificacion en swipe/modal*/ 512 513 $('.telefonomovil').on('change', function () { 514 let message = ''; 515 const valor = $(this).val().trim(); 516 const primer = valor.charAt(0); 517 518 // this.setCustomValidity(""); 519 520 $(this).removeClass('is-invalid');
521 $(this).next('.invalid-feedback').remove(); 522 $(this).siblings('.invalid-feedback').remove(); 523 524 if (valor.length !== 9) { 525 message = nineDigits; 526 } else if (primer !== '6' && primer !== '7') { 527 message = nromovil; 528 } 529 530 if (message) { 531 $(this).addClass('is-invalid'); 532 $(this).after('<div class="invalid-feedback">' + message + '</div>'); 533 534 } else { 535 $(this).next('.invalid-feedback').remove(); 536 $(this).removeClass('is-invalid'); 537 } 538 }); 539 540 $('.emailModal').on('change', function () { 541 542 let message = ''; 543 const valor = $(this).val().trim(); 544 545 // this.setCustomValidity(""); 546 547 $(this).removeClass('is-invalid'); 548 $(this).next('.invalid-feedback').remove(); 549 550 if (valor.indexOf('@') === -1 || valor.indexOf('.') === -1) { 551 message = emailnovalido; 552 } 553 554 if (message) { 555 $(this).addClass('is-invalid'); 556 $(this).after('<div class="invalid-feedback">' + message + '</div>'); 557 // this.setCustomValidity(message); 558 // this.reportValidity(); 559 } else { 560 $(this).removeClass('is-invalid'); 561 $(this).next('.invalid-feedback').remove(); 562 } 563 }); 564 565 document.querySelectorAll('.radio-label-main').forEach(function (el) { 566 el.innerHTML = el.textContent 567 .replace(/\bNO\b/, '<strong class="resalta">NO</strong>') 568 .replace(/\bYA\b/, '<strong class="resalta">YA</strong>') 569 .replace(/\bNOT\b/, '<strong class="resalta">NOT</strong>') 570 .replace(/\bAM\b/, '<strong class="resalta">AM</strong>') 571 .replace(/\bALREADY\b/, '<strong class="resalta">ALREADY</strong>'); 572 }); 573 574 // Bloque "Resumen IA" ([resumen_ia_es] / [resumen_ia_en] en el body de la noticia). 575 // El servidor rellena data-url, data-title y data-prompt en CMS::renderBody(). 576 $(document).on('click', '.ai-share button', function () { 577 var $c = $(this).closest('.ai-share'); 578 var url = $c.data('url') || window.location.href; 579 var promptText = $c.data('prompt') || 'Haz un esquema resumen con los puntos clave de este artÃculo: '; 580 var q = encodeURIComponent(promptText + url); 581 var urls = { 582 chatgpt: 'https://chatgpt.com/?q=' + q + '&hints=search', 583 claude: 'https://claude.ai/new?q=' + q 584 }; 585 var target = urls[$(this).data('ai')] || urls.chatgpt; 586 window.open(target, '_blank', 'noopener'); 587 }); 588 589});
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.