PageSourceSearch

https://comsyoknyakaunseling-production.up.railway.app/assets/controllers/theme_controller-7a6fa7a3.js

js comsyoknyakaunseling-production.up.railway.app collected 2026-10-03 12:13:04 UTC 1,092 bytes, 39 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3export default class extends Controller {
4  static targets = ["icon", "text"]
5
6  connect() {
7    this.initializeTheme()
8  }
9
10  initializeTheme() {
11    if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
12      document.documentElement.classList.add('dark')
13      this.updateUI(true)
14    } else {
15      document.documentElement.classList.remove('dark')
16      this.updateUI(false)
17    }
18  }
19
20  toggle() {
21    if (document.documentElement.classList.contains('dark')) {
22      document.documentElement.classList.remove('dark')
23      localStorage.theme = 'light'
24      this.updateUI(false)
25    } else {
26      document.documentElement.classList.add('dark')
27      localStorage.theme = 'dark'
28      this.updateUI(true)
29    }
30  }
31
32  updateUI(isDark) {
33    // Optional: Update icon or text if targets exist
34    if (this.hasIconTarget) {
35      // Logic to switch icon (e.g. sun/moon)
36      // For now we assume the user will implement the icon SVG logic in the view
37    }
38  }
39}

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.