PageSourceSearch

https://www.ensl.org/assets/controllers/forum_controller-d02d1ad8.js

js ensl.org collected 2026-09-25 10:50:28 UTC 1,893 bytes, 64 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3// Forum handlers: quick-reply behavior in topic/post pages, and the generic
4// data-on="click" / data-call dispatch used by inline "Quote" links.
5// Mounted globally on <body>.
6export default class extends Controller {
7  connect() {
8    this.handleClick = (event) => {
9      if (event.target.closest(".fastReply")) return this.showReply(event)
10
11      const callTarget = event.target.closest("[data-on='click'][data-call]")
12      if (callTarget) this.dispatchDataCall(event, callTarget)
13    }
14
15    document.addEventListener("click", this.handleClick)
16  }
17
18  disconnect() {
19    document.removeEventListener("click", this.handleClick)
20  }
21
22  // Shows the quick reply form and focuses its textarea, then hides the trigger button.
23  showReply(event) {
24    event.preventDefault()
25    const $ = window.jQuery
26    if (!$) return
27
28    $("#reply").fadeIn("fast", function() {
29      $(this).find("textarea").focus()
30      document.querySelectorAll(".fastReply").forEach((button) => button.classList.add("invisible"))
31    })
32  }
33
34  // Looks up the requested handler by name and invokes it with the parsed args.
35  dispatchDataCall(event, el) {
36    const handlers = { QuoteText: (id, type) => this.quoteText(id, type) }
37    const fn = handlers[el.dataset.call]
38    if (!fn) return
39
40    event.preventDefault()
41    const args = String(el.dataset.args || "")
42      .split(",")
43      .map((arg) => arg.trim().replace(/^['"]|['"]$/g, ""))
44      .filter((arg) => arg.length > 0)
45
46    fn(...args)
47  }
48
49  // Requests quote JS for a post/comment and executes the response.
50  quoteText(id, type) {
51    const $ = window.jQuery
52    if (!$) return
53
54    const quoteType = type || "posts"
55    const url = quoteType === "posts" ? `/posts/${id}/quote.js` : `/${quoteType}/quote.js?id=${id}`
56
57    $.ajax({
58      type: "GET",
59      url,
60      dataType: "script"
61    })
62  }
63}
64

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.