1(function($) { 2 Drupal.behaviors.contentTables = { 3 attach: function(context, settings) { 4 // Adds data attribute on cells so the table headers display properly on mobile layout 5 $('.sbd-table-component').once().each(function() { 6 var thisElem = $(this); 7 $(thisElem).find('th div').each(function(i, elem) { 8 var num = i + 1; 9 var thisCell = thisElem.find('td:nth-child(' + num + ')'); 10 $(thisCell).attr('data-title', $(elem).text().trim()); 11 }); 12 }); 13 14 // Adds dragging functionality 15 const tableContainer = document.querySelectorAll('.coh-style-family-products-table > div'); 16 let isDragging = false; 17 let startPosition; 18 let scrollLeft; 19 20 tableContainer.forEach(table => { 21 table.addEventListener('mousedown', (e) => { 22 if (table.scrollWidth <= table.clientWidth) return; 23 24 isDragging = true; 25 startPosition = e.pageX - table.offsetLeft; 26 scrollLeft = table.scrollLeft; 27 table.style.cursor = 'grabbing'; 28 }); 29 30 table.addEventListener('mouseup', () => { 31 isDragging = false; 32 if (table.scrollWidth > table.clientWidth) { 33 table.style.cursor = 'grab'; 34 } else { 35 table.style.cursor = 'default'; 36 } 37 }); 38 39 table.addEventListener('mouseleave', () => { 40 isDragging = false; 41 if (table.scrollWidth > table.clientWidth) { 42 table.style.cursor = 'grab'; 43 } else { 44 table.style.cursor = 'default'; 45 } 46 }); 47 48 table.addEventListener('mousemove', (e) => { 49 if (!isDragging) return; 50 e.preventDefault(); 51 const x = e.pageX - table.offsetLeft; 52 const walk = (x - startPosition) * 2; 53 table.scrollLeft = scrollLeft - walk; 54 }); 55 56 if (table.scrollWidth > table.clientWidth) { 57 table.style.cursor = 'grab'; 58 } else { 59 table.style.cursor = 'default'; 60 } 61 62 window.addEventListener('resize', () => { 63 if (table.scrollWidth > table.clientWidth) { 64 table.style.cursor = 'grab'; 65 } else { 66 table.style.cursor = 'default'; 67 } 68 }); 69 70 }); 71 } 72 }; 73})(jQuery);
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.