1/*skryvac Pals - chovat dalsi klony kdyz je jich vice nez 3, stranka Detail*/ 2function zobrazSkryj(idecko){ 3 el=document.getElementById("oddil_"+idecko).style; 4 el.display=(el.display == 'block')?'none':'table-row-group'; 5 el2=document.getElementById("toggle_"+idecko).style; 6 el2.display='none'; 7} 8function HideShow(blok,ch_box){ 9 el_1=document.getElementById(blok).style; 10 el_2=document.getElementById(ch_box); 11 el_1.display=(el_2.checked )?'':'none'; 12 console.log(el_1); 13} 14 15/*Lupa nad velkym obrazkem na strance Detail*/ 16function imageZoom(imgID, resultID) { 17 var img, lens, result, cx, cy; 18 img = document.getElementById(imgID); 19 result = document.getElementById(resultID); 20 lens = document.getElementById('lensID'); 21 if(lens){ 22 lens.parentNode.removeChild(lens); 23 } 24 25 /*create lens:*/ 26 lens = document.createElement("DIV"); 27 lens.setAttribute("class", "img-zoom-lens"); 28 lens.id = "lensID"; 29 /*insert lens:*/ 30 img.parentElement.insertBefore(lens, img); 31 /*calculate the ratio between result DIV and lens:*/ 32 cx = result.offsetWidth / lens.offsetWidth ; 33 cy = result.offsetHeight / lens.offsetHeight; 34 /*set background properties for the result DIV:*/ 35 result.style.backgroundImage = "url('" + img.src + "')"; 36 result.style.backgroundSize = (img.width * cx) + "px " + (img.height * cy) + "px"; 37 /*execute a function when someone moves the cursor over the image, or the lens:*/ 38 lens.addEventListener("mousemove", moveLens); 39 img.addEventListener("mousemove", moveLens); 40 /*and also for touch screens:*/ 41 lens.addEventListener("touchmove", moveLens); 42 img.addEventListener("touchmove", moveLens); 43 lens.addEventListener("click", clickLens); 44 45 function clickLens(e){ 46 if(e.shiftKey) 47 lens.stopState = !lens.stopState; 48 } 49 function moveLens(e) { 50 var pos, x, y; 51 if(lens.stopState) 52 return; 53 /*prevent any other actions that may occur when moving over the image:*/ 54 e.preventDefault(); 55 /*get the cursor's x and y positions:*/ 56 pos = getCursorPos(e); 57 /*calculate the position of the lens:*/ 58 x = pos.x - (lens.offsetWidth / 2); 59 y = pos.y - (lens.offsetHeight / 2); 60 /*prevent the lens from being positioned outside the image:*/ 61 if (x > img.width - lens.offsetWidth) {x = img.width - lens.offsetWidth;} 62 if (x < 0) {x = 0;} 63 if (y > img.height - lens.offsetHeight) {y = img.height - lens.offsetHeight;} 64 if (y < 0) {y = 0;} 65 /*set the position of the lens:*/ 66 lens.style.left = x + "px"; 67 lens.style.top = y + "px"; 68 /*display what the lens "sees":*/ 69 result.style.backgroundPosition = "-" + (x * cx) + "px -" + (y * cy) + "px"; 70 } 71 function getCursorPos(e) { 72 var a, x = 0, y = 0; 73 e = e || window.event; 74 /*get the x and y positions of the image:*/ 75 a = img.getBoundingClientRect(); 76 /*calculate the cursor's x and y coordinates, relative to the image:*/ 77 x = e.pageX - a.left; 78 y = e.pageY - a.top; 79 /*consider any page scrolling:*/ 80 x = x - window.pageXOffset; 81 y = y - window.pageYOffset; 82 return {x : x, y : y}; 83 } 84 85} 86 87/*nepouziva se*/ 88function changeImage(el) 89 { 90 var img = document.getElementById("hoverObr"); 91 img.setAttribute("src",el.getAttribute("data-src")) 92 } 93 94/*pridani svazaneho darku (z produkty_svazane, cena 0 nebo 1 Kc) do kosiku, onsubmit addkos*/ 95function pridejDarekKosik(obj){ 96 //console.log(obj); 97 //var x = document.getElementById('addKos').elements['darek_id'];//hidden input ve formulari pod addKos tlacitkem 98 var x = obj.elements['darek_id'];//hidden input ve formulari pod addKos tlacitkem 99 var dd = document.getElementsByName('sv_darek');//radio kolekce darku k produktu 100 for (i = 0; i < dd.length; i++){ 101 if(dd[i].checked){ 102 x.value = dd[i].value; 103 } 104 } 105} 106 107function pridejDarekKosik2(){ 108 109 var x = document.getElementById('addKos2').elements['darek_id'];//hidden input ve formulari pod addKos tlacitkem 110 var dd = document.getElementsByName('sv_darek');//radio kolekce darku k produktu 111 for (i = 0; i < dd.length; i++){ 112 if(dd[i].checked){ 113 x.value = dd[i].value; 114 } 115 } 116} 117 118/*js pro najizdecka efekty*/ 119function scract_Init() 120{ 121var divs = document.getElementsByTagName("div"); 122for (i = 0;i < divs.length; i++) 123 { 124 if (! divs[i].getAttribute('data-scract_el')) continue; 125 scract_Elms.push(divs[i]); 126 } 127//console.log(scract_Elms); 128} 129function scract_IsInView(el) 130{ 131var rect = el.getBoundingClientRect(); 132if (!rect) return null; 133var nad = rect.bottom < 0; 134var pod = rect.top > window.innerHeight; 135return !nad && !pod; 136} 137function scract_OnScroll() 138{ 139for (i = 0;i < scract_Elms.length; i++) 140 { 141 inView = scract_IsInView(scract_Elms[i]); 142 if (inView===false) scract_Elms[i].setAttribute('scract_InView', 'No'); 143 if (inView===true) scract_Elms[i].setAttribute('scract_InView', 'Yes'); 144 } 145} 146 147 148/*js pro listu s obrazky na str Detail, id = carusel*/ 149function initCarusel() 150{ 151 var car = document.getElementById('carusel'); 152 if(car){ 153 car.style.overflow = 'hidden'; 154 if (car.clientWidth < car.scrollWidth) 155 document.getElementById('vpravo').style.display = ''; 156 } 157} 158 159function posunStart(kam) 160{ 161 clearInterval(timerID); 162 document.getElementById('vlevo').style.display = ''; 163 timerID = setInterval(posun, 20, kam*15); 164} 165 166function posunStop() 167{
168 clearInterval(timerID); 169} 170 171function posun(kam) 172{ 173var car = document.getElementById('carusel'); 174car.scrollLeft += kam; 175//console.log(car.scrollLeft, car.clientWidth, car.scrollWidth) 176} 177 178 179/*Homeslider*/ 180function hsh_sliderPosun(container, layerNr) 181{ 182if (!container.zobrNr) container.zobrNr = 0; 183if (container.ignoruj && layerNr === false) 184 { 185 container.ignoruj = false; 186 return; 187 } 188var radioBox = container.getElementsByTagName('DIV')[0]; 189var liColection = container.getElementsByTagName('LI'); 190var radioColection = radioBox.getElementsByTagName('SPAN'); 191liColection[container.zobrNr].setAttribute('hsh-zobrazeny', "2"); 192radioColection[container.zobrNr].setAttribute('hsh-zobrazeny', "0"); 193var cas = parseInt(window.getComputedStyle(container).transitionTime)*1000+10; 194var tx = setTimeout(function() 195 { 196 if (typeof container.lastNr !== 'number') return; 197 liColection[container.lastNr].setAttribute('hsh-zobrazeny', "0"); 198 }, 1000); 199if (typeof layerNr === 'number') 200 { 201 container.lastNr = container.zobrNr; 202 container.zobrNr = layerNr; 203 container.ignoruj = true; 204 } 205else 206 { 207 container.lastNr = container.zobrNr; 208 container.zobrNr++; 209 if (container.zobrNr >= liColection.length) container.zobrNr=0; 210 } 211liColection[container.zobrNr].setAttribute('hsh-zobrazeny', "1"); 212radioColection[container.zobrNr].setAttribute('hsh-zobrazeny', "1"); 213} 214 215function hsh_sliderManulal(radioBox, e) 216{ 217var spanCollection = radioBox.getElementsByTagName('span'); 218var index = Array.prototype.indexOf.call(spanCollection, e.target); 219hsh_sliderPosun(radioBox.parentNode, index); 220} 221 222function hsh_sliderStart(sliderId) 223{ 224var container = document.getElementById(sliderId); 225var ti = setInterval(function(){hsh_sliderPosun(container, false)}, parseInt(window.getComputedStyle(container).animationDuration)*1000); 226} 227 228/* patri ke Caruselu, vymenuje src pro velky obr, z listy*/ 229function replaceBigObr(obj){ 230 document.getElementById('velky_obr').src = obj.getAttribute('src-big'); 231 var col = obj.parentNode.parentNode.getElementsByTagName('img'); 232 for(var i=0;i<col.length;i++){ 233 col[i].setAttribute('hsh-podtrzeno',0); 234 } 235 obj.setAttribute('hsh-podtrzeno',1); 236} 237 238/*zaskrtavatka na rozsirenem vyhledavani*/ 239function Sklad(i){//svazani checkboxu pro Rozsirene hledani 240 241 if(i==686){;//skladem 242 } 243 244 if(i==687){//dodatelne do 4 dnu 245 if(document.getElementById(687).checked) 246 document.getElementById(686).checked = true; 247 } 248 if(i==688){//dodatelne 249 if(document.getElementById(688).checked){ 250 document.getElementById(686).checked = true; 251 document.getElementById(687).checked = true; 252 } 253 } 254 if(i==689){//vsechny 255 if(document.getElementById(689).checked){ 256 document.getElementById(686).checked = true; 257 document.getElementById(687).checked = true; 258 document.getElementById(688).checked = true; 259 } 260 } 261} 262 263//pri registraci, predvyplnit emailovou adresu do pole pro uzivatelske jmeno 264function fillUsername(){ 265 var mail = document.getElementById('email').value; 266 document.getElementById('username').value = mail; 267} 268 269//zavrit div s vyberem velikosti 270function zavritVV(){ 271 document.getElementById('vyber_velikosti').style.display = 'none'; 272} 273 274/*velikosti*/ 275/*pomocna fce k namalujVV*/ 276function AddElement(parent, tag, attributes, properties) 277{ 278parent.appendChild(document.createTextNode("\n")); 279var el = document.createElement(tag); 280parent.appendChild(el); 281if (attributes) for (var attr in attributes) 282 if (attributes[attr] !== null) el.setAttribute(attr, attributes[attr]); 283if (properties) for (var prop in properties) 284 el[prop] = properties[prop]; 285return el; 286} 287/* prida do DOM div vyber_velikosti, tzv. popUp, ve kterem se vybira velikost, tj. dava do kosiku produkt zvolene varianty*/ 288function namalujVV(obj, produkt_id){ 289 var velikosti = JSON.parse(obj.getAttribute('hsh-velikosti')); 290 //console.log(velikosti); 291 var AktuSet = JSON.parse(obj.getAttribute('hsh-AktuSet')); 292 //console.log(AktuSet); 293 294 var VV = document.getElementById('vyber_velikosti'); 295 if(VV){//pokud jiz je, smazat, vzdy namalovat znovu (hlavne kvuli Prehledu) 296 VV.remove(); 297 } 298 299 //namalovat do main_content 300 var popUp = AddElement(document.getElementById('main_content'),'div',{id:"vyber_velikosti",style:"display:block"}); 301 AddElement(popUp,'H2',{class:"VVNadpis"},{innerHTML:obj.getAttribute('hsh-VVNadpis')}); 302 303 var closer = AddElement(popUp,'div',{id:"VV_close"},{}); 304 AddElement(closer,'img',{src:"_data/ikony/x.svg", onclick:"zavritVV()"},{}); 305 //console.log(velikosti.length); 306 for(var i = 0; i<velikosti.length; i++){ 307 if(velikosti[i]['dostupnost']==1){//nemalovat pod nedostupnymi formular 308 //AddElement(formular,'input',{type:"submit",title:velikosti[i]['sklad'],value:velikosti[i]['val']}); 309 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost'], title:velikosti[i]['sklad']},{innerHTML:velikosti[i]['val'],}); 310 } 311 else{ 312 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost']},{}); 313 var formular = AddElement(box,'form',{action:"run.php",method:"post",id:"addKos"});//nemela by mit id = addKos, neni jedina. 314 AddElement(formular,'input',{type:"hidden",name:"act",value:"addkos"}); 315 AddElement(formular,'input',{type:"hidden",name:"vel",value:velikosti[i]['val']}); 316 AddElement(formular,'input',{type:"hidden",name:"id",value:produkt_id}); 317 AddElement(formular,'input',{type:"submit",title:velikosti[i]['sklad'],value:velikosti[i]['val']}); 318 //console.log(i); 319 if(AktuSet['Hash']) 320 AddElement(formular,'input',{type:"hidden",name:"Hash",value:AktuSet['Hash']}); 321 else{ 322 for (x in AktuSet) { 323 AddElement(formular,'input',{type:"hidden",name:"_"+x,value:AktuSet[x]}); 324 } 325 } 326 } 327 } 328 329 // label 330 AddElement(popUp,'H2',{},{innerHTML:obj.getAttribute('hsh-VVLabel')}); 331 332 var par = AddElement(popUp, 'p'); 333 AddElement(par,'button',{type:"button", onclick:"zavritVV()"},{innerHTML:obj.getAttribute('hsh-VVZpet')});//<p><button type="button" onclick="zavritVV();">'.Lab('Zavrit').'</button 334 335 var legend = AddElement(popUp,'div',{id:"VV_legend"}); 336 var lng = document.getElementsByTagName('HTML')[0].getAttribute('lang'); 337 lng = {en:'en', cs:'cz'}[lng]; 338 if (!lng) lng = 'cz'; 339 AddElement(legend,'img',{src:"_data/ikony/velikostihelptlacitka_"+lng+".svg"}); 340} 341 342//popUp pro pridani Zvyhodneneho, ktery ma velikosti 343function namalujVV_Z(obj, produkt_id, parent_id, dz){ 344 var velikosti = JSON.parse(obj.getAttribute('hsh-velikosti')); 345 var AktuSet = JSON.parse(obj.getAttribute('hsh-AktuSet')); 346 var divId = 'vyber_velikosti_z'; 347 var act = 'addZvyhodneny'; 348 349 var VV = document.getElementById(divId); 350 if(VV){//pokud jiz je, smazat, vzdy namalovat znovu (hlavne kvuli Prehledu) 351 VV.remove(); 352 } 353 354 //namalovat do main_content 355 var popUp = AddElement(document.getElementById('main_content'),'div',{id:divId,style:"display:block"}); 356 //console.log(popUp); 357 AddElement(popUp,'H2',{class:"VVNadpis"},{innerHTML:obj.getAttribute('hsh-VVNadpis')}); 358 359 var closer = AddElement(popUp,'div',{id:"VV_close"},{}); 360 //AddElement(closer,'img',{src:"_data/ikony/x.svg", onclick:"zavritVV()"},{});
360//document.getElementById('vyber_velikosti').style.display = 'none'; 361 AddElement(closer,'img',{src:"_data/ikony/x.svg", onclick:"document.getElementById('"+divId+"').style.display=\'none\'"},{}); 362 console.log(velikosti.length); 363 for(var i = 0; i<velikosti.length; i++){ 364 if(velikosti[i]['dostupnost']==1){//nemalovat pod nedostupnymi formular 365 //AddElement(formular,'input',{type:"submit",title:velikosti[i]['sklad'],value:velikosti[i]['val']}); 366 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost'], title:velikosti[i]['sklad']},{innerHTML:velikosti[i]['val'],}); 367 } 368 else{ 369 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost']},{}); 370 var formular = AddElement(box,'form',{action:"run.php",method:"post"});//nemela by mit id = addKos, neni jedina. 371 AddElement(formular,'input',{type:"hidden",name:"act",value:act}); 372 AddElement(formular,'input',{type:"hidden",name:"vel",value:velikosti[i]['val']}); 373 AddElement(formular,'input',{type:"hidden",name:"id",value:produkt_id}); 374 AddElement(formular,'input',{type:"hidden",name:"parent_id",value:parent_id}); 375 AddElement(formular,'input',{type:"submit",title:velikosti[i]['sklad'],value:velikosti[i]['val']}); 376 //console.log(i); 377 if(AktuSet['Hash']) 378 AddElement(formular,'input',{type:"hidden",name:"Hash",value:AktuSet['Hash']}); 379 else{ 380 for (x in AktuSet) { 381 AddElement(formular,'input',{type:"hidden",name:"_"+x,value:AktuSet[x]}); 382 } 383 } 384 } 385 } 386 387 AddElement(popUp,'H2',{},{innerHTML:obj.getAttribute('hsh-VVLabel')}); 388 var par = AddElement(popUp, 'p'); 389 AddElement(par,'button',{type:"button", onclick:"document.getElementById('"+divId+"').style.display=\'none\'"},{innerHTML:obj.getAttribute('hsh-VVZpet')});//<p><button type="button" onclick="zavritVV();">'.Lab('Zavrit').'</button 390 var legend = AddElement(popUp,'div',{id:"VV_legend"}); 391 var lng = document.getElementsByTagName('HTML')[0].getAttribute('lang'); 392 lng = {en:'en', cs:'cz'}[lng]; 393 if (!lng) lng = 'cz'; 394 AddElement(legend,'img',{src:"_data/ikony/velikostihelptlacitka_"+lng+".svg"}); 395} 396//popUp pro pridani Zvyhodneneho, ktery ma velikosti 397function namalujVV_D(obj, produkt_id, parent_id){ 398 var velikosti = JSON.parse(obj.getAttribute('hsh-velikosti')); 399 var AktuSet = JSON.parse(obj.getAttribute('hsh-AktuSet')); 400 var divId = 'vyber_velikosti_d'; 401 var act = 'addDarek'; 402 403 var VV = document.getElementById(divId); 404 if(VV){//pokud jiz je, smazat, vzdy namalovat znovu (hlavne kvuli Prehledu) 405 VV.remove(); 406 } 407//console.log(velikosti.length); 408 //namalovat do main_content 409 var popUp = AddElement(document.getElementById('main_content'),'div',{id:divId,style:"display:block"}); 410 AddElement(popUp,'H2',{class:"VVNadpis"},{innerHTML:obj.getAttribute('hsh-VVNadpis')}); 411 412 var closer = AddElement(popUp,'div',{id:"VV_close"},{}); 413 AddElement(closer,'img',{src:"_data/ikony/x.svg", onclick:"document.getElementById('"+divId+"').style.display=\'none\'"},{}); 414 for(var i = 0; i<velikosti.length; i++){ 415 if(velikosti[i]['dostupnost']==1){//nemalovat pod nedostupnymi formular 416 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost'], title:velikosti[i]['sklad']},{innerHTML:velikosti[i]['val'],}); 417 } 418 else{ 419 var box = AddElement(popUp,'div',{class:"box_var dostupnost_"+ velikosti[i]['dostupnost']},{}); 420 var formular = AddElement(box,'form',{action:"run.php",method:"post"});//nemela by mit id = addKos, neni jedina. 421 AddElement(formular,'input',{type:"hidden",name:"act",value:act}); 422 AddElement(formular,'input',{type:"hidden",name:"vel",value:velikosti[i]['val']}); 423 AddElement(formular,'input',{type:"hidden",name:"darek_id",value:produkt_id}); 424 AddElement(formular,'input',{type:"hidden",name:"produkt_parent",value:parent_id}); 425 AddElement(formular,'input',{type:"submit",title:velikosti[i]['sklad'],value:velikosti[i]['val']}); 426 if(AktuSet['Hash']) 427 AddElement(formular,'input',{type:"hidden",name:"Hash",value:AktuSet['Hash']}); 428 else{ 429 for (x in AktuSet) { 430 AddElement(formular,'input',{type:"hidden",name:"_"+x,value:AktuSet[x]}); 431 } 432 } 433 } 434 } 435 AddElement(popUp,'H2',{},{innerHTML:obj.getAttribute('hsh-VVLabel')}); 436 var par = AddElement(popUp, 'p'); 437 AddElement(par,'button',{type:"button", onclick:"document.getElementById('"+divId+"').style.display=\'none\'"},{innerHTML:obj.getAttribute('hsh-VVZpet')});//<p><button type="button" onclick="zavritVV();">'.Lab('Zavrit').'</button 438 var legend = AddElement(popUp,'div',{id:"VV_legend"}); 439 var lng = document.getElementsByTagName('HTML')[0].getAttribute('lang'); 440 lng = {en:'en', cs:'cz'}[lng]; 441 if (!lng) lng = 'cz'; 442 AddElement(legend,'img',{src:"_data/ikony/velikostihelptlacitka_"+lng+".svg"}); 443} 444 445function copyHref(){ 446 var copyEl = document.getElementById("canHref"); 447 copyEl.select(); 448 copyEl.setSelectionRange(0, 99999) 449 document.execCommand("copy"); 450} 451 452//volba dopravy v objednavce 453function zmenaStatu(obj) 454{ 455var stat = obj.value; 456//document.getElementById('vsechna_doprava').setAttribute("selStat",stat); 457for(var i=1; i<100; i++) 458 { 459 var el = document.getElementById('stat_'+i); 460 //console.log(el); 461 if(!el) continue; 462 el.setAttribute("selected",(i==stat)?"yes":"no"); 463 } 464document.getElementById('d0').checked = true; 465document.getElementById('zp0').checked = true; 466if(document.getElementById('vlajky')) 467 { 468 /* 469 if(obj.value==1)
470 document.getElementById('vlajky').style.left = "0px"; 471 if(obj.value==2) 472 document.getElementById('vlajky').style.left = "-106px"; 473 if(obj.value==3) 474 document.getElementById('vlajky').style.left = "-212px"; 475 if(obj.value==4) 476 document.getElementById('vlajky').style.left = "-318px"; 477 */ 478 document.getElementById('vlajky').style.left = ((obj.value - 1) * -77)+'px'; 479 } 480} 481 482function zmenaDopravce(obj) 483{ 484document.getElementById('box_info').innerText = ''; 485document.getElementById('balikovna').style.display = 'none'; 486document.getElementById('box_link').style.display = 'none'; 487document.getElementById('box_code').value = ''; 488var stat = document.forms.doprava.elements.dopravce.value; 489//document.getElementById('vsechna_doprava').setAttribute("selDop",stat); 490for(var i=1; i<1000; i++) 491 { 492 var el = document.getElementById('dopravce_'+i); 493 //console.log(el); 494 if(!el) continue; 495 el.setAttribute("selected",(i==stat)?"yes":"no"); 496 } 497document.getElementById('zp0').checked = true; 498//console.log(stat); 499} 500 501//Navrat z balikovny atd... 502function iframeListenerOld(event) 503{ 504if (event.data.message === 'pickerResult') //Balikovna 505 { 506 var frEl = document.getElementById('bal_fr'); 507 frEl.parentElement.removeChild(frEl); 508 document.getElementById('box_code').value = event.data.id; 509 document.getElementById('zip').value = event.data.point.zip; 510 document.getElementById('name').value = event.data.point.name; 511 document.getElementById('address').value = event.data.point.address; 512 document.getElementById('description').value = event.data.point.description; 513 document.getElementById('opening_hours').value = JSON.stringify(event.data.point.opening_hours); 514 document.getElementById('box_info').innerText = event.data.point.name+'; '+event.data.point.address; 515 document.getElementById('balikovna').style.display = 'block'; 516 document.getElementById('box_link').style.display = 'inline'; 517 //console.log('BAL', event.data.point); 518 } 519if (event.data.parcelshop) //GLS 520 { 521 var ps = event.data.parcelshop; 522 var frEl = document.getElementById('bal_fr'); 523 frEl.parentElement.removeChild(frEl); 524 document.getElementById('box_code').value = 'GLS|' + ps.detail.pclshopid; 525 document.getElementById('zip').value = ps.detail.zipcode; 526 document.getElementById('name').value = ps.detail.name; 527 document.getElementById('address').value = ps.detail.address + ', ' + ps.detail.city; 528 document.getElementById('description').value = ''; 529 document.getElementById('opening_hours').value = JSON.stringify(ps.opentime); 530 document.getElementById('box_info').innerText = ps.detail.name+'; '+ps.detail.address; 531 document.getElementById('balikovna').style.display = 'block'; 532 document.getElementById('box_link').style.display = 'inline'; 533 console.log(ps); 534 } 535} 536 537function OpenIframeBalOld(iframeName) 538{ 539document.getElementById('box_info').innerText = ''; 540document.getElementById('balikovna').style.display = 'none'; 541document.getElementById('box_link').style.display = 'inline'; 542document.getElementById('box_code').value = ''; 543if (iframeName === 'BALIKOVNA') 544 { 545 var fr = document.createElement('IFRAME'); 546 fr.style.cssText = 'position:fixed; width:100vw; height:95vh; left:0vw; top:5vh; z-index:10; background-color:white; border:none'; 547 fr.src = "https://b2c.cpost.cz/locations/?type=BALIKOVNY"; 548 fr.setAttribute('allow', 'geolocation'); 549 fr.id = 'bal_fr'; 550 document.body.appendChild(fr); 551 } 552if (iframeName === 'GLSPSD') 553 { 554 var fr = document.createElement('IFRAME'); 555 fr.style.cssText = 'position:fixed; width:100vw; height:95vh; left:0vw; top:5vh; z-index:10; background-color:white; border:none'; 556 fr.src = "https://ps-maps.gls-czech.com/?find=1"; 557 fr.setAttribute('allow', 'geolocation'); 558 fr.id = 'bal_fr'; 559 document.body.appendChild(fr); 560 } 561} 562 563function iframeListener(event) 564{ 565const closeOverlay = () => { 566 //document.getElementById('bal_overlay')?.remove(); 567 document.getElementById('bal_hdr')?.remove(); 568 document.getElementById('bal_fr')?.remove(); 569 document.body.style.overflow = ''; 570 };
571 // --- BalÃkovna --- 572if (event.data?.message === 'pickerResult') 573 { 574 closeOverlay(); 575 const p = event.data.point || {}; 576 document.getElementById('box_code').value = event.data.id || ''; 577 document.getElementById('zip').value = p.zip || ''; 578 document.getElementById('name').value = p.name || ''; 579 document.getElementById('address').value = p.address || ''; 580 document.getElementById('description').value = p.description || ''; 581 document.getElementById('opening_hours').value = JSON.stringify(p.opening_hours || {}); 582 document.getElementById('box_info').innerText = `${p.name}; ${p.address}`; 583 document.getElementById('balikovna').style.display = 'block'; 584 document.getElementById('box_link').style.display = 'inline'; 585 } 586// --- GLS --- 587if (event.data?.parcelshop) 588 { 589 closeOverlay(); 590 const ps = event.data.parcelshop; 591 const d = ps.detail || {}; 592 document.getElementById('box_code').value = 'GLS|' + (d.pclshopid || ''); 593 document.getElementById('zip').value = d.zipcode || ''; 594 document.getElementById('name').value = d.name || ''; 595 document.getElementById('address').value = `${d.address || ''}, ${d.city || ''}`.replace(/^, |, $/, ''); 596 document.getElementById('description').value = ''; 597 document.getElementById('opening_hours').value = JSON.stringify(ps.opentime || {}); 598 document.getElementById('box_info').innerText = `${d.name}; ${d.address}`; 599 document.getElementById('balikovna').style.display = 'block'; 600 document.getElementById('box_link').style.display = 'inline'; 601 } 602} 603 604function OpenIframeBal(type) 605{ 606// uklid formuláÅe 607document.getElementById('box_info').innerText = ''; 608document.getElementById('balikovna').style.display = 'none'; 609document.getElementById('box_link').style.display = 'none'; 610document.getElementById('box_code').value = ''; 611// smaž starý kdyby tam zůstaly 612document.getElementById('bal_fr')?.remove(); 613document.getElementById('bal_hdr')?.remove(); 614const urls = { 615 BALIKOVNA: 'https://b2c.cpost.cz/locations/?type=BALIKOVNY', 616 GLSPSD: 'https://ps-maps.gls-czech.com/?find=1' 617}; 618if (!urls[type]) return; 619// 2. hornà liÅ¡ta 5vh 620const header = document.createElement('div'); 621header.id = 'bal_hdr'; 622header.style.cssText = 'position:fixed; height:4vh; width:100%; top:0; left:0; z-index:9999; background:#EEE; text-align:center; font-size:2.5vh; cursor:pointer'; 623header.innerHTML = 'x ZavÅÃt'; 624// 3. iframe pod nà 625const fr = document.createElement('iframe'); 626fr.id = 'bal_fr'; 627fr.src = urls[type]; 628fr.allow = 'geolocation'; 629fr.style.cssText = 'position:fixed; top:4vh; width:100%; height:96vh; left:0px; z-index:9999'; 630// složenà 631document.body.appendChild(header); 632document.body.appendChild(fr); 633document.body.style.overflow = 'hidden'; // zamkni scroll pod tÃm 634// zavÅenà 635const close = () => { 636 header.remove(); 637 fr.remove(); 638 document.body.style.overflow = ''; 639 zmenaDopravce(null); 640}; 641document.getElementById('bal_hdr').onclick = close; 642} 643 644function OpenIframeByBoxCode() 645{ 646var code = document.getElementById('box_code').value; 647if (code.substr(0,4)==='GLS|') return OpenIframeBal('GLSPSD'); 648OpenIframeBal('BALIKOVNA'); 649} 650 651function VlozDoInput(e, elId) 652{ 653var inp = document.getElementById(elId); 654var trg = e.target; 655if (trg.tagName != 'SPAN') return; 656inp.value = trg.innerHTML; 657} 658
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.