1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static targets = [ ] 5 6 connect() { 7 const dicteeId = this.element.getAttribute("data-dictee-id"); 8 let csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); 9 10 fetch('/get-dictee-ranking', { 11 method: 'POST', 12 headers: { 13 'Content-Type': 'application/json', 14 'X-CSRF-Token': csrfToken 15 }, 16 body: JSON.stringify({ 17 dictee_id: dicteeId 18 }) 19 }) 20 .then(response => response.text()) 21 .then(script => { 22 const scriptElement = document.createElement('script'); 23 scriptElement.text = script; 24 document.body.appendChild(scriptElement); 25 }) 26 .catch(error => { 27 console.log("Ajax error!", error); 28 }); 29 } 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.