1(function ($, Drupal, drupalSettings) { 2 3 Drupal.behaviors.MenuResponsive = { 4 attach: function (context, settings) { 5 // Adapatación Servimedia 6 // $('.menu--main:not(.footer-menu),.menu--discamedia:not(.footer-menu-discamedia) > .menu-responsive', context).once('menu-responsive').each(function () { 7 $(once('menu-responsive', '.menu--main:not(.footer-menu),.menu--discamedia:not(.footer-menu-discamedia) > .menu-responsive', context)).each(function () { 8 $('li', this).each(function() { 9 if ($(this).hasClass('menu-item--expanded')) { 10 $('a', this).each(function() { 11 if ($(this).next('.menu').length > 0) { 12 var aria_controls_id = 'ac-' + Math.random().toString(36).substring(2); 13 $(this).attr({ 14 'aria-expanded': 'false', 15 'aria-controls': aria_controls_id 16 }).off('click.MenuResponsive').on('click.MenuResponsive', function () { 17 if ($(this).attr('aria-expanded') == 'true') { 18 $(this).attr('aria-expanded', 'false').next('.menu').hide().find('a[aria-expanded="true"]').attr('aria-expanded', 'false').next('.menu').hide(); 19 } else { 20 $(this).attr('aria-expanded', 'true').next('.menu').show(); 21 } 22 return false; 23 }).next('.menu').attr({ 24 'id': aria_controls_id 25 }).hide(); 26 } 27 $(this).off('keyup.MenuResponsive').on('keyup.MenuResponsive', function (e) { 28 //Escape 29 if (e.keyCode == 27) { 30 if ($(this).closest('.menu--level')) { 31 $(this).closest('.menu--level').hide().prev('a').attr('aria-expanded', 'false').focus(); 32 } 33 } 34 }); 35 }); 36 } 37 $('a', this).off('focus.MenuResponsive').on('focus.MenuResponsive', function () { 38 $(this).parents('li').siblings('li').find('a[aria-expanded="true"]').attr('aria-expanded', 'false').next('.menu').hide(); 39 }); 40 }); 41 }); 42 $('body', context).off('click.MenuResponsive').on('click.MenuResponsive', function () { 43 $('.menu-responsive a').each(function () { 44 if ($(this).attr('aria-expanded') == 'true') { 45 $(this).attr('aria-expanded', 'false').next('.menu').hide(); 46 } 47 }); 48 }); 49 } 50 }; 51 52})(jQuery, Drupal, drupalSettings);
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.