1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static values = { url: String } 5 6 export(event) { 7 event.preventDefault() 8 9 // Show confirmation dialog 10 if (!confirm('å®åPDF䏿¬ã¨ã¯ã¹ãã¼ããéå§ãã¾ããï¼å¦çã«ã¯æéããããå ´åãããã¾ãã')) { 11 return 12 } 13 14 // Find the search form 15 const searchForm = document.querySelector('form[data-controller="auto-submit"]') 16 if (!searchForm) { 17 console.error('Search form not found') 18 return 19 } 20 21 // Create FormData from the search form 22 const formData = new FormData(searchForm) 23 24 // Remove the commit button value if it exists (from search form submit) 25 formData.delete('commit') 26 27 // Send POST request with search parameters 28 fetch(this.urlValue, { 29 method: 'POST', 30 body: formData, 31 headers: { 32 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), 33 'Accept': 'text/html' 34 } 35 }) 36 .then(response => { 37 if (response.ok) { 38 // Redirect to progress page or handle success 39 window.location.href = response.url 40 } else { 41 throw new Error(`HTTP error! status: ${response.status}`) 42 } 43 }) 44 .catch(error => { 45 console.error('Export failed:', error) 46 alert('ã¨ã¯ã¹ãã¼ãã®éå§ã«å¤±æãã¾ããã') 47 }) 48 } 49};
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.