https://assets.wanikani.com/assets/controllers/dashboard_customization/widget_controller-12f90716.js
1import { Controller } from '@hotwired/stimulus'; 2import { disableInteration } from 'utils/disable_interation'; 3 4export default class extends Controller { 5 static targets = ['controls', 'widget'] 6 static outlets = ['modal'] 7 8 connect() { 9 if (this.widgetId == 'requires-replacement') { 10 this.updateWidgetId() 11 } 12 if (this.element.dataset.widgetType != 'empty') { 13 disableInteration(this.widgetTarget) 14 } 15 } 16 17 delete() { 18 event.preventDefault() 19 this.dispatch('deleteWidget') 20 } 21 22 showGallery(event) { 23 const gallery = document.getElementById('widget-gallery') 24 gallery.loaded.then(() => { 25 const galleryContent = gallery.firstElementChild.cloneNode(true) 26 galleryContent.dataset.widgetId = this.widgetId 27 this.modalOutlet.loadContent(galleryContent) 28 }) 29 } 30 31 replaceWidget({replacementEl, widgetId, widgetType, widgetOptions}) { 32 if (widgetId != this.widgetId) { return } 33 34 this.element.dataset.widgetType = widgetType 35 this.element.dataset.widgetOptions = widgetOptions 36 this.widgetTarget.firstElementChild.replaceWith(replacementEl) 37 this.controlsTarget.hidden = false 38 this.dispatch('updatedWidget') 39 } 40 41 get widgetId() { 42 return this.element.dataset.widgetId 43 } 44 45 updateWidgetId() { 46 const newFrameId = `widget-${crypto.randomUUID()}` 47 this.element.dataset.widgetId = newFrameId 48 this.widgetTarget.firstElementChild.id = newFrameId 49 this.dispatch('updatedWidget') 50 } 51}
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.