PageSourceSearch

https://uplink.tech/assets/baseline/controllers/lazy/alert_controller-a9b4a0af.js

js uplink.tech collected 2026-09-29 13:30:17 UTC 1,126 bytes, 43 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2import Cookies        from "js-cookie"
3
4export default class extends Controller {
5  static values = {
6    cookieName: { type: String, default: "closed_alerts" },
7    hideId:     String
8  }
9
10  connect() {
11    if (!this.hasHideIdValue || !this.closedAlerts.includes(this.hideIdValue))
12      this.element.classList.remove("d-none", "hidden")
13
14    const linkClass = "alert-link"
15    this
16      .element
17      .querySelectorAll(`a:not(.btn):not(.${linkClass})`)
18      .forEach(link => link.classList.add(linkClass))
19  }
20
21  close() {
22    if (this.hasHideIdValue) {
23      const closedAlerts = this.closedAlerts
24      if (!closedAlerts.includes(this.hideIdValue))
25        closedAlerts.push(this.hideIdValue)
26      this.closedAlerts = closedAlerts
27    }
28
29    this.element.remove()
30  }
31
32  disconnect() {
33    document.dispatchEvent(new Event("alert-closed", { bubbles: true }))
34  }
35
36  get closedAlerts() {
37    return JSON.parse(Cookies.get(this.cookieNameValue) || "[]")
38  }
39
40  set closedAlerts(value) {
41    Cookies.set(this.cookieNameValue, JSON.stringify(value), { expires: 365 })
42  }
43}

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.