PageSourceSearch

https://miloslaw.info.pl/wp-content/plugins/miloslaw-accessibility/accessibility.js?ver=1.1.3

js miloslaw.info.pl collected 2026-10-02 12:53:08 UTC 16,989 bytes, 186 lines download raw bytes

1/* Site-specific keyboard behaviour for the existing Egovenz controls. */
2(function () {
3 'use strict';
4 function start() {
5  const q=(s,r=document)=>Array.from(r.querySelectorAll(s));
6  const visible=e=>!!(e.getClientRects().length) && getComputedStyle(e).visibility!=='hidden';
7  const focusables=r=>q('a[href],button,input:not([type=hidden]),textarea,select,[tabindex="0"]',r).filter(e=>visible(e)&&!e.disabled&&!e.closest('[inert]'));
8  const panels=[];
9  function panel(selector,triggerSelector,isOpen) {
10   const el=document.querySelector(selector); if(!el)return;
11   if(!el.id)el.id='miloslaw-panel-'+panels.length;
12   const controls=q(triggerSelector); let lastTrigger=null, previous=false;
13   function sync() {
14    const open=isOpen(el); el.inert=!open;
15    el.setAttribute('aria-hidden',String(!open));
16    controls.forEach(c=>{c.setAttribute('aria-controls',el.id);c.setAttribute('aria-expanded',String(open));});
17    if(open&&!previous) requestAnimationFrame(()=>{const f=focusables(el);if(f.length)f[0].focus();});
18    if(!open&&previous&&lastTrigger)lastTrigger.focus();
19    previous=open;
20   }
21   controls.forEach(c=>c.addEventListener('click',()=>{if(!el.contains(c))lastTrigger=c;setTimeout(sync,0);}));
22   new MutationObserver(sync).observe(el,{attributes:true,attributeFilter:['class']});
23   const parent=el.closest('.search-toggle-wrap');
24   if(parent)new MutationObserver(sync).observe(parent,{attributes:true,attributeFilter:['class']});
25   function close() {
26    if(!isOpen(el))return;
27    const c=controls.find(x=>el.contains(x)&&x.classList.contains('close'))||lastTrigger||controls[0];
28    if(c)c.click();
29   }
30   el.addEventListener('keydown',e=>{
31    if(e.key==='Escape'){e.preventDefault();close();}
32    if(e.key==='Tab'&&isOpen(el)) {
33     const fs=focusables(el); const last=fs[fs.length-1];
34     if(!e.shiftKey&&e.target===last){e.preventDefault();close();if(lastTrigger)lastTrigger.focus();}
35     else if(e.shiftKey&&e.target===fs[0]){e.preventDefault();close();}
36    }
37   });
38   panels.push({el,isOpen,close}); sync();
39  }
40  panel('.mobile-bar','.mobile-bar-toggle',e=>e.classList.contains('active'));
41  panel('.full-search-wrapper','.full-search-toggle',e=>e.classList.contains('search-wrapper-opened'));
42  panel('.bottom-search-wrap','.bottom-search-toggle',e=>e.parentElement.classList.contains('active'));
43  const secondary=document.querySelector('.secondary-menu-area');
44  if(secondary){const sync=()=>{secondary.inert=!document.body.classList.contains('secondary-active');};sync();new MutationObserver(sync).observe(document.body,{attributes:true,attributeFilter:['class']});}
45  document.addEventListener('keydown',e=>{
46   if(e.key===' '&&e.target.matches('a[role="button"],.owl-prev,.owl-next,.owl-dot')){e.preventDefault();e.target.click();}
47   if(e.key==='Enter'&&e.target.matches('.owl-prev:not(button),.owl-next:not(button),.owl-dot:not(button)')){e.preventDefault();e.target.click();}
48   if(e.key==='Escape')panels.forEach(p=>{if(p.isOpen(p.el))p.close();});
49  });
50
51  const video=document.getElementById('slider-4-slide-4-layer-3');
52  if(video){video.setAttribute('role','link');video.setAttribute('tabindex','0');video.setAttribute('aria-label','Zobacz film o Gminie Miłosław w serwisie YouTube');video.addEventListener('keydown',e=>{if(e.key==='Enter'){e.preventDefault();video.click();}});}
53  const socialTargets={'social-fb':'https://www.facebook.com/Gmina-Miłosław-197043984446532','social-instagram':'https://www.instagram.com/gminamiloslaw/','social-youtube':'https://www.youtube.com/channel/UC1WqK9M3msprcr1joo2N0dg'};
54  q('.page-id-5163 .social-icons a[href="#"]').forEach(a=>{const cls=Object.keys(socialTargets).find(c=>a.classList.contains(c));if(cls){a.href=socialTargets[cls];a.setAttribute('aria-label','Gmina Miłosław - '+{'social-fb':'Facebook','social-instagram':'Instagram','social-youtube':'YouTube'}[cls]);}else{a.removeAttribute('href');a.setAttribute('aria-hidden','true');}});
55  q('.zozo-horizontal-slider-wrap').forEach(wrap=>{
56   const ticker=wrap.querySelector('.zozo-horizontal-slider');if(!ticker)return;
57   const control=document.createElement('button');control.type='button';control.className='miloslaw-motion-control';control.textContent='Zatrzymaj pasek komunikatów';control.setAttribute('aria-pressed','false');
58   function pause(){ticker.classList.add('miloslaw-static-news');control.textContent='Wznów pasek komunikatów';control.setAttribute('aria-pressed','true');}
59   control.addEventListener('click',()=>{if(ticker.classList.contains('miloslaw-static-news')){ticker.classList.remove('miloslaw-static-news');control.textContent='Zatrzymaj pasek komunikatów';control.setAttribute('aria-pressed','false');}else pause();});
60   wrap.append(control);ticker.addEventListener('focusin',pause);
61   if(matchMedia('(prefers-reduced-motion: reduce)').matches)pause();
62  });
63
64  const skip=document.querySelector('.miloslaw-skip-link');
65  if(skip)skip.addEventListener('click',()=>{const main=(document.getElementById('miloslaw-main')||document.getElementById('main'));if(main)main.focus();});
66  q('.back-to-top').forEach(e=>e.addEventListener('click',()=>{if(skip)skip.focus({preventScroll:true});}));
67  // Give repeated article links their visible article title, including carousel clones.
68  function names(root=document) {
69   q('a',root).filter(a=>/^(Czytaj więcej|Więcej informacji)/i.test(a.textContent.trim())).forEach(a=>{
70    const box=a.closest('.feature-box-inner');
71    let heading=box&&box.querySelector('.feature-box-title');
72    if(!heading){let p=a.parentElement;for(let i=0;p&&i<5;i++,p=p.parentElement){heading=p.querySelector('.post-title-head');if(heading)break;}}
73    if(heading)a.setAttribute('aria-label',a.textContent.trim()+' '+heading.textContent.trim());
74   });
75  }
76  names();
77  // Home shortcuts: retain the existing destinations, correct the entrepreneur card.
78  q('.home .feature-box-inner').forEach(box=>{
79   const h=box.querySelector('.feature-box-title');if(!h)return;
80   const title=h.textContent.trim();
81   if(['Mieszkaniec','Turysta','Przedsiębiorca'].includes(title)){
82    q('a',box).forEach(a=>{a.removeAttribute('target');if(title==='Przedsiębiorca')a.setAttribute('href','/przedsiebiorca/');});
83   }
84  });
85  q('.owl-carousel').forEach((el,index)=>{
86   function sync(){
87    q('.owl-prev,.owl-next,.owl-dot',el).forEach((c,i)=>{c.setAttribute('role','button');c.setAttribute('tabindex','0');c.setAttribute('aria-label',c.classList.contains('owl-prev')?'Poprzednie aktualności':c.classList.contains('owl-next')?'Następne aktualności':'Przejdź do slajdu '+(i+1));});
88    q('.owl-item',el).forEach(item=>{item.inert=!item.classList.contains('active');item.setAttribute('aria-hidden',String(item.inert));});names(el);
89   }
90   sync();
91   if(window.jQuery)window.jQuery(el).on('initialized.owl.carousel translated.owl.carousel refreshed.owl.carousel',sync);
92   const button=document.createElement('button');button.type='button';button.className='miloslaw-motion-control';button.textContent='Wstrzymaj przewijanie aktualności';button.setAttribute('aria-pressed','false');
93   let paused=false;
94   function pause(){paused=true;if(window.jQuery)window.jQuery(el).trigger('stop.owl.autoplay');button.textContent='Wznów przewijanie aktualności';button.setAttribute('aria-pressed','true');}
95   button.addEventListener('click',()=>{if(paused){paused=false;if(window.jQuery)window.jQuery(el).trigger('play.owl.autoplay');button.textContent='Wstrzymaj przewijanie aktualności';button.setAttribute('aria-pressed','false');}else pause();});
96   el.insertAdjacentElement('beforebegin',button);el.addEventListener('focusin',pause);
97   if(matchMedia('(prefers-reduced-motion: reduce)').matches)pause();
98  });
99 }
100 if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start);else start();
101})();
102
103/* Follow-up accessibility corrections, 14 September 2026. */
104(function(){
105 'use strict';
106 function apply(){
107  const h=document.querySelector('h1');
108  if(h&&/^Search Result for:/i.test(h.textContent.trim()))h.textContent=h.textContent.replace(/Search Result for:/i,'Wyniki wyszukiwania dla:');
109  document.querySelectorAll('.wpcf7 form').forEach(f=>f.setAttribute('aria-label','Formularz kontaktowy'));
110  const translations={
111   '.hu-iframe-heading':'Treść zewnętrzna Google jest zablokowana',
112   '.hu-iframe-data':'Google otrzyma Twój adres IP i może zapisać pliki cookie.',
113   '.hu-iframe-consent':'Odblokowanie oznacza zgodę na personalizację treści w całej tej witrynie, nie tylko dla tego osadzonego materiału.',
114   '.hu-iframe-withdraw':'Możesz zmienić swój wybór w dowolnym momencie.',
115   '.hu-iframe-policy':'Polityka prywatności Google (otwiera się w nowej karcie)'
116  };
117  document.querySelectorAll('.hu-iframe-content').forEach(box=>{
118   if(!box.querySelector('a[href="https://policies.google.com/privacy"]'))return;
119   Object.entries(translations).forEach(([sel,text])=>{const e=box.querySelector(sel);if(e&&e.textContent!==text)e.textContent=text;});
120  });
121  document.querySelectorAll('button[aria-label="Revoke Icon"]').forEach(b=>b.setAttribute('aria-label','Zmień ustawienia prywatności'));
122 }
123 function start(){
124  apply();let queued=false;
125  new MutationObserver(()=>{if(!queued){queued=true;requestAnimationFrame(()=>{queued=false;apply();});}}).observe(document.body,{childList:true,subtree:true});
126  document.addEventListener('wpcf7invalid',e=>{setTimeout(()=>{const field=e.target.querySelector('[aria-invalid="true"]');if(field)field.focus();}
126,0);});
127 }
128 if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start);else start();
129})();
130
131(function(){
132 'use strict';
133 const photos={"D549FDA4-9A27-4D64-9C29-5A18DDB1B82E_www.jpeg":"Czerwony zachód słońca nad ciemną linią drzew.","received_868727757290594_www.jpeg":"Ośnieżona droga wśród drzew oświetlonych niskim słońcem.","2F93F599-880E-4D03-9C78-69FDBF4434E7_www.jpeg":"Turbina wiatrowa nad zielonym polem o zachodzie słońca.","received_2197087430435833_www.jpeg":"Zachód słońca odbijający się w wodzie.","FB01429D-3AC9-46B9-B2C0-82D27ABECA93_www.jpeg":"Oświetlona fasada pałacu na tle nocnego nieba.","02_A_www.jpg":"Turbina wiatrowa pośród pól widziana z lotu ptaka.","DSC_0060_www.jpg":"Zielony park z wieżą kościoła w tle.","DSC_0001_www.jpg":"Stado ptaków nad sylwetkami drzew i wież o zmierzchu.","received_383197059555623_www.jpeg":"Jesienne drzewa i opadłe liście w promieniach słońca.","received_390687022373539_www.jpeg":"Jesienne drzewa rosnące nad wodą.","received_669659330380771_www.jpeg":"Pałac widoczny przez ośnieżone gałęzie drzew.","108B6227-6D22-456E-AFB8-8D28DF343F9E_www.jpeg":"Ceglany kościół z wieżyczką, otoczony drzewami.","Miloslaw_baner_04.jpg":"Stado ptaków nad sylwetkami drzew i wież o zmierzchu.","Miloslaw_baner_02-1.jpg":"Pałac i park ze stawami widziane z lotu ptaka.","Miloslaw_baner_01-1.jpg":"Pałac i trawnik w świetle nocnej iluminacji.","received_389906815626698_www.jpeg":"Ścieżka w jesiennym lesie oświetlonym słońcem.","1100801_www.jpg":"Nocna ulica z zabytkowymi budynkami i smugami świateł samochodów.","1100971_www.jpg":"Wieże kościoła na tle wielkiej tarczy zachodzącego słońca.","1110022-01_www.jpg":"Sylwetka kościoła obok tarczy zachodzącego słońca.","1110054_www.jpg":"Zachód słońca nad zabudowaniami i wieżami kościoła.","1110097-01_www.jpg":"Osoba na ośnieżonej drodze prowadzącej w stronę zachodzącego słońca.","1060584_www.jpg":"Pałac za stawem i drzewami w jesiennym parku.","1060683_www.jpg":"Słońce rzucające długie cienie drzew na trawnik w parku.","1070038_www.jpg":"Wieże kościoła i zabudowania za wodą i drzewami.","1070055-3_www.jpg":"Panorama miasta ponad dachami domów o zmierzchu."};
134 function start(){
135  document.querySelectorAll('.home .feature-box-title a[href="#"]').forEach(a=>{a.removeAttribute('href');a.removeAttribute('target');a.style.cursor='default';});
136  document.querySelectorAll('.elementor-image-carousel-wrapper a[href]').forEach(a=>{const name=decodeURIComponent(a.href.split('/').pop());if(photos[name]){a.setAttribute('aria-label','Powiększ zdjęcie: '+photos[name]);const img=a.querySelector('img');if(img)img.alt=photos[name];}});
137  document.querySelectorAll('a[href="https://pl.wikipedia.org/wiki/Mi%C5%82os%C5%82aw#Zabytki"]').forEach(a=>{if(a.textContent.trim()==='|')a.setAttribute('aria-label','Zabytki Miłosławia w Wikipedii');});
138  document.querySelectorAll('.elementor-image-carousel-wrapper').forEach(el=>{
139   let attempts=0;
140   function setup(){
141    const s=el.swiper;if(!s){if(++attempts<10)setTimeout(setup,500);return;}
142    function sync(){const r=el.getBoundingClientRect();
142el.querySelectorAll('.swiper-slide').forEach(slide=>{const b=slide.getBoundingClientRect();const hidden=b.right<=r.left+1||b.left>=r.right-1;slide.inert=hidden;slide.setAttribute('aria-hidden',String(hidden));});}
143    s.on('slideChangeTransitionEnd',sync);s.on('resize',sync);sync();
144    if(!s.autoplay)return;
145    const b=document.createElement('button');b.type='button';b.className='miloslaw-motion-control';b.textContent='Zatrzymaj galerię zdjęć';b.setAttribute('aria-pressed','false');let paused=false;
146    function pause(){s.autoplay.stop();paused=true;b.textContent='Wznów galerię zdjęć';b.setAttribute('aria-pressed','true');}
147    b.addEventListener('click',()=>{if(paused){s.autoplay.start();paused=false;b.textContent='Zatrzymaj galerię zdjęć';b.setAttribute('aria-pressed','false');}else pause();});
148    el.insertAdjacentElement('beforebegin',b);el.addEventListener('focusin',pause);
149    if(matchMedia('(prefers-reduced-motion: reduce)').matches)pause();
150   }setup();
151  });
152 }
153 if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start);else start();
154})();
155
156/* Three original photographs in the refreshed hero. */
157(function(){
158 function initHeroSlides(){
159  const root=document.querySelector('#miloslaw-hero-shell .picture');
160  if(!root||root.querySelector('.hero-slide-track'))return;
161  const first=root.querySelector('img');if(!first)return;
162  const slides=[
163   [first.src,first.alt,'Pałac i park'],
164   ['https://miloslaw.info.pl/wp-content/uploads/2020/11/Miloslaw_baner_01-1.jpg','Pałac i trawnik w świetle nocnej iluminacji.','Pałac nocą'],
165   ['https://miloslaw.info.pl/wp-content/uploads/2020/11/Miloslaw_baner_04.jpg','Stado ptaków nad sylwetkami drzew i wież o zmierzchu.','Miłosław o zmierzchu']
166  ];
167  const viewport=document.createElement('div');viewport.className='hero-slide-viewport';
168  const track=document.createElement('div');track.className='hero-slide-track';viewport.append(track);root.insertBefore(viewport,first);
169  const images=slides.map((s,i)=>{const im=i===0?first:new Image();im.src=s[0];im.alt=s[1];im.width=1200;im.height=800;im.decoding='async';track.append(im);return im;});
170  root.setAttribute('role','region');root.setAttribute('aria-label','Zdjęcia Miłosławia');root.setAttribute('aria-roledescription','karuzela');
171  const controls=document.createElement('div');controls.className='hero-slide-controls';
172  function button(label,text){const b=document.createElement('button');b.type='button';b.setAttribute('aria-label',label);b.textContent=text;controls.append(b);return b;}
173  const prev=button('Poprzednie zdjęcie','←');const status=document.createElement('span');status.className='hero-slide-count';controls.append(status);
174  const next=button('Następne zdjęcie','→');const toggle=button('Zatrzymaj pokaz zdjęć','Pauza');root.append(controls);
175  const caption=root.querySelector('figcaption span');const reduced=matchMedia('(prefers-reduced-motion: reduce)');
176  let index=0,paused=reduced.matches,hover=false,timer;
177  function show(n){index=(n+3)%3;track.style.transform='translateX(-'+index*100+'%)';images.forEach((im,i)=>im.setAttribute('aria-hidden',i===index?'false':'true'));status.textContent=(index+1)+' / 3';if(caption)caption.textContent=slides[index][2];}
178  function schedule(){clearInterval(timer);if(!paused&&!hover&&!document.hidden)timer=setInterval(()=>show(index+1),6000);toggle.textContent=paused?'Wznów':'Pauza';toggle.setAttribute('aria-label',paused?'Wznów pokaz zdjęć':'Zatrzymaj pokaz zdjęć');}
179  function manual(delta){paused=true;show(index+delta);schedule();}
180  prev.addEventListener('click',()=>manual(-1));next.addEventListener('click',()=>manual(1));toggle.addEventListener('click',()=>{paused=!paused;schedule();});
181  root.addEventListener('focusin',e=>{if(e.target!==toggle){paused=true;schedule();}});root.addEventListener('mouseenter',()=>{hover=true;schedule();});root.addEventListener('mouseleave',()=>{hover=false;schedule();});
182  document.addEventListener('visibilitychange',schedule);reduced.addEventListener('change',()=>{if(reduced.matches){paused=true;schedule();}});
183  show(0);
183schedule();
184 }
185 if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',initHeroSlides);else initHeroSlides();
186})();

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.