PageSourceSearch

https://shop.itchyofficial.de/assets/waterline/controllers/select_…2c0f3fb37488d20dd22bf976712de432a31f9df7.js

js itchyofficial.de collected 2026-10-10 00:53:28 UTC 2,108 bytes, 1 lines download raw bytes

1import{Controller}from"@hotwired/stimulus";import"tom-select";import debounce from"lodash.debounce";export default class extends Controller{static values={settings:Object,autoSubmit:Boolean,useSearch:Boolean,searchText:String,noResultsText:String};connect(){this.tom=new TomSelect(this.element,{...this.defaults,...this.settingsValue}),devlog("select",this.tom),this.autoSubmitValue&&(devlog("select","using autoSubmit"),this.debouncedHoverSubmit=debounce(this.checkHoverSubmit,1500),this.fastDebouncedHoverSubmit=debounce(this.checkHoverSubmit,200),this.fastDebouncedSubmit=debounce(this.submit,200),this.tom.on("change",this.debouncedHoverSubmit.bind(this)),this.tom.on("type",this.debouncedHoverSubmit.cancel),this.tom.on("blur",this.fastDebouncedSubmit.bind(this)))}submit(){devlog("select","submit!"),this.submitButton.click(),this.tom.close()}checkHoverSubmit(){return this.tom.dropdown.matches(":hover")?(devlog("select","skipping submit because of dropdown hover"),this.fastDebouncedHoverSubmit.cancel(),void this.tom.dropdown.addEventListener("mouseleave",this.fastDebouncedHoverSubmit.bind(this),{once:!0})):this.tom.control.matches(":hover")?(devlog("select","skipping submit because of input hover"),this.fastDebouncedHoverSubmit.cancel(),void this.tom.control.addEventListener("mouseleave",this.fastDebouncedHoverSubmit.bind(this),{once:!0})):void this.submit()}disconnect(){this.tom.destroy()}get submitButton(){return this.element.form.querySelector("[type='submit']")}get defaults(){const t={plugins:{caret_position:{},input_autogrow:{},remove_button:{label:"<i class='fa fa-fw fa-sm fa-times'></i>"},optgroup_columns:{}},searchField:["text","info"],maxOptions:!1,render:{}};return this.searchTextValue&&(t.render.option_create=(t,e)=>`<div class="create">${this.searchTextValue}: <strong>${e(t.input)}</strong></div>`),this.noResultsTextValue&&(t.render.no_results=()=>`<div class="no-results${this.useSearchValue?" ms-auto":""}">${this.noResultsTextValue}</div>`),this.useSearchValue&&(t.create=t=>(this.autoSubmitValue&&this.fastDebouncedSubmit(),{value:`q-${t}`,text:t,optgroup:"q"})),t}}

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.