1import {Controller} from "@hotwired/stimulus" 2 3export default class extends Controller { 4 static targets = ["link", "input"]; 5 6 popup = null; 7 8 openImport(event){ 9 event.preventDefault(); // ð¥ Zastavà pôvodné kliknutie 10 event.stopPropagation(); // (voliteľné) stopne bublanie 11 this.popup = window.open(this.linkTarget.getAttribute('href')+'?serial='+this.inputTarget.value, 'popup', 'width=920,height=500'); 12 // funkcia, ktorú popup zavolá pred zatvorenÃm 13 window.receivePopupValue = (value) => { 14 this.setValue(value); // zapÃÅ¡ do inputu 15 }; 16 } 17 18 setValue(value){ 19 if(this.isTomSelectInitialized(this.inputTarget)){ 20 this.addOptionAndSet(this.inputTarget.tomselect, value) 21 } else { 22 this.inputTarget.value = value; 23 } 24 } 25 26 isTomSelectInitialized(element) { 27 return element && typeof element.tomselect !== "undefined"; 28 } 29 30 addOptionAndSet(tomselect, value) { 31 let optionData = { 32 value: value, 33 text: value 34 }; 35 if (!tomselect.options[optionData.value]) { 36 tomselect.addOption(optionData); 37 } 38 tomselect.setValue(optionData.value); 39 } 40 41}
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.