1jQuery(document).ready(function($) { 2 let fontSize = 100; 3 4 $('#accessibility-launcher, #toolbar-close-button').click(function() { 5 $('#accessibility-toolbar').toggle(); 6 }); 7 8 $('#increase-font').click(function() { 9 fontSize += 10; 10 changeFontSize(fontSize); 11 }); 12 13 $('#decrease-font').click(function() { 14 fontSize -= 10; 15 changeFontSize(fontSize); 16 }); 17 18 function changeFontSize(size) { 19 const elements = $('.title-heading-tag, p, h1, h2, h3, h4, h5, h6, a, span, li, blockquote, label, td, th'); 20 elements.css('font-size', size + '%'); 21 } 22 23 $('#toggle-contrast').click(function() { 24 $('body').toggleClass('high-contrast'); 25 }); 26 27 $('#underline-links').click(function() { 28 $('body').toggleClass('underline-links'); 29 }); 30 31 $('#toggle-grayscale').click(function() { 32 $('body').toggleClass('grayscale'); 33 }); 34 $('#turn-off-all').click(function() { 35 fontSize = 100; 36 changeFontSize(100); 37 $('body').removeClass('grayscale') 38 .removeClass('high-contrast') 39 .removeClass('underline-links'); 40 }); 41}); 42 43function capitalizeFirstLetter(str) { 44 if (!str) return ''; 45 return str.charAt(0).toUpperCase() + str.slice(1); 46} 47 48function addAriaLabelSelectFields() { 49 document.querySelectorAll('select').forEach(select => { 50 // Skip if already has aria-label 51 if (select.hasAttribute('aria-label')) return; 52 53 let label = ''; 54 55 if (select.id) { 56 // If ID exists, use it 57 label = 'Auswahlfeld '+capitalizeFirstLetter(select.id); 58 } else { 59 // Otherwise, use the first option's text/value as fallback 60 const firstOption = select.options[select.selectedIndex] || select.options[0]; 61 label = firstOption?.text?.trim() || ' Auswahlfeld'; 62 } 63 64 select.setAttribute('aria-label', label); 65 }); 66}; 67function addAriaLabelsToExtraLinks() { 68 document.querySelectorAll('a.extra-link').forEach(link => { 69 if (!link.hasAttribute('aria-label')) { 70 const id = link.getAttribute('id'); 71 if (id) { 72 link.setAttribute('aria-label', '${id}_link'); 73 } else { 74 let href = link.getAttribute('href') || ''; 75 let labelPart = ''; 76 77 if (href.startsWith('mailto:')) { 78 labelPart = `Email an ${href.replace('mailto:', '')}`; 79 } else if (href.startsWith('tel:')) { 80 labelPart = `Telefon ${href.replace('tel:', '')}`; 81 } else { 82 try { 83 const url = new URL(href, window.location.origin); 84 const hostname = url.hostname; 85 labelPart = `Link zu `+href; 86 } catch (e) { 87 labelPart = ' unbekannter Link '; 88 } 89 } 90 91 link.setAttribute('aria-label', labelPart); 92 } 93 } 94 }); 95}; 96function hideUnlabeledImagesFromAccessibility() { 97 document.querySelectorAll('img').forEach(img => { 98 const hasAlt = img.hasAttribute('alt') && img.getAttribute('alt').trim() !== ''; 99 const hasTitle = img.hasAttribute('title') && img.getAttribute('title').trim() !== ''; 100 const hasAriaLabel = img.hasAttribute('aria-label') && img.getAttribute('aria-label').trim() !== ''; 101 const hasAriaLabelledBy = img.hasAttribute('aria-labelledby') && img.getAttribute('aria-labelledby').trim() !== ''; 102 if (!hasAlt && !hasTitle && !hasAriaLabel && !hasAriaLabelledBy) { 103 img.setAttribute('aria-hidden', 'true'); 104 img.setAttribute('aria-disabled', 'true'); 105 } 106 }); 107 document.querySelectorAll('img.bubble').forEach(img => { 108 const hasAlt = img.hasAttribute('alt') && img.getAttribute('alt').trim() !== ''; 109 const hasTitle = img.hasAttribute('title') && img.getAttribute('title').trim() !== ''; 110 const hasAriaLabel = img.hasAttribute('aria-label') && img.getAttribute('aria-label').trim() !== ''; 111 const hasAriaLabelledBy = img.hasAttribute('aria-labelledby') && img.getAttribute('aria-labelledby').trim() !== ''; 112 if (!hasAlt && !hasTitle && !hasAriaLabel && !hasAriaLabelledBy) { 113 img.setAttribute('aria-hidden', 'true'); 114 img.setAttribute('aria-disabled', 'true'); 115 } 116 });
117}; 118 119function insertMissingHeadingLevels() { 120 const headings = Array.from(document.body.querySelectorAll('h1, h2, h3, h4, h5, h6')); 121 console.log(headings); 122 let lastLevel = 0; 123 124 const hiddenClass = 'visually-hidden'; 125 126 // Create the CSS for visually hidden class if it doesn't exist 127 if (!document.querySelector('#visually-hidden-style')) { 128 const style = document.createElement('style'); 129 style.id = 'visually-hidden-style'; 130 style.textContent = ` 131 .${hiddenClass} { 132 position: absolute !important; 133 width: 1px; height: 1px; 134 padding: 0; margin: -1px; 135 overflow: hidden; 136 clip: rect(0 0 0 0); 137 white-space: nowrap; 138 border: 0; 139 }`; 140 document.head.appendChild(style); 141 } 142 143 headings.forEach(heading => { 144 const currentLevel = parseInt(heading.tagName.substring(1)); 145 if (lastLevel && currentLevel > lastLevel + 1) { 146 // Insert missing levels before this heading 147 const container = heading.parentNode; 148 for (let i = lastLevel + 1; i < currentLevel; i++) { 149 const filler = document.createElement('div'); 150 filler.setAttribute('role', 'heading'); 151 filler.setAttribute('aria-level', i); 152 filler.className = hiddenClass; 153 filler.textContent = `Ebene ${i} Platzhalter`; 154 container.insertBefore(filler, heading); 155 } 156 } 157 lastLevel = currentLevel; 158 }); 159} 160function improvePdfLinkAccessibility() { 161 document.querySelectorAll('a[href$=".pdf"]').forEach(link => { 162 // Skip if aria-label already exists 163 if (link.hasAttribute('aria-label')) return; 164 165 const linkText = link.textContent.trim(); 166 const filename = link.getAttribute('href').split('/').pop(); 167 168 const description = linkText 169 ? `${linkText}, PDF Dokument` 170 : `${filename}, PDF Dokument`; 171 172 link.setAttribute('aria-label', description); 173 }); 174} 175function hideUnlabeledIframesFromAccessibility() { 176 document.querySelectorAll('iframe').forEach(iframe => { 177 const hasTitle = iframe.hasAttribute('title') && iframe.getAttribute('title').trim() !== ''; 178 const hasAriaLabel = iframe.hasAttribute('aria-label') && iframe.getAttribute('aria-label').trim() !== ''; 179 const hasAriaLabelledBy = iframe.hasAttribute('aria-labelledby') && iframe.getAttribute('aria-labelledby').trim() !== ''; 180 181 if (!hasTitle && !hasAriaLabel && !hasAriaLabelledBy) { 182 iframe.setAttribute('aria-hidden', 'true'); 183 } 184 }); 185} 186document.addEventListener("DOMContentLoaded" , () =>{ 187 let heading ; 188 if( document.querySelectorAll("h1").length ){ 189 heading = document.querySelectorAll("h1")[0] ; 190 } 191 else{ 192 if(document.querySelectorAll("h2").length){ 193 heading = document.querySelectorAll("h2")[0] 194 } 195 else{ 196 if(document.querySelectorAll("h3").length){ 197 heading = document.querySelectorAll("h3")[0] 198 } 199 else{ 200 if(document.querySelectorAll("h4").length){ 201 heading = document.querySelectorAll("h4")[0] 202 } 203 } 204 } 205 } 206 // console.log("heading" , heading); 207 if(heading){ 208 let images = document.querySelectorAll("img"); 209 // console.log(images); 210 let counter = 1; 211 images.forEach((image) =>{ 212 if (!image.alt){
213 image.setAttribute("alt" , heading.innerText + " ( Bild " + counter + " )" ); 214 counter ++ ; 215 } 216 }); 217 } 218 219} ) 220setTimeout(() =>{ 221 let heading ; 222 if( document.querySelectorAll("h1").length ){ 223 heading = document.querySelectorAll("h1")[0] ; 224 } 225 else{ 226 if(document.querySelectorAll("h2").length){ 227 heading = document.querySelectorAll("h2")[0] 228 } 229 else{ 230 if(document.querySelectorAll("h3").length){ 231 heading = document.querySelectorAll("h3")[0] 232 } 233 else{ 234 if(document.querySelectorAll("h4").length){ 235 heading = document.querySelectorAll("h4")[0] 236 } 237 } 238 } 239 } 240 // console.log("heading" , heading); 241 if(heading){ 242 let images = document.querySelectorAll("img"); 243 // console.log(images); 244 let counter = 1; 245 images.forEach((image) =>{ 246 if (!image.alt){
247 image.setAttribute("alt" , heading.innerText + " ( Bild " + counter + " )" ); 248 counter ++ ; 249 } 250 }); 251 } 252 253}, 700 ) 254document.addEventListener('DOMContentLoaded', () => { 255 addAriaLabelSelectFields(); 256 addAriaLabelsToExtraLinks(); 257 hideUnlabeledImagesFromAccessibility(); 258 insertMissingHeadingLevels(); 259 improvePdfLinkAccessibility(); 260 hideUnlabeledIframesFromAccessibility(); 261});
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.