PageSourceSearch

http://www.otuzilci-praha.cz/cz/wp-content/themes/ipko-praha/assets/documents.js?ver=1.0.2

js otuzilci-praha.cz collected 2026-10-07 04:05:34 UTC 7,757 bytes, 86 lines download raw bytes

1(function(){
2 'use strict';
3 var script=document.currentScript,base=script.src.slice(0,script.src.lastIndexOf('/')+1),libraryPromise=null,dialogReader=null;
4 var inline=window.ipkoDocuments&&window.ipkoDocuments.inline;
5 function pdfURL(link){
6  var url=new URL(link.href,location.href);
7  if(url.origin!==location.origin && url.hostname!=='www.otuzilci-praha.cz' && url.hostname!=='otuzilci-praha.cz')return null;
8  if(url.pathname==='/cz/wp-content/files/Prohlidka_formular.doc')return location.origin+'/cz/wp-content/files/Prohlidka_formular-preview-20261006.pdf';
9  return /\.pdf$/i.test(url.pathname)?location.origin+url.pathname+url.search:null;
10 }
11 function getLibrary(){
12  if(!libraryPromise)libraryPromise=import(base+'vendor/pdfjs/pdf.mjs').then(function(lib){
13   lib.GlobalWorkerOptions.workerSrc=base+'vendor/pdfjs/pdf.worker.mjs';return lib;
14  }).catch(function(error){libraryPromise=null;throw error;});
15  return libraryPromise;
16 }
17 // Each embedded document owns its page, zoom, render task and loading lifetime.
18 function Reader(embedded){
19  var root=document.createElement(embedded?'section':'dialog'),pdf=null,loading=null,renderTask=null,serial=0,loadSerial=0,page=1,zoom=1,opener=null,resizeTimer;
20  root.className='document-reader'+(embedded?' document-reader-inline':'');
21  root.innerHTML=(embedded?'':'<header><h2></h2><button type="button" data-close aria-label="Zavřít dokument">×</button></header>')+'<div class="document-tools"><button type="button" data-prev aria-label="Předchozí stránka" disabled>‹</button><label>Strana <input data-page type="number" min="1" value="1" aria-label="Číslo stránky" disabled></label><span data-total></span><button type="button" data-next aria-label="Další stránka" disabled>›</button><button type="button" data-minus aria-label="Zmenšit" disabled>−</button><button type="button" data-plus aria-label="Zvětšit" disabled>+</button><button type="button" data-fit disabled>Na šířku</button><a data-download download>Stáhnout PDF</a></div><p class="document-status" role="status">Načítám dokument…</p><div class="document-viewport" tabindex="0" aria-label="Obsah dokumentu"><canvas aria-label="Stránka dokumentu"></canvas><p class="screen-reader-text" data-text></p></div>';
22  var area=root.querySelector('.document-viewport'),canvas=area.querySelector('canvas'),status=root.querySelector('.document-status');
23  canvas.width=0;canvas.height=0;
24  function shown(){return embedded||root.open;}
25  function reset(){
26   loadSerial++;serial++;if(renderTask)renderTask.cancel();
27   if(loading){loading.destroy().catch(function(){});loading=null;}pdf=null;
28   root.querySelectorAll('.document-tools button,.document-tools input').forEach(function(control){control.disabled=true;});
29  }
30  if(!embedded){
31   root.querySelector('[data-close]').addEventListener('click',function(){root.close();});
32   root.addEventListener('close',function(){reset();document.body.classList.remove('document-reader-open');if(opener)opener.focus();});
33   root.addEventListener('click',function(e){if(e.target===root)root.close();});
34  }
35  root.querySelector('[data-prev]').addEventListener('click',function(){if(pdf&&page>1){page--;draw();}});
36  root.querySelector('[data-next]').addEventListener('click',function(){if(pdf&&page<pdf.numPages){page++;draw();}});
37  root.querySelector('[data-page]').addEventListener('change',function(e){if(pdf){page=Math.max(1,Math.min(pdf.numPages,parseInt(e.target.value,10)||1));draw();}});
38  root.querySelector('[data-minus]').addEventListener('click',function(){zoom=Math.max(.5,zoom-.25);draw();});
39  root.querySelector('[data-plus]').addEventListener('click',function(){zoom=Math.min(3,zoom+.25);draw();});
40  root.querySelector('[data-fit]').addEventListener('click',function(){zoom=1;draw();});
41  window.addEventListener('resize',function(){clearTimeout(resizeTimer);resizeTimer=setTimeout(function(){if(shown()&&pdf)draw();},150);});
42  async function draw(){
43   if(!pdf||!shown())return;
44   var ticket=++serial,documentNow=pdf,previousRender=renderTask;
45   if(previousRender){previousRender.cancel();try{await previousRender.promise;}catch(e){}if(ticket!==serial)return;renderTask=null;}
46   try{
47    var p=await documentNow.getPage(page);if(ticket!==serial)return;
48    var natural=p.getViewport({scale:1}),scale=Math.max(1,area.clientWidth-24)/natural.width*zoom,view=p.getViewport({scale:scale}
48),dpr=Math.min(window.devicePixelRatio||1,2);
49    canvas.width=Math.floor(view.width*dpr);canvas.height=Math.floor(view.height*dpr);canvas.style.width=view.width+'px';canvas.style.height=view.height+'px';
50    root.querySelector('[data-page]').value=page;root.querySelector('[data-page]').max=documentNow.numPages;root.querySelector('[data-total]').textContent='/ '+documentNow.numPages;
51    root.querySelector('[data-prev]').disabled=page===1;root.querySelector('[data-next]').disabled=page===documentNow.numPages;
52    root.querySelector('[data-minus]').disabled=zoom<=.5;root.querySelector('[data-plus]').disabled=zoom>=3;
53    status.textContent='Načítám stránku…';
54    renderTask=p.render({canvasContext:canvas.getContext('2d'),viewport:view,transform:dpr===1?null:[dpr,0,0,dpr,0,0]});await renderTask.promise;
55    if(ticket!==serial)return;renderTask=null;area.scrollTop=0;status.textContent='';
56    var text=await p.getTextContent();if(ticket===serial)root.querySelector('[data-text]').textContent=text.items.map(function(x){return x.str;}).join(' ');
57   }catch(e){if(e.name!=='RenderingCancelledException'&&ticket===serial)status.textContent='Stránku se nepodařilo zobrazit. Použij odkaz Stáhnout PDF.';}
58  }
59  async function load(url,title,button){
60   reset();opener=button;page=1;zoom=1;var ticket=loadSerial;
61   root.setAttribute('aria-label',title.replace(/\s*↗\s*$/,''));
62   if(!embedded)root.querySelector('h2').textContent=root.getAttribute('aria-label');
63   root.querySelector('[data-download]').href=url;root.querySelector('[data-total]').textContent='';root.querySelector('[data-text]').textContent='';canvas.width=0;canvas.height=0;canvas.style.width='0px';canvas.style.height='0px';status.textContent='Načítám dokument…';
64   if(!embedded){root.showModal();document.body.classList.add('document-reader-open');root.querySelector('[data-close]').focus();}
65   try{
66    var lib=await getLibrary();if(ticket!==loadSerial)return;
67    loading=lib.getDocument({url:url,cMapUrl:base+'vendor/pdfjs/cmaps/',cMapPacked:true,standardFontDataUrl:base+'vendor/pdfjs/standard_fonts/',wasmUrl:base+'vendor/pdfjs/wasm/',isEvalSupported:false});
68    var documentLoaded=await loading.promise;if(ticket!==loadSerial)return;pdf=documentLoaded;
69    root.querySelectorAll('.document-tools button,.document-tools input').forEach(function(control){control.disabled=false;});await draw();
70   }catch(e){if(ticket===loadSerial)status.textContent='Dokument se nepodařilo načíst. Použij odkaz Stáhnout PDF.';}
71  }
72  return {root:root,load:load};
73 }
74 var seen={};
75 document.querySelectorAll('.entry-content a[href]').forEach(function(link){
76  var url=pdfURL(link);if(!url)return;
77  if(inline){
78   if(seen[url])return;seen[url]=true;
79   var reader=new Reader(true),anchor=link.closest('p,li,div.wp-block-file')||link;
80   anchor.insertAdjacentElement('afterend',reader.root);reader.load(url,link.textContent,null);
81  }else if(typeof HTMLDialogElement!=='undefined'){
82   var button=document.createElement('button');button.type='button';button.className='document-open';button.textContent='Číst online';
83   button.addEventListener('click',function(){if(!dialogReader){dialogReader=new Reader(false);document.body.appendChild(dialogReader.root);}dialogReader.load(url,link.textContent,button);});link.insertAdjacentElement('afterend',button);
84  }
85 });
86})();

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.