1/** 2 * @file 3 * Javascript functionality for all keyboard actions. 4 */ 5 6(function ($, Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.tbnnetKeyboardActions = { 11 attach: function (context) { 12 // Remove tabindex for slide item 13 $('div.episode-wrapper.slick-slide').attr('tabindex', -1); 14 15 $('body').once('keyupAction').on('keyup.keyboardActions', function (event) { 16 var $target = $(event.target); 17 var $target_parent = $target.parent(); 18 19 // Tab keycode == 9 20 if (event.keyCode === 9) { 21 // Remove open class if target is not submenu 22 if (!$target.closest('ul.dropdown-menu').length) { 23 $('.menu.menu--main > li.menu-icon').removeClass('open'); 24 } 25 if ($target.hasClass('slick-slide')) { 26 // focus to next item and remove tabindex 27 $target.attr('tabindex', -1); 28 $target.find('a:first').focus(); 29 } 30 } 31 // Enter keycode == 13 32 else if (event.keyCode === 13) { 33 if ($target.hasClass('caret') && $target_parent.hasClass('dropdown-toggle')) { 34 var $menuLi = $target.closest('li.menu-icon'); 35 $menuLi.addClass('open'); 36 } 37 if ($target_parent.hasClass('day-controls')) { 38 $target.trigger('click'); 39 } 40 if ($target_parent.hasClass('title-column')) { 41 $target.closest('tr.episode-row.selected-day').trigger('click'); 42 } 43 } 44 }); 45 } 46 }; 47 48})(jQuery, Drupal);
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.