1jQuery( document ).ready( function() { 2 adt_init_mobile_menu(); 3 adt_init_popups(); 4 5 // MODAL INFORMATE 6 jQuery('.home-popup-promo .wp-block-button__link, .home-popup-promo-sticky .wp-block-button__link').on('click', function () { 7 jQuery('.modal--informate').show(); 8 }); 9 10 jQuery('.home-popup-promo-sticky .wp-block-button__link').on('click', function () { 11 jQuery('.modal--informate-sticky').show(); 12 }); 13 14 // CLOSE MODAL 15 jQuery('.modal .closeModal').on('click', function () { 16 jQuery('.modal').fadeOut('slow') 17 }); 18 19 // MODAL TE LLAMAMOS 20 jQuery('.navigation-item-call').on('click', function () { 21 jQuery('.modal--te-llamamos').show(); 22 }); 23 24 25} ); 26 27window.onscroll = function() { 28 if ( jQuery( '.popup-promo' ).length > 0 ) { 29 ( jQuery( window ).scrollTop() > ( jQuery( '.popup-promo' ).outerHeight() - 10 ) ) ? 30 jQuery( 'body' ).addClass( 'hero-scrolled' ) : 31 jQuery( 'body' ).removeClass( 'hero-scrolled' ); 32 } 33}; 34 35function adt_open_mobile_menu( is_customer ) { 36 jQuery( 'body' ).toggleClass( 'mobile-menu-opened' ); 37 38 if ( is_customer && jQuery( 'body' ).hasClass( 'mobile-menu-opened' ) ) { 39 jQuery( 'body' ).addClass( 'customers-menu' ); 40 } 41 else { 42 jQuery( 'body' ).removeClass( 'customers-menu' ); 43 } 44} 45 46function adt_init_mobile_menu() { 47 jQuery( '.site-header .mobile-menu-container .menu > li.menu-item-has-children' ).on( 'click', function() { 48 jQuery( this ).toggleClass( 'menu-item-opened' ); 49 } ); 50} 51 52function adt_init_popups() { 53 if ( jQuery( '.popup-promo' ).length > 0 ) { 54 var popup = jQuery( '.popup-promo' ).detach(); 55 jQuery( 'article header .hero .container' ).append( popup ); 56 popup.addClass( 'active' ); 57 } 58} 59 60function adt_slider_hide_left_slides( elem_id, slick, current_slide ) { 61 var current_slide = '' || current_slide; 62 63 jQuery( elem_id + ' .slick-slide' ).removeClass( 'hidden' ); 64 65 for ( var i = -5; i < 0; i++ ) { 66 jQuery( elem_id + ' .slick-slide[data-slick-index="' + i + '"]' ).addClass( 'hidden' ); 67 } 68 69 if ( current_slide != '' ) { 70 jQuery.each( slick.$slides, function( index, item ) { 71 if ( index < current_slide ) { 72 jQuery( elem_id + ' .slick-slide[data-slick-index=' + index + ']:not(.slick-active)' ).addClass( 'hidden' ); 73 } 74 } ); 75 } 76} 77 78function adt_select_faq( elem, category_id ) { 79 jQuery( elem ).parent().find( 'li' ).removeClass( 'active' ); 80 jQuery( elem ).addClass( 'active' ); 81 jQuery( elem ).closest( '.adt-shortcode-faq' ).find( '.faq-item' ).hide( 50 ); 82 jQuery( elem ).closest( '.adt-shortcode-faq' ).find( '.faq-item.faq-category-' + category_id ).show(); 83} 84 85var adt_calculator_answers = {}; 86var adt_calculator_answers_count = 1; 87var adt_calculator_second_question_1 = null; 88var adt_calculator_second_question_2 = null; 89 90function adt_calculator_first_next_question( elem, q_id, next_q_id_1, next_q_id_2 ) { 91 var answer = jQuery( elem ).closest( '.question' ).find( '.answer.active' ); 92 93 if ( answer.length > 0 ) { 94 adt_calculator_answers[adt_calculator_answers_count] = { 95 questionID: jQuery( elem ).closest( '.question' ).attr('adt-question-id'), 96 question: jQuery( elem ).closest( '.question' ).data('adt-question'), 97 answer: jQuery.trim( answer.text() ) 98 }; 99 adt_calculator_answers_count++; 100 101 adt_calculator_second_question_1 = next_q_id_1; 102 adt_calculator_second_question_2 = next_q_id_2; 103 104 jQuery( '[adt-question-id=' + q_id + ']' ).hide(); 105 106 var total_steps = 0; 107 if ( answer.hasClass( 'answer-index-1' ) ) { 108 jQuery( '[adt-question-id=' + next_q_id_1 + ']' ).show( 50 ); 109 total_steps = jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '.steps' ).attr( 'adt-calculator-steps-' + next_q_id_1 ); 110 } 111 else { 112 jQuery( '[adt-question-id=' + next_q_id_2 + ']' ).show( 50 ); 113 total_steps = jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '.steps' ).attr( 'adt-calculator-steps-' + next_q_id_2 ); 114 } 115 116 jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '.steps-numbers .total' ).text( ' / ' + total_steps ); 117 jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '.steps-numbers .current' ).text( adt_calculator_answers_count ); 118 } 119 else { 120 alert( 'Por favor, seleccione una opción' ); 121 } 122} 123 124function adt_calculator_next_question( elem, q_id, next_q_id, type_id ) { 125 var answer = jQuery( elem ).closest( '.question' ).find( '.answer.active' ); 126 127 if ( answer.length > 0 ) { 128 adt_calculator_answers[adt_calculator_answers_count] = { 129 questionID: jQuery( elem ).closest( '.question' ).attr('adt-question-id'), 130 question: jQuery( elem ).closest( '.question' ).data('adt-question'), 131 answer: jQuery.trim( answer.text() ) 132 }; 133 adt_calculator_answers_count++; 134 135 jQuery( '[adt-question-id=' + q_id + ']' ).hide(); 136 jQuery( '[adt-question-id=' + next_q_id + ']' ).show( 50 ); 137 138 jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '[adt-calculator-step-id=' + type_id + ']' ).addClass( 'active' ); 139 jQuery( elem ).closest( '.adt-shortcode-calculator' ).find( '.steps-numbers .current' ).text( adt_calculator_answers_count ); 140 } 141 else { 142 alert( 'Por favor, seleccione una opción' ); 143 } 144} 145 146function adt_calculator_results( elem ) { 147 148 // Guardar la respuesta de la última pregunta 149 var answer = jQuery( elem ).closest( '.question' ).find( '.answer.active' ); 150 151 if ( answer.length > 0 ) { 152 153 adt_calculator_answers[adt_calculator_answers_count] = { 154 questionID: jQuery( elem ).closest( '.question' ).attr('adt-question-id'), 155 question: jQuery( elem ).closest( '.question' ).data('adt-question'), 156 answer: jQuery.trim( answer.text() ) 157 }; 158 159 adt_calculator_answers_count++; 160 } 161 else { 162 alert( 'Por favor, seleccione una opción' ); 163 return; 164 } 165 166 jQuery( elem ).closest( '.adt-shortcode-calculator' ).hide(); 167 168 console.log( 'calculator results:', adt_calculator_answers ); 169 170 var results_section = 171 jQuery(
172 adt_calculator_answers[1].answer.toLowerCase() == 'vivienda' && 173 adt_calculator_answers[3].answer.toLowerCase() == 'piso' 174 ? '.section--calculadora-adt-alert' 175 : '.section--calculadora-adt-vision' 176 ).detach(); 177 178 jQuery( elem ) 179 .closest( '.section--calculadora' ) 180 .find( '.container .wp-block-group__inner-container' ) 181 .append( results_section ); 182 183 results_section.show( 50 ); 184 185 dataLayer.push({ 186 'event':'calculadora', 187 'fase_calculadora':'fin' 188 }); 189 190 results_section 191 .find( '.calculadora-form-container input[name=calculator_answers]' ) 192 .val( JSON.stringify( adt_calculator_answers ) ); 193} 194 195var news_current_block = 1; 196function adt_load_more_news( widget_id, initial_items ) { 197 var el = jQuery( '#' + widget_id + ' .load-more' ); 198 if (el.hasClass('load-more-loading')) 199 return; 200 201 var b = el.addClass('load-more-loading').find('.button'); 202 var olabel = b.html(); 203 b.html('Cargando..'); 204 205 jQuery.ajax( { 206 type: 'POST', 207 dataType: 'json', 208 url: adt_app.ajax_url, 209 data: { 210 action: 'load_more_news', 211 p_initial_items: initial_items, 212 p_current_block: news_current_block 213 }, 214 success: function( data ) { 215 if ( data.records > 0 ) { 216 jQuery( '#' + widget_id + ' .row' ).append( data.html ); 217 news_current_block++; 218 } 219 220 if ( data.records == 0 || data.records < initial_items ) { 221 jQuery( '#' + widget_id + ' .load-more' ).hide( 100 ); 222 } 223 224 b.html(olabel); 225 el.removeClass('load-more-loading'); 226 }, 227 error: function( jqXHR, textStatus, errorThrown ) { 228 b.html(olabel); 229 el.removeClass('load-more-loading'); 230 console.log( errorThrown ); 231 } 232 } ); 233} 234var news_cat_current_block = 1; 235var news_search_current_block = 1; 236var news_tag_current_block = 1; 237function getPostByCategory(category_slug){ 238 jQuery('.filter-item.active').removeClass('active'); 239 jQuery('.filter-item[data-slug='+category_slug+']').addClass('active') 240 jQuery.ajax( { 241 type: 'POST', 242 dataType: 'json', 243 url: adt_app.ajax_url, 244 data: { 245 action: 'load_category', 246 cat: category_slug, 247 }, 248 success: function( data ) { 249 if ( data.records > 0 ) { 250 jQuery( '.adt-shortcode-news' ).html( data.html ); 251 news_cat_current_block = 1; 252 news_search_current_block = 1; 253 news_current_block = 1; 254 news_tag_current_block = 1; 255 } 256 }, 257 error: function( jqXHR, textStatus, errorThrown ) { 258 b.html(olabel); 259 el.removeClass('load-more-loading'); 260 console.log( errorThrown ); 261 } 262 } ); 263} 264 265function adt_load_more_category(category_slug, initial_items){ 266 267 var el = jQuery( '.load-more' ); 268 if (el.hasClass('load-more-loading')) 269 return; 270 271 var b = el.addClass('load-more-loading').find('.button'); 272 var olabel = b.html(); 273 b.html('Cargando..'); 274 275 jQuery.ajax( { 276 type: 'POST', 277 dataType: 'json', 278 url: adt_app.ajax_url, 279 data: { 280 action: 'load_more_category', 281 p_initial_items: initial_items, 282 p_current_block: news_cat_current_block, 283 cat: category_slug, 284 }, 285 success: function( data ) { 286 if ( data.records > 0 ) { 287 jQuery( '.adt-shortcode-news .row' ).append( data.html ); 288 news_cat_current_block++; 289 } 290 291 if ( data.records == 0 || data.records < initial_items ) { 292 jQuery( '.load-more' ).hide( 100 ); 293 } 294 295 b.html(olabel); 296 el.removeClass('load-more-loading'); 297 }, 298 error: function( jqXHR, textStatus, errorThrown ) { 299 b.html(olabel); 300 el.removeClass('load-more-loading'); 301 console.log( errorThrown ); 302 } 303 } ); 304} 305 306function searchBlog(e){ 307 e.preventDefault(); 308 309 jQuery('.filter-item.active').removeClass('active'); 310 311 jQuery.ajax( { 312 type: 'POST', 313 dataType: 'json', 314 url: adt_app.ajax_url, 315 data: { 316 action: 'search_blog', 317 search: jQuery('.search-field').val(), 318 }, 319 success: function( data ) { 320 if ( data.records > 0 ) { 321 jQuery( '.adt-shortcode-news' ).html( data.html ); 322 news_cat_current_block = 1; 323 news_search_current_block = 1; 324 news_current_block = 1; 325 news_tag_current_block = 1; 326 } 327 }, 328 error: function( jqXHR, textStatus, errorThrown ) { 329 b.html(olabel); 330 el.removeClass('load-more-loading'); 331 console.log( errorThrown ); 332 } 333 } ); 334 335 336 return false;
337} 338 339function adt_load_more_search(search, initial_items){ 340 341 var el = jQuery( '.load-more' ); 342 if (el.hasClass('load-more-loading')) 343 return; 344 345 var b = el.addClass('load-more-loading').find('.button'); 346 var olabel = b.html(); 347 b.html('Cargando..'); 348 349 jQuery.ajax( { 350 type: 'POST', 351 dataType: 'json', 352 url: adt_app.ajax_url, 353 data: { 354 action: 'load_more_search', 355 p_initial_items: initial_items, 356 p_current_block: news_search_current_block, 357 search: search, 358 }, 359 success: function( data ) { 360 if ( data.records > 0 ) { 361 jQuery( '.adt-shortcode-news .row' ).append( data.html ); 362 news_search_current_block++; 363 } 364 365 if ( data.records == 0 || data.records < initial_items ) { 366 jQuery( '.load-more' ).hide( 100 ); 367 } 368 369 b.html(olabel); 370 el.removeClass('load-more-loading'); 371 }, 372 error: function( jqXHR, textStatus, errorThrown ) { 373 b.html(olabel); 374 el.removeClass('load-more-loading'); 375 console.log( errorThrown ); 376 } 377 } ); 378} 379 380function getPostByTag(tag_slug){ 381 jQuery('.filter-item.active').removeClass('active'); 382 383 jQuery.ajax( { 384 type: 'POST', 385 dataType: 'json', 386 url: adt_app.ajax_url, 387 data: { 388 action: 'load_tag', 389 tag: tag_slug, 390 }, 391 success: function( data ) { 392 if ( data.records > 0 ) { 393 jQuery( '.adt-shortcode-news' ).html( data.html ); 394 news_cat_current_block = 1; 395 news_search_current_block = 1; 396 news_current_block = 1; 397 news_tag_current_block = 1; 398 } 399 }, 400 error: function( jqXHR, textStatus, errorThrown ) { 401 b.html(olabel); 402 el.removeClass('load-more-loading'); 403 console.log( errorThrown ); 404 } 405 } ); 406} 407 408function adt_load_more_tag(tag_slug, initial_items){ 409 410 var el = jQuery( '.load-more' ); 411 if (el.hasClass('load-more-loading')) 412 return; 413 414 var b = el.addClass('load-more-loading').find('.button'); 415 var olabel = b.html(); 416 b.html('Cargando..'); 417 418 jQuery.ajax( { 419 type: 'POST', 420 dataType: 'json', 421 url: adt_app.ajax_url, 422 data: { 423 action: 'load_more_tag', 424 p_initial_items: initial_items, 425 p_current_block: news_tag_current_block, 426 tag: tag_slug, 427 }, 428 success: function( data ) { 429 if ( data.records > 0 ) { 430 jQuery( '.adt-shortcode-news .row' ).append( data.html ); 431 news_tag_current_block++; 432 } 433 434 if ( data.records == 0 || data.records < initial_items ) { 435 jQuery( '.load-more' ).hide( 100 ); 436 } 437 438 b.html(olabel); 439 el.removeClass('load-more-loading'); 440 }, 441 error: function( jqXHR, textStatus, errorThrown ) { 442 b.html(olabel); 443 el.removeClass('load-more-loading'); 444 console.log( errorThrown ); 445 } 446 } ); 447}
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.