PageSourceSearch

https://dashboard.y.uno/theme-init.js?v=58803a6e

js y.uno collected 2026-09-24 08:53:15 UTC 1,647 bytes, 40 lines download raw bytes

1// Apply the persisted theme to <html> BEFORE first paint so a dark-mode reload
2// doesn't flash the white loading splash. Mirrors useTheme's init logic
3// (THEME_MODE / DEVICE_MODE in localStorage).
4//
5// Loaded from index.html as a blocking classic script (no defer/async/module) so
6// it still runs before the splash paints. It lives in a file rather than inline
7// so the CSP served by CloudFront needs no per-build sha256 hash — see
8// VULS-5902 / DAS-17960.
9;(function () {
10  try {
11    var deviceMode = localStorage.getItem('DEVICE_MODE') === 'true'
12    var mode = localStorage.getItem('THEME_MODE')
13    var isDark = deviceMode
14      ? window.matchMedia('(prefers-color-scheme: dark)').matches
15      : mode === 'DARK_MODE'
16    if (isDark) {
17      var el = document.documentElement
18      el.classList.add('dark', 'dark-mode')
19      el.style.colorScheme = 'dark'
20    }
21  } catch (e) {
22    /* localStorage unavailable (private mode/SSR) — default to light */
23  }
24  try {
25    // Flag embedded mode on <html> before first paint so the opaque page and
26    // splash backgrounds can be dropped — a transparent --surface then reveals
27    // the host page. Mirrors getIsEmbedded(): ?embed=true, or the persisted flag
28    // while inside an iframe.
29    var isEmbedded =
30      new URLSearchParams(window.location.search).get('embed') === 'true' ||
31      (window.self !== window.top &&
32        sessionStorage.getItem('embedded') === 'true')
33    if (isEmbedded) {
34      document.documentElement.classList.add('embedded')
35      document.title = 'Dashboard'
36    }
37  } catch (e) {
38    /* sessionStorage unavailable — treat as standalone */
39  }
40})()

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.