1(function ($, Drupal, drupalSettings) { 2 'use strict'; 3 Drupal.behaviors.donde_comprar = { 4 attach: function (context) { 5 6 7 8 $('body', context).once('donde_comprar').each(function () { 9 10 $( document ).ajaxSend(function( event, jqxhr, settings ) { 11 12 13 if(settings.url.includes('/views/ajax') && $('body').hasClass('path-donde-comprar')) { 14 $('.cursor-wrapper').removeClass('disabled'); 15 if($('.view-list').hasClass('active')) { 16 $('body').addClass('show-list'); 17 }else { 18 $('.view-points').trigger('click'); 19 } 20 } 21 }); 22 23 $( document ).ajaxComplete(function( event, jqxhr, settings ) { 24 if(settings.url.includes('/views/ajax') && $('body').hasClass('path-donde-comprar')) { 25 $('.cursor-wrapper').removeClass('disabled'); 26 if($('body').hasClass('show-list')) { 27 $('body').removeClass('show-list'); 28 $('.view-list').trigger('click'); 29 }else { 30 $('.view-points').trigger('click'); 31 } 32 33 } 34 }); 35 36 var containers = { 37 'distributors': '.portal-distribuidores', 38 'map':'.view-display-id-page_1', 39 'list':'.block-views-blockdonde-comprar-block-1', 40 'online':'.block-views-blockdonde-comprar-block-2', 41 } 42 43 var links = { 44 'distributors': '.point-of-sale-header a.view-distributors', 45 'map':'.point-of-sale-header a.view-map', 46 'list':'.point-of-sale-header a.view-list', 47 'online':'.point-of-sale-header a.view-online', 48 'points':'.point-of-sale-header a.view-points', 49 } 50 51 var online_links = ['online','distributors']; 52 53 var points_links = ['list','map']; 54 55 var point_link = 'points'; 56 57 var all_links = '', all_containers = ''; 58 all_links = Object.keys(links).map(function(key) { 59 return links[key]; 60 }).toString(); 61 all_containers = Object.keys(containers).map(function(key) { 62 return containers[key]; 63 }).toString(); 64 65 66 $.each(links, function (key, value) { 67 68 $('.point-of-sale-header-right a').addClass('hide-link'); 69 70 $('body').on('click',value, function (e) { 71 72 if(value == '.point-of-sale-header a.view-points') { 73 $('.point-of-sale-header-right a').removeClass('hide-link'); 74 e.preventDefault(); 75 } 76 if(value == '.point-of-sale-header a.view-distributors' || value == '.point-of-sale-header a.view-online') { 77 $('.point-of-sale-header-right a').addClass('hide-link'); 78 } 79 80 if(online_links.includes(key) && !$(links[key]).hasClass('active')) { 81 $(all_links).addClass('passed-map-link'); 82 $(all_links).not('.active').removeClass('passed-map-link'); 83 if(!$(all_links).hasClass('active')) { 84 $(links['map']).addClass('passed-map-link'); 85 } 86 } 87 88 $(all_links).addClass('inactive'); 89 $(all_containers).addClass('inactive'); 90 $(all_links).removeClass('active'); 91 $(all_containers).removeClass('active'); 92 $(value).addClass('active'); 93 $(containers[key]).addClass('active'); 94 if(points_links.includes(key)) { 95 96 $(links['points']).removeClass('inactive'); 97 $(links['points']).addClass('active'); 98 } 99 if(point_link == key) { 100 var $link = ($('.passed-map-link').legnth) ? $('.passed-map-link') : $(links['map']); 101 102 $link.removeClass('passed-map-link inactive'); 103 $link.trigger('click'); 104 105 106 107 } 108 109 110 111 112 }); 113 }); 114 }); 115 116 } 117 }; 118 })(jQuery, Drupal, drupalSettings); 119
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.