1(function () { 2 var STORAGE_KEY = 'afp-article-font-size'; 3 var DEFAULT_SIZE = 16; 4 var MIN_SIZE = 14; 5 var MAX_SIZE = 24; 6 var STEP = 2; 7 8 // Any single template that renders the reader controls: posts, stories, 9 // policy corner. They all share the .individual-article wrapper. 10 var article = document.querySelector('.individual-article'); 11 if (!article) return; 12 13 var currentSize = DEFAULT_SIZE; 14 15 var stored = localStorage.getItem(STORAGE_KEY); 16 if (stored) { 17 var size = parseInt(stored, 10); 18 if (size >= MIN_SIZE && size <= MAX_SIZE) { 19 currentSize = size; 20 article.style.setProperty('--article-font-size', size + 'px'); 21 } 22 } 23 24 function updateButtonStates() { 25 var decrease = article.querySelector('[data-font-action="decrease"]'); 26 var increase = article.querySelector('[data-font-action="increase"]'); 27 if (decrease) decrease.disabled = currentSize <= MIN_SIZE; 28 if (increase) increase.disabled = currentSize >= MAX_SIZE; 29 } 30 31 updateButtonStates(); 32 33 article.addEventListener('click', function (e) { 34 var btn = e.target.closest('[data-font-action]'); 35 if (!btn || btn.disabled) return; 36 37 var action = btn.getAttribute('data-font-action'); 38 var next = currentSize; 39 40 if (action === 'increase' && currentSize < MAX_SIZE) { 41 next = currentSize + STEP; 42 } else if (action === 'decrease' && currentSize > MIN_SIZE) { 43 next = currentSize - STEP; 44 } else if (action === 'reset') { 45 next = DEFAULT_SIZE; 46 } 47 48 currentSize = next; 49 article.style.setProperty('--article-font-size', next + 'px'); 50 localStorage.setItem(STORAGE_KEY, next); 51 updateButtonStates(); 52 }); 53})();
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.