1/** 2 * Fiscomania â Dimensione testo regolabile (Aâ / A+) 3 * 4 * Controllo di accessibilità nella topbar (mobile): ingrandisce/riduce il testo 5 * di lettura degli articoli. La scala è una variabile CSS (--fm-text-scale) usata 6 * da .prose in main.css, persistita in localStorage e riapplicata pre-paint dal 7 * bootstrap inline (inc/theme-options.php) â niente flash/CLS al caricamento. 8 */ 9(function () { 10 'use strict'; 11 12 var KEY = 'fm-textsize'; 13 var MIN = 0.9; // -10% 14 var MAX = 1.6; // +60% 15 var STEP = 0.1; 16 var DEF = 1; 17 18 function clamp(v) { return Math.min(MAX, Math.max(MIN, Math.round(v * 100) / 100)); } 19 20 function read() { 21 var v = parseFloat(localStorage.getItem(KEY)); 22 return (v && v >= MIN && v <= MAX) ? v : DEF; 23 } 24 25 function apply(v) { 26 document.documentElement.style.setProperty('--fm-text-scale', String(v)); 27 } 28 29 function save(v) { 30 try { localStorage.setItem(KEY, String(v)); } catch (e) {} 31 } 32 33 var current = read(); 34 apply(current); // idempotente: il bootstrap l'ha già applicata, qui per sicurezza 35 36 var btns = document.querySelectorAll('[data-fm-textsize]'); 37 if (!btns.length) return; 38 39 function refresh() { 40 btns.forEach(function (b) { 41 var dir = b.getAttribute('data-fm-textsize'); 42 if (dir === 'dec') b.disabled = current <= MIN; 43 if (dir === 'inc') b.disabled = current >= MAX; 44 if (dir === 'reset') b.hidden = current === DEF; 45 }); 46 } 47 48 btns.forEach(function (b) { 49 b.addEventListener('click', function () { 50 var dir = b.getAttribute('data-fm-textsize'); 51 if (dir === 'reset') { 52 current = DEF; 53 } else { 54 current = clamp(current + (dir === 'inc' ? STEP : -STEP)); 55 } 56 apply(current); 57 save(current); 58 refresh(); 59 }); 60 }); 61 62 refresh(); 63})();
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.