PageSourceSearch

https://gorearicayparinacota.cl/goreayp/js-local/accesibilidad.js

js gorearicayparinacota.cl collected 2026-10-02 18:35:42 UTC 8,252 bytes, 221 lines download raw bytes

1document.getElementById("btnAccesibilidad").addEventListener("click", () => {
2    let panel = document.getElementById("panelAccesibilidad");
3    panel.style.display = (panel.style.display === "block") ? "none" : "block";
4});
5
6// ── Tamaño de fuente ──────────────────────────────────────────────
7let fontSize = 0;
8
9let elementos = [
10    "body",
11    ".interior-title",
12    ".interior-body",
13    ".interior-body p",
14    ".interior-body h2",
15    ".interior-body h3",
16    ".interior-body h4",
17    ".interior-body li",
18    ".interior-body a",
19    ".interior-body table td",
20    ".interior-body table th",
21    ".news-card h3",
22    ".news-card p",
23    ".news-content .date",
24    ".taxport-title",
25    ".taxport-title a",
26    ".taxport-date",
27    ".taxport-btn",
28    ".sidebar-menu li a",
29    ".sidebar-widget-header h3",
30    ".section-header h2",
31    ".main-nav .nav-link",
32    ".dropdown-item",
33    ".breadcrumb",
34    ".breadcrumb-item",
35    ".footer-col li a",
36    ".footer-col h4",
37    ".contact-info",
38    ".hero-text h1",
39    ".hero-text .badge-label",
40    ".btn-hero",
41    ".news-date",
42    ".news-toolbar",
43    ".category-tag",
44    ".profile-bio",
45    ".profile-header-info h2",
46    ".profile-role",
47    ".meta-value",
48    ".meta-label",
49    ".doc-name",
50    ".doc-btn",
51    ".legal-links a",
52    "h1", "h2", "h3", "h4", "p", "a", "li", "span", "td", "th", "button", "label", "input"
53];
54
55function cambiarFuente(val, btn) {
56    if (val > 0 && fontSize >= 4) {
57        limpiarTamanosFuentes();
58        fontSize = 0;
59        btnActive(false, btn);
60        return;
61    }
62
63    fontSize++;
64    btnActive(true, btn);
65
66    elementos.forEach(selector => {
67        const els = document.querySelectorAll(selector);
68        els.forEach(el => {
69            if (el.closest('#accesibilidad')) {
70                return;
71            }
72            const current = parseFloat(window.getComputedStyle(el).fontSize);
73            if (current && !isNaN(current)) {
74                const nuevo = (current * (val > 0 ? 1.15 : 0.87)).toFixed(2);
75                el.style.setProperty('font-size', nuevo + 'px', 'important');
76                el.dataset.accFontScaled = "true";
77            }
78        });
79    });
80}
81
82function limpiarTamanosFuentes() {
83    document.querySelectorAll('[data-acc-font-scaled]').forEach(el => {
84        el.style.removeProperty('font-size');
85        delete el.dataset.accFontScaled;
86    });
87    fontSize = 0;
88}
89
90// ── Contraste ─────────────────────────────────────────────────────
91var tipoContraste = 1;
92function toggleContraste(btn) {
93    document.body.classList.remove('alto-contraste', 'contraste-oscuro');
94    if (tipoContraste === 0) {
95        btnActive(false, btn);
96    } else {
97        btnActive(true, btn);
98        if (tipoContraste === 1) document.body.classList.add('alto-contraste');
99        if (tipoContraste === 2) document.body.classList.add('contraste-oscuro');
100    }
101    tipoContraste++;
102    if (tipoContraste > 2) tipoContraste = 0;
103}
104
105// ── Saturación ────────────────────────────────────────────────────
106var tipoSaturacion = 1;
107function toggleSaturacion(btn) {
108    document.body.classList.remove('desaturado', 'poca-saturacion', 'mucha-saturacion');
109    if (tipoSaturacion === 0) {
110        btnActive(false, btn);
111    } else {
112        btnActive(true, btn);
113        if (tipoSaturacion === 1) document.body.classList.add('desaturado');
114        if (tipoSaturacion === 2) document.body.classList.add('poca-saturacion');
115        if (tipoSaturacion === 3) document.body.classList.add('mucha-saturacion');
116    }
117    tipoSaturacion++;
118    if (tipoSaturacion > 3) tipoSaturacion = 0;
119}
120
121// ── Subrayar enlaces ──────────────────────────────────────────────
122function toggleSubrayado(btn) {
123    const activo = document.body.classList.toggle("subrayado-links");
124    btnActive(activo, btn);
125}
126
127// ── Espaciado entre letras ────────────────────────────────────────
128var espaciadoTexto = 1;
129function toggleEspaciado(btn) {
130    document.body.classList.remove('espaciado-1', 'espaciado-2', 'espaciado-3');
131    if (espaciadoTexto === 0) {
132        btnActive(false, btn);
133    } else {
134        btnActive(true, btn);
135        if (espaciadoTexto === 1) document.body.classList.add('espaciado-1');
136        if (espaciadoTexto === 2) document.body.classList.add('espaciado-2');
137        if (espaciadoTexto === 3) document.body.classList.add('espaciado-3');
138    }
139    espaciadoTexto++;
140    if (espaciadoTexto > 3) espaciadoTexto = 0;
141}
142
143// ── Altura de línea ───────────────────────────────────────────────
144var espaciadoHorizontalTexto = 1;
145function toggleEspaciadoHorizontal(btn) {
146    document.body.classList.remove('espaciado-h-1', 'espaciado-h-2', 'espaciado-h-3');
147    if (espaciadoHorizontalTexto === 0) {
148        btnActive(false, btn);
149    } else {
150        btnActive(true, btn);
151        if (espaciadoHorizontalTexto === 1) document.body.classList.add('espaciado-h-1');
152        if (espaciadoHorizontalTexto === 2) document.body.classList.add('espaciado-h-2');
153        if (espaciadoHorizontalTexto === 3) document.body.classList.add('espaciado-h-3');
154    }
155    espaciadoHorizontalTexto++;
156    if (espaciadoHorizontalTexto > 3) espaciadoHorizontalTexto = 0;
157}
158
159// ── Cursor grande ─────────────────────────────────────────────────
160function toggleCursor(btn) {
161    const activo = document.body.classList.toggle("cursor-1");
162    btnActive(activo, btn);
163}
164
165// ── Fuente para dislexia ──────────────────────────────────────────
166var tipoDislexia = 1;
167function toggleDislexia(btn) {
168    document.body.classList.remove("dislexia-1", "dislexia-2");
169    if (tipoDislexia === 0) {
170        btnActive(false, btn);
171    } else {
172        btnActive(true, btn);
173        if (tipoDislexia === 1) document.body.classList.add('dislexia-1');
174        if (tipoDislexia === 2) document.body.classList.add('dislexia-2');
175    }
176    tipoDislexia++;
177    if (tipoDislexia > 2) tipoDislexia = 0;
178}
179
180// ── Ocultar imágenes ──────────────────────────────────────────────
181function toggleImagenes(btn) {
182    const activo = document.body.classList.toggle("hiddenImg");
183    btnActive(activo, btn);
184}
185
186// ── Helpers ───────────────────────────────────────────────────────
187function btnActive(active, btn) {
188    if (active) {
189        btn.classList.remove('btn-dark');
190        btn.classList.add('btn-primary');
191    } else {
192        btn.classList.remove('btn-primary');
193        btn.classList.add('btn-dark');
194    }
195}
196
197// ── Restablecer todo ──────────────────────────────────────────────
198function resetAccesibilidad() {
199    limpiarTamanosFuentes();
200
201    document.body.classList.remove(
202        "hiddenImg",
203        "dislexia-1", "dislexia-2",
204        "espaciado-h-1", "espaciado-h-2", "espaciado-h-3",
205        "cursor-1",
206        "espaciado-1", "espaciado-2", "espaciado-3",
207        "subrayado-links",
208        "desaturado", "poca-saturacion", "mucha-saturacion",
209        "alto-contraste", "contraste-oscuro"
210    );
211
212    tipoContraste = 1;
213    tipoSaturacion = 1;
214    espaciadoTexto = 1;
215    espaciadoHorizontalTexto = 1;
216    tipoDislexia = 1;
217    fontSize = 0;
218
219    const botones = document.querySelectorAll('#panelAccesibilidad button:not(.btn-danger)');
220    botones.forEach(boton => btnActive(false, boton));
221}

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.