PageSourceSearch

https://www.uide.edu.ec/wp-content/themes/softek-child/dark-mode.js

js uide.edu.ec collected 2026-10-02 15:05:15 UTC 1,201 bytes, 46 lines download raw bytes

1/**
2 * UIDE Dark Mode
3 * - Solo se activa con clic explícito del usuario
4 * - No detecta preferencia del sistema operativo
5 * - Compatible con WP Rocket
6 * - Colores WCAG AA compliant con paleta UIDE
7 */
8(function () {
9    'use strict';
10
11    const STORAGE_KEY = 'uide-dark-mode';
12    const DARK_CLASS = 'dark-mode';
13
14    /**
15     * Initialize dark mode
16     * SOLO activar si el usuario hizo clic explícitamente
17     */
18    function initDarkMode() {
19        const saved = localStorage.getItem(STORAGE_KEY);
20        if (saved === 'true') {
21            document.documentElement.classList.add(DARK_CLASS);
22        }
23    }
24
25    /**
26     * Toggle dark mode
27     */
28    function toggleDarkMode() {
29        const html = document.documentElement;
30        const isDark = html.classList.toggle(DARK_CLASS);
31        localStorage.setItem(STORAGE_KEY, isDark ? 'true' : 'false');
32        return isDark;
33    }
34
35    // Initialize
36    if (document.readyState === 'loading') {
37        document.addEventListener('DOMContentLoaded', initDarkMode);
38    } else {
39        initDarkMode();
40    }
41
42    // Expose toggle globally for accessibility panel
43    window.uideDarkMode = {
44        toggle: toggleDarkMode
45    };
46})();

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.