1if (typeof NBUI_ProductCard === 'undefined') { 2 function NBUI_ProductCard() {} 3} 4 5NBUI_ProductCard.prototype.focusProductCardWithKeyboard = function () { 6 $('.nb-product-card').each(function () { 7 let $productCard = $(this); 8 let $button = $productCard.find('.nbf-add-to-cart'); 9 let $link = $productCard.find('.nb-product-name .nb-link'); 10 11 $button.attr('tabindex', '0'); 12 $link.attr('tabindex', '0'); 13 14 $productCard.on('focusin', function () { 15 $productCard.parent().addClass('nb-element-hover'); 16 modelNBUI_ProductCard.addToCartWithKeyboard($button); 17 }); 18 19 $productCard.on('focusout', function () { 20 setTimeout(function () { 21 if (!$productCard.has(document.activeElement).length) { 22 $productCard.parent().removeClass('nb-element-hover'); 23 } 24 }, 0); 25 }); 26 }); 27} 28 29NBUI_ProductCard.prototype.addToCartWithKeyboard = function (el) { 30 el.off('keydown').on('keydown', function (e) { 31 if (e.key === 'Enter') { 32 let $sizes = el.parent().find('.nbf-size-value'); 33 setTimeout(function (){ 34 if ($sizes.length) { 35 $sizes.attr('tabindex', '0'); 36 $sizes[0].focus(); 37 } 38 }, 200) 39 40 } 41 }); 42} 43 44if (typeof modelNBUI_ProductCard === 'undefined') { 45 var modelNBUI_ProductCard = new NBUI_ProductCard(); 46} 47 48$(document).ready(function (){ 49 modelNBUI_ProductCard.focusProductCardWithKeyboard(); 50 51 $(window).on('loadproductstatebystore loadproductsevent reloadcartevent loadlastviewedproductevent loadSearchProductsEvent',function (){ 52 modelNBUI_ProductCard.focusProductCardWithKeyboard(); 53 }); 54})
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.