1import { Controller } from '@hotwired/stimulus' 2import 'datatables.net' 3 4export default class extends Controller { 5 connect () { 6 if (this.hasConnected) return 7 this.hasConnected = true 8 9 const table = $(this.element).find('table') 10 const userSignedIn = table.data('user-signed-in') 11 12 table.DataTable({ 13 order: [[1, 'asc']], 14 paging: false, 15 searching: false, 16 aoColumnDefs: [ 17 { bSortable: false, aTargets: [0, ...(userSignedIn ? [5] : [])] }, 18 ], 19 bInfo: false, 20 oLanguage: { sEmptyTable: ' ', sInfoEmpty: ' ' }, 21 }) 22 } 23 24 disconnect () { 25 const table = $(this.element).find('table') 26 if ($.fn.DataTable.isDataTable(table)) { 27 table.DataTable().destroy() 28 } 29 this.hasConnected = false 30 } 31}
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.