1var scriptNazev = document.currentScript ? document.currentScript.src.substr(document.currentScript.src.lastIndexOf('/') + 1) : 'script-1-0.js'; 2window.onerror = function (errMsg, errSource, errLineno, errColno, errObj) { 3 LogErrorInCookies2(scriptNazev, errMsg, errObj, errSource, errLineno, errColno); 4 return true; 5} 6 7//#region SEARCH 8function formujData() { 9 let formData = event.formData; 10 11 for (let [name, value] of Array.from(formData.entries())) { 12 if (value === '') formData.delete(name); 13 } 14} 15 16function odeslatFormular() { 17 const formData = new FormData(event.srcElement); 18 19 var countKey = 0; 20 for (const key of formData.keys()) { 21 countKey++; 22 } 23 24 if (countKey == 0) { 25 event.preventDefault(); 26 var cesta = window.location.href.split('?')[0]; 27 if (event.srcElement.getAttribute('action')) cesta = event.srcElement.getAttribute('action'); 28 window.location.href = cesta; 29 return; 30 } 31} 32 33function zmenitAdresu(elm) { 34 try { 35 if (!elm.getAttribute('data-cesta') || elm.getAttribute('data-cesta') == '') return; 36 37 window.location = XorujFromNovy(elm.getAttribute('data-cesta'), 27); 38 if (elm.href) return false; 39 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 40} 41 42function orderBy_Submit() { 43 var queryOrderBy = ''; 44 try { 45 var tlac_poradi = document.getElementById('tlac_poradi'); 46 if (tlac_poradi && tlac_poradi.getAttribute('data-order') && tlac_poradi.getAttribute('data-order') != '0') queryOrderBy = 'order=' + document.getElementById('tlac_poradi').getAttribute('data-order'); 47 } catch (ex) { writeErrLog2(scriptNazev + '.orderBy_Submit()', ex); } 48 49 return queryOrderBy; // ESCAPE 50} 51 52function scrollBody(elm) { 53 try { 54 if (elm.checked) { 55 document.body.style.overflow = 'hidden'; 56 } 57 else { 58 document.body.style.overflow = 'initial'; 59 } 60 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 61} 62 63var lastCallCityCap = ''; 64function cityZipNasept() { 65 try { 66 const search_mespsc = document.getElementById('search_mespsc'); 67 if (search_mespsc.getAttribute('data-psc')) search_mespsc.removeAttribute('data-psc'); 68 if (search_mespsc.value.length == 0) { 69 document.getElementById('cityzip_naspt_obal').innerHTML = ''; 70 document.getElementById('search_mespsc_reset').style.display = 'none'; 71 return; // ESCAPE; 72 } 73 74 document.getElementById('search_mespsc_reset').style.display = 'initial'; 75 76 if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) return; // ESCAPE 77 var _pattern = /^[\w -]+$/gi; 78 if (!_pattern.test(search_mespsc.value)) return; // ESCAPE 79 if (!search_mespsc.getAttribute('data-cesta')) return; // ESCAPE 80 81 cityCap_Call(); 82 83 return; // ESCPAE 84 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 85} 86 87var xhr_cityCap = null; 88function cityCap_Call(cityCap) { 89 try { 90 const search_mespsc = document.getElementById('search_mespsc'); 91 const cityCap = search_mespsc.value; 92 if (cityCap == lastCallCityCap) return; // ESCAPE 93 94 if (!xhr_cityCap) xhr_cityCap = new XMLHttpRequest(); 95 96 var postData = ''; 97 var _pattern = /^[\d ]+$/gi; 98 if (_pattern.test(cityCap)) { 99 postData = 'zip=' + encodeURIComponent(cityCap); 100 } 101 else { 102 postData = 'city=' + encodeURIComponent(cityCap); 103 } 104 105 if (document.getElementById('select_vzdalenost_list').querySelector('input:checked[name=vzdalenost]')) { 106 postData += '&dist=' + encodeURIComponent(document.getElementById('select_vzdalenost_list').querySelector('input:checked[name=vzdalenost]').value); 107 } 108 else if (document.getElementById('select_vzdal').getAttribute('data-vzdalenost')) { 109 postData += '&dist=' + encodeURIComponent(document.getElementById('select_vzdal').getAttribute('data-vzdalenost'));
110 } 111 112 postData += '&cesta=' + encodeURIComponent(search_mespsc.getAttribute('data-cesta')); 113 114 xhr_cityCap.onreadystatechange = function () { 115 if (this.readyState == 4) { 116 if (!this.responseText || this.responseText == '') return; 117 118 document.getElementById('cityzip_naspt_obal').innerHTML = this.responseText; 119 } 120 }; 121 122 xhr_cityCap.open("POST", '/ajax/cityzip2.aspx'); 123 xhr_cityCap.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 124 xhr_cityCap.send(postData); 125 126 lastCallCityCap = cityCap; 127 } 128 catch (ex) { writeErrLog2(scriptNazev + '.cityCap_Call()', ex); } 129} 130 131function mujSelect_Skroluj() { 132 if (!event.srcElement.checked) return; 133 const ul = event.srcElement.parentElement.querySelector('ul.list-absolut'); 134 if (!ul) return; 135 136 setTimeout(function (elm) { 137 const rect = elm.getBoundingClientRect() 138 if (rect.bottom < window.innerHeight) return; 139 elm.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" }); 140 }, 80, ul); 141} 142 143function mujSelect_Blur() { 144 // if the blur was because of outside focus 145 // currentTarget is the parent element, relatedTarget is the clicked element 146 if (!event.currentTarget.contains(event.relatedTarget)) { 147 event.currentTarget.querySelector('input.muj-select-check').checked = false; 148 } 149} 150 151function mujSelect_Zmena() { 152 if (!event.srcElement.getAttribute('name')) { 153 event.srcElement.parentElement.parentElement.parentElement.parentElement.querySelector('.muj-select').querySelector('span').innerHTML = event.srcElement.value 154 const radio_checked = event.srcElement.parentElement.parentElement.querySelector('input:checked[type=radio]'); 155 if (radio_checked) radio_checked.checked = false; 156 } 157 else { 158 event.srcElement.parentElement.parentElement.parentElement.parentElement.querySelector('.muj-select').querySelector('span').innerHTML = event.srcElement.parentElement.querySelector('.muj-select-item').querySelector('span').innerHTML; 159 } 160 161 const muj_select_check = event.srcElement.parentElement.parentElement.parentElement.parentElement.querySelector('input.muj-select-check'); 162 if (muj_select_check && muj_select_check.checked) muj_select_check.checked = false; 163} 164 165function mujSelect_ZmenaOrderBy() { 166 if (!event.srcElement.getAttribute('data-cesta') || event.srcElement.getAttribute('data-cesta') == '') return; 167 168 const url = new URL(XorujFromNovy(event.srcElement.getAttribute('data-cesta'), 27)); 169 const searchParams = new URLSearchParams(url.search); 170 if (event.srcElement.value == '0') { 171 searchParams.delete('order'); 172 } 173 else { 174 searchParams.set('order', event.srcElement.value); 175 } 176 177 url.search = searchParams.toString(); 178 if (window.location.href == url.href) { 179 const muj_select_check = event.srcElement.parentElement.parentElement.parentElement.parentElement.querySelector('input.muj-select-check'); 180 if (muj_select_check && muj_select_check.checked) muj_select_check.checked = false; 181 return; 182 } 183 184 window.location.href = url.href; 185} 186 187function vzdalenost_Zmena() { 188 if (document.getElementById('search_mespsc').getAttribute('data-psc')) { 189 window.location.href = window.location.href.replace(/(&distanza=)\d+/, '$1' + event.srcElement.value); 190 return; 191 } 192 193 if (!document.getElementById('cityzip_hist')) return; 194 const elms = document.getElementById('cityzip_hist').querySelectorAll('a'); 195 for (let x = 0; x < elms.length; x++) { 196 elms[x].href = elms[x].href.replace(/(&distanza=)\d+/, '$1' + event.srcElement.value); 197 } 198 199 if (!document.getElementById('cityzip_naspt')) return; 200 const elms2 = document.getElementById('cityzip_naspt').querySelectorAll('a'); 201 for (let x = 0; x < elms2.length; x++) { 202 elms2[x].href = elms2[x].href.replace(/(&distanza=)\d+/, '$1' + event.srcElement.value); 203 } 204} 205 206function textSelect_Vymaz() { 207 event.currentTarget.parentElement.querySelector('input.text-select').value = ''; 208 document.getElementById('search_mespsc_reset').style.display = 'none'; 209 const search_mespsc = document.getElementById('search_mespsc'); 210 if (search_mespsc.getAttribute('data-psc')) search_mespsc.removeAttribute('data-psc'); 211} 212//#endregion 213 214//#region SRCHPRD_2-4 215var selectIndex_aSrchPrdKw = -1; 216var select_aSrchPrdKw = ''; 217var lastKwSearchNoResult = ''; 218var timeoutSrchPrdHide = null; 219 220function tbSearchKw_Focus() { 221 try { 222 if (document.getElementById('reset-srch') && document.getElementById('tbSearch').value.length > 0) { 223 document.getElementById('reset-srch').style.display = 'initial'; 224 } 225 else if (document.getElementById('reset-srch')) { 226 document.getElementById('reset-srch').style.display = 'none'; 227 } 228 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 229} 230 231function tbSearchKw_Reset() { 232 try { 233 isMouseOverSrchPrd = false; 234 tbSearchKw_Blure(); 235 document.getElementById('tbSearch').value = ''; 236 document.getElementById('tbSearch').focus(); 237 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 238} 239 240function tbSearchKw_Blure() { 241 try { 242 if (isMouseOverSrchPrd) return; // ESCAPE 243 244 if (document.getElementById('reset-srch')) window.setTimeout(function () { document.getElementById('reset-srch').style.display = 'none'; }, 180); 245 timeoutSrchPrdHide = window.setTimeout(function () { srchPrd_Hide(); }, 80); 246 if (window.removeEventListener) window.removeEventListener('click', tbSearchKw_Blur_Listen); else document.detachEvent('onclick', tbSearchKw_Blur_Listen); 247 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 248} 249 250function tbSearchKw_KeyUp() { 251 try { 252 if (event.currentTarget.value.length == 0) { 253 document.getElementById('reset-srch').style.display = 'none'; 254 } 255 else { 256 document.getElementById('reset-srch').style.display = 'initial'; 257 } 258 259 if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) return; // ESCAPE 260 prepareSrchPrdCall(event.currentTarget.value, event.currentTarget.getAttribute('data-ids')); 261 262 return; // ESCPAE 263 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 264} 265 266function prepareSrchPrdCall(actualKw, ids) { 267 try { 268 if (typeof isProfileSearch !== 'undefined') return; // ESCAPE 269 if (actualKw.length < 2) { 270 srchPrd_Hide(); 271 document.getElementById('formSearch').setAttribute('data-lastkwsrch', ''); 272 return; // ESCAPE 273 } 274 else if (document.getElementById('formSearch').getAttribute('data-lastkwsrch') && 275 document.getElementById('formSearch').getAttribute('data-lastkwsrch') != null && 276 document.getElementById('formSearch').getAttribute('data-lastkwsrch').toLowerCase() == actualKw.toLowerCase()) { 277 return; // ESCAPE 278 } 279 else if (lastKwSearchNoResult.length > 0 && actualKw.indexOf(lastKwSearchNoResult) == 0 && lastKwSearchNoResult.length <= actualKw.length) { 280 srchPrd_Hide(); 281 return; // ESCAPE 282 } 283 284 srchPrd_Call(actualKw, ids); 285 document.getElementById('formSearch').setAttribute('data-lastkwsrch', actualKw); 286 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 287} 288 289var xhr_srchPrd = null; 290function srchPrd_Call(kw, ids) { 291 if (!xhr_srchPrd) xhr_srchPrd = new XMLHttpRequest(); 292 293 xhr_srchPrd.onreadystatechange = function () { 294 if (this.readyState == 4) { 295 document.getElementById('naseptkontej').innerHTML = this.responseText; 296 297 if (document.getElementById('naseptkontej').style.display != 'block') { 298 document.getElementById('naseptkontej').style.display = 'block'; 299 if ('ontouchstart' in window || navigator.msMaxTouchPoints) document.getElementById('naseptkontej').addEventListener("touchstart", dSrchPrd_touchStart, { passive: true });
300 } 301 302 if (window.addEventListener) window.addEventListener('click', tbSearchKw_Blur_Listen, false); else document.attachEvent('onclick', tbSearchKw_Blur_Listen); 303 } 304 }; 305 xhr_srchPrd.open("POST", '/ajax/srchprd3.aspx'); 306 xhr_srchPrd.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 307 xhr_srchPrd.send('fullresp=1&kw=' + encodeURIComponent(kw) + '&ids=' + encodeURIComponent(ids)); 308} 309 310 311var tbSearchKw_Blur_Listen = function () { tbSearchKw_Blure(); }; 312var isMouseOverSrchPrd = false; 313function dSrchPrd_touchStart() { 314 document.getElementById('tbSearch').blur(); 315} 316 317function srchPrd_Hide() { 318 try { 319 selectIndex_aSrchPrdKw = -1; 320 select_aSrchPrdKw = ''; 321 document.getElementById('naseptkontej').innerHTML = ''; 322 document.getElementById('naseptkontej').style.display = 'none'; 323 if ('ontouchstart' in window || navigator.msMaxTouchPoints) document.getElementById('naseptkontej').removeEventListener("touchstart", dSrchPrd_touchStart); 324 } catch (ex) { writeErrLog2(scriptNazev + '.srchPrd_Hide()', ex); } 325} 326//#endregion 327 328//#region NAHLASENI MODALNI RAMEC 329async function stahniNahlaseni() { 330 try { 331 const response = await fetch('https://www.aaannunci.it/report2.aspx?idinzerat=' + event.currentTarget.getAttribute('data-idinzerat')); 332 if (!response.ok) { 333 throw new Error(`Response status: ${response.status}`); 334 } 335 336 const telo = await response.text(); 337 //console.log(telo); 338 document.getElementById('menu_wrap2').innerHTML = telo; 339 document.getElementById('modal_ramec').checked = true; 340 scrollBody(document.getElementById('modal_ramec')); 341 document.getElementById('inzerat_titul').innerHTML = document.querySelector('h1').innerHTML; 342 } catch (error) { 343 console.error(error.message); 344 } 345} 346 347function duvodNahlaseni() { 348 if (event.currentTarget.checked) document.getElementById('duvod_chyba').style.display = 'none'; 349} 350 351async function posliNahlaseni() { 352 if (!document.getElementById('nahlaseni').querySelector('input:checked[name=reason]')) { 353 const radios = document.querySelectorAll('input[name=reason]'); 354 for (let x = 0; x < radios.length; x++) { 355 radios[x].required = true; 356 } 357 358 document.getElementById('duvod_chyba').style.display = 'flex'; 359 return; 360 } 361 362 document.getElementById('duvod_chyba').style.display = 'none'; 363 const formData = new FormData(document.getElementById('nahlaseni')); 364 try { 365 const response = await fetch("https://www.aaannunci.it/report2.aspx", { 366 method: "POST", 367 // Set the FormData instance as the request body 368 body: formData, 369 }); 370 telo = await response.text() 371 document.getElementById('menu_wrap2').innerHTML = telo; 372 //console.log(telo); 373 } catch (e) { 374 console.error(e); 375 } 376} 377//#endregion 378 379//#region ODPOVED MODALNI RAMEC 380var prihlaseniTypAkce = null; 381async function napisOdpoved() { 382 prihlaseniTypAkce = 'napisOdpoved'; 383 const idinzerat = event.currentTarget.getAttribute('data-idinzerat'); 384 if (event.currentTarget.getAttribute('data-neniprihlaseny')) { 385 overitPrihlaseni(idinzerat); 386 } 387 else { 388 stahniOdpoved(idinzerat); 389 } 390} 391 392async function overitPrihlaseni(idinzerat) { 393 try { 394 const formData = new FormData(); 395 formData.append('jeuzprihlaseny', '1'); 396 const responsePrihlaseni = await fetch('https://www.aaannunci.it/ajax/prihlaseni.aspx', { 397 method: "POST", 398 // Set the FormData instance as the request body 399 body: formData 400 }); 401 402 const odpovedprihlaseni = await responsePrihlaseni.json(); 403 if (!odpovedprihlaseni.result) { 404 stahniPrihlaseni(); 405 return; 406 } 407 408 if (prihlaseniTypAkce == 'napisOdpoved') { 409 if (document.getElementById('btnReply').getAttribute('data-neniprihlaseny')) document.getElementById('btnReply').removeAttribute('data-neniprihlaseny'); 410 stahniOdpoved(idinzerat); 411 } 412 else if (prihlaseniTypAkce == 'ziskejCislo') { 413 ziskejCislo(); 414 } 415 else if (prihlaseniTypAkce == 'napisSMS') { 416 napisSms(); 417 } 418 } catch (error) { 419 console.log(error.message); 420 } 421} 422 423function stahniPrihlaseni() { 424 window.addEventListener('message', function (event) { 425 if (event.origin !== "https://www.aaannunci.it") return; 426 427 //console.log("Message received from the parent: " + event.data); // Message received from parent 428 if (event.data == 'jeprihlaseny') { 429 if (prihlaseniTypAkce == 'napisOdpoved') { 430 if (document.getElementById('btnReply').getAttribute('data-neniprihlaseny')) document.getElementById('btnReply').removeAttribute('data-neniprihlaseny'); 431 stahniOdpoved(document.getElementById('btnReply').getAttribute('data-idinzerat')); 432 } 433 else if (prihlaseniTypAkce == 'ziskejCislo') { 434 document.getElementById('modal_ramec').checked = false; 435 scrollBody(document.getElementById('modal_ramec')); 436 ziskejCislo(); 437 } 438 else if (prihlaseniTypAkce == 'napisSMS') { 439 document.getElementById('modal_ramec').checked = false; 440 scrollBody(document.getElementById('modal_ramec')); 441 napisSms(); 442 } 443 } 444 });
445 const prihlseni = document.createElement('iframe'); 446 prihlseni.className = 'prihlaseni-iram'; 447 prihlseni.src = 'https://www.aaannunci.it/login-popup'; 448 if (document.getElementById('menu_wrap2').firstChild) document.getElementById('menu_wrap2').removeChild(document.getElementById('menu_wrap2').firstChild); 449 document.getElementById('menu_wrap2').appendChild(prihlseni); 450 document.getElementById('modal_ramec').checked = true; 451 scrollBody(document.getElementById('modal_ramec')); 452} 453 454async function stahniOdpoved(idinzerat) { 455 try { 456 const response = await fetch('https://www.aaannunci.it/sendmessage.aspx?idinzerat=' + idinzerat); 457 if (!response.ok) { 458 throw new Error(`Response status: ${response.status}`); 459 } 460 461 const telo = await response.text(); 462 if (telo == 'neniprihlaseny') { 463 stahniPrihlaseni(); 464 return; 465 } 466 //console.log(telo); 467 document.getElementById('menu_wrap2').innerHTML = telo; 468 document.getElementById('modal_ramec').checked = true; 469 scrollBody(document.getElementById('modal_ramec')); 470 } catch (error) { 471 console.log(error.message); 472 } 473} 474 475const regexSmajlici = /\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/gu; 476const regexBileMisto = /([^\S\n\r][^\S\n\r])[^\S\n\r]+/gu; 477const regexRadkovani3vice = /([\n\r][\n\r])[\n\r]+/gu 478function odstranSmajliky() { 479 if (regexSmajlici.test(event.currentTarget.value)) { 480 event.currentTarget.value = event.currentTarget.value.replace(regexSmajlici, ''); 481 } 482 if (regexBileMisto.test(event.currentTarget.value)) { 483 event.currentTarget.value = event.currentTarget.value.replace(regexBileMisto, '$1'); 484 } 485 if (regexRadkovani3vice.test(event.currentTarget.value)) { 486 event.currentTarget.value = event.currentTarget.value.replace(regexRadkovani3vice, '$1'); 487 } 488} 489 490function kontrolujJmeno() { 491 const jmeno = document.getElementById('name'); 492 if (!jmeno) return false; 493 jmeno.value = jmeno.value.replace(regexSmajlici, ''); 494 495 var isValid = true; 496 if (jmeno.value.length == 0) { 497 jmeno.setCustomValidity('errore'); 498 document.getElementById('jmeno_prazdno').style.display = 'flex'; 499 isValid = false; 500 } 501 else { 502 document.getElementById('jmeno_prazdno').style.display = 'none'; 503 } 504 505 if (jmeno.validity.tooShort) { 506 document.getElementById('jmeno_min').style.display = 'flex'; 507 document.getElementById('jmeno_min').querySelector('span').innerHTML = jmeno.value.length; 508 isValid = false; 509 } 510 else { 511 document.getElementById('jmeno_min').style.display = 'none'; 512 } 513 514 if (jmeno.validity.tooLong) { 515 document.getElementById('jmeno_max').style.display = 'flex'; 516 document.getElementById('jmeno_max').querySelector('span').innerHTML = jmeno.value.length; 517 isValid = false; 518 } 519 else { 520 document.getElementById('jmeno_max').style.display = 'none'; 521 } 522 523 if (isValid) jmeno.setCustomValidity(''); 524 return isValid; 525} 526 527const emailRegex = /^([a-zA-Z0-9._%+-]+)(@)([a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,9})$/gi; 528function kontrolujEmail() { 529 const email = document.getElementById('email'); 530 if (!email) return false; 531 532 if (event.currentTarget == email && (!event.relatedTarget || !event.relatedTarget.getAttribute('data-blurprevious'))) return; 533 534 if (document.getElementById('email_spatny')) document.getElementById('email_spatny').style.display = 'none'; 535 if (document.getElementById('email_obsazeny')) document.getElementById('email_obsazeny').style.display = 'none'; 536 537 var isValid = true; 538 if (email.value.length == 0) { 539 email.setCustomValidity('errore'); 540 document.getElementById('email_prazdno').style.display = 'flex'; 541 isValid = false; 542 } 543 else { 544 document.getElementById('email_prazdno').style.display = 'none'; 545 } 546 547 if (isValid && email.validity.typeMismatch) { 548 document.getElementById('email_mismatch').style.display = 'flex'; 549 isValid = false; 550 } 551 else if (isValid && !email.value.match(emailRegex)) { 552 document.getElementById('email_mismatch').style.display = 'flex'; 553 email.setCustomValidity('errore'); 554 isValid = false; 555 } 556 else { 557 document.getElementById('email_mismatch').style.display = 'none'; 558 } 559 560 if (isValid && email.validity.tooShort) { 561 document.getElementById('email_min').style.display = 'flex'; 562 document.getElementById('email_min').querySelector('span').innerHTML = email.value.length; 563 isValid = false; 564 } 565 else { 566 document.getElementById('email_min').style.display = 'none'; 567 } 568 569 if (isValid && email.validity.tooLong) { 570 document.getElementById('email_max').style.display = 'flex'; 571 document.getElementById('email_max').querySelector('span').innerHTML = email.value.length; 572 isValid = false; 573 } 574 else { 575 document.getElementById('email_max').style.display = 'none'; 576 } 577 578 if (isValid) email.setCustomValidity(''); 579 return isValid; 580} 581 582function kontrolujZpravu() { 583 const zprava = document.getElementById('message'); 584 if (!zprava) return false; 585 zprava.value = zprava.value.replace(regexSmajlici, ''); 586 587 var isValid = true; 588 if (zprava.value.length == 0) { 589 zprava.setCustomValidity('errore'); 590 document.getElementById('zprava_prazdno').style.display = 'flex'; 591 isValid = false; 592 } 593 else { 594 document.getElementById('zprava_prazdno').style.display = 'none'; 595 } 596 597 if (zprava.validity.tooShort) { 598 document.getElementById('zprava_min').style.display = 'flex'; 599 document.getElementById('zprava_min').querySelector('span').innerHTML = zprava.value.length; 600 isValid = false; 601 } 602 else { 603 document.getElementById('zprava_min').style.display = 'none'; 604 } 605 606 if (zprava.validity.tooLong) { 607 document.getElementById('zprava_max').style.display = 'flex'; 608 document.getElementById('zprava_max').querySelector('span').innerHTML = zprava.value.length; 609 isValid = false; 610 } 611 else { 612 document.getElementById('zprava_max').style.display = 'none'; 613 } 614 615 if (isValid) zprava.setCustomValidity(''); 616 return isValid; 617} 618 619function kontrolujZpravu2() { 620 const zprava = document.getElementById('message2'); 621 if (!zprava) return false; 622 zprava.value = zprava.value.replace(regexSmajlici, ''); 623} 624 625async function posliOdpoved() { 626 try { 627 var isValid = true; 628 629 if (!kontrolujJmeno()) isValid = false; 630 //if (!kontrolujEmail()) isValid = false; 631 if (!kontrolujZpravu()) isValid = false; 632 633 if (!isValid) { 634 event.preventDefault(); 635 return; 636 } 637 638 event.preventDefault(); 639 const formData = new FormData(document.getElementById('odpoved')); 640 const response = await fetch('https://www.aaannunci.it/sendmessage.aspx?modal=true&idinzerat=' + event.currentTarget.getAttribute('data-idinzerat'), { 641 method: "POST", 642 // Set the FormData instance as the request body 643 body: formData, 644 }); 645 646 telo = await response.text() 647 document.getElementById('menu_wrap2').innerHTML = telo; 648 } catch (error) { 649 console.error(error.message); 650 } 651} 652//#endregion 653 654//#region EMAIL VERIFIKACE 655var countdown = 0; 656async function posliVerifikaci() { 657 event.preventDefault(); 658 if (countdown > 0) return; 659 660 const formData = new FormData(document.getElementById('form-verifi')); 661 formData.append('fetchpost', '1'); 662 const response = await fetch('https://www.aaannunci.it/ajax/prihlaseni.aspx', { 663 method: "POST", 664 // Set the FormData instance as the request body 665 body: formData 666 });
667 668 const odpoved = await response.json(); 669 if (odpoved && odpoved.result) { 670 console.log('Verification email SUCCESS'); 671 if (odpoved.odpocet) { 672 document.getElementById('info-veri').style.display = 'block'; 673 countdown = odpoved.odpocet; 674 odpocitavani(); 675 } 676 } 677 else if (odpoved && !odpoved.result && odpoved.error == 1) { 678 console.log('Email already verified'); 679 document.getElementById('verifi-obal').style.display = 'none'; 680 if (document.getElementById('vlozit-obal')) document.getElementById('vlozit-obal').style.display = 'block'; 681 } 682 else if (odpoved && !odpoved.result && odpoved.odpocet) { 683 console.log('Email verification send before limit'); 684 countdown = odpoved.odpocet; 685 odpocitavani(); 686 } 687 else { 688 console.log('Verification email FAILED'); 689 document.getElementById('form-verifi').submit(); 690 } 691} 692 693function odpocitavani() { 694 if (countdown < 1) { 695 document.getElementById('btnPosliVeri').removeAttribute('disabled'); 696 document.getElementById('stop-veri').style.display = 'none'; 697 return; 698 } 699 700 countdown -= 1; 701 702 if (document.getElementById('btnPosliVeri').disabled != 'disabled') document.getElementById('btnPosliVeri').disabled = 'disabled'; 703 if (document.getElementById('stop-veri').style.display != 'block') document.getElementById('stop-veri').style.display = 'block'; 704 705 document.getElementById('zbyvasekund').innerHTML = countdown; 706 setTimeout(odpocitavani, 1000); 707} 708 709if (document.getElementById('form-verifi') && document.getElementById('form-verifi').getAttribute('data-countdown')) { 710 countdown = Number(document.getElementById('form-verifi').getAttribute('data-countdown')); 711 odpocitavani(); 712} 713 714async function pingJeVerifikovany() { 715 try { 716 const formData = new FormData(); 717 formData.append('pingjeverifikovany', '1'); 718 const response = await fetch('https://www.aaannunci.it/ajax/prihlaseni.aspx', { 719 method: "POST", 720 // Set the FormData instance as the request body 721 body: formData 722 }); 723 724 const odpoved = await response.json(); 725 if (odpoved && odpoved.result) { 726 countdown = 0; 727 document.getElementById('verifi-obal').style.display = 'none'; 728 if (document.getElementById('vlozit-obal')) document.getElementById('vlozit-obal').style.display = 'block'; 729 return; 730 } 731 } catch (e) { 732 console.error(e); 733 location.href += '?verified'; 734 } 735} 736//#endregion 737 738//#region OBLIBENE 739async function posliOblibene() { 740 try { 741 if (!event.currentTarget.getAttribute('data-idinzerat')) return; 742 const target = event.currentTarget; 743 var isPridat = true; 744 const formData = new FormData(); 745 formData.append('IdAdvert', event.currentTarget.getAttribute('data-idinzerat')); 746 if (event.currentTarget.getAttribute('data-jeboliben')) { 747 formData.append('Action', 'FavoritiesRemove'); 748 isPridat = false; 749 } 750 else { 751 formData.append('Action', 'FavoritiesAdd'); 752 } 753 const response = await fetch('https://www.aaannunci.it/ajax/ajax.aspx', { 754 method: "POST", 755 // Set the FormData instance as the request body 756 body: formData, 757 }); 758 759 var odpoved = await response.json(); 760 if (odpoved && odpoved.result) { 761 if (isPridat) { 762 target.setAttribute('data-jeboliben', '1'); 763 } 764 else { 765 target.removeAttribute('data-jeboliben'); 766 } 767 if (target.querySelector('span')) target.querySelector('span').innerHTML = odpoved.text; 768 } 769 } catch (error) { 770 console.error(error.message); 771 } 772} 773//#endregion 774 775//#region SDILEJ 776async function stahniSdilej() { 777 try { 778 if (!event.currentTarget.getAttribute('data-idinzerat')) return; 779 780 const formData = new FormData(); 781 formData.append('IdAdvert', event.currentTarget.getAttribute('data-idinzerat')); 782 783 const response = await fetch('https://www.aaannunci.it/ajax/share.aspx', { 784 method: "POST", 785 // Set the FormData instance as the request body 786 body: formData, 787 }); 788 789 if (!response.ok) { 790 throw new Error(`Response status: ${response.status}`); 791 } 792 793 const telo = await response.text(); 794 document.getElementById('menu_wrap2').innerHTML = telo; 795 document.getElementById('modal_ramec').checked = true; 796 scrollBody(document.getElementById('modal_ramec')); 797 } catch (error) { 798 console.error(error.message); 799 } 800} 801 802async function writeClipboard(text) { 803 try { 804 await navigator.clipboard.writeText(text); 805 } catch (error) { 806 console.error(error.message); 807 } 808} 809//#endregion 810 811//#region TCF 812async function setTcf(_allowCookies) { 813 if (typeof check1 === 'undefined' || typeof check2 === 'undefined') return;
814 if (!check1 || !check2) return; 815 var wi = 0; 816 wi = (window.screen.availWidth) ? window.screen.availWidth : window.screen.width; 817 var hi = 0; 818 hi = (window.screen.availHeight) ? window.screen.availHeight : window.screen.height; 819 var dpr = 0; 820 dpr = (window.devicePixelRatio) ? window.devicePixelRatio : 0; 821 822 const formData = new FormData(); 823 formData.append('allowCookies', _allowCookies); 824 formData.append('check1', check1); 825 formData.append('check2', check2); 826 if (typeof clientIP !== 'undefined') formData.append('clientIP', clientIP); 827 if (typeof userAgent !== 'undefined') formData.append('userAgent', userAgent); 828 formData.append('w', wi); 829 formData.append('h', hi); 830 formData.append('pr', dpr); 831 const response = await fetch('https://www.aaannunci.it/async/tcf_v3_async.aspx', { 832 method: "POST", 833 // Set the FormData instance as the request body 834 body: formData, 835 }); 836 837 if (!response.ok) { 838 throw new Error(`Response status: ${response.status}`); 839 } 840} 841//#endregion 842 843//#region XORUJ 844function XorujToNovy(input, key) { 845 try { 846 var result = ''; 847 for (var i = 0; i < input.length; i++) { 848 result += String.fromCharCode(key ^ input.charCodeAt(i)); 849 } 850 851 return btoa(result); 852 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 853} 854 855function XorujFromNovy(input, key) { 856 try { 857 input = atob(input); 858 var result = ''; 859 for (var i = 0; i < input.length; i++) { 860 result += String.fromCharCode(key ^ input.charCodeAt(i)); 861 } 862 863 return result; 864 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '() | input param: ' + input, ex); } 865} 866//#endregion 867 868//#region INIT 869function initMe() { 870 try { 871 const elms = document.querySelectorAll('[data-ivent]'); 872 for (let x = 0; x < elms.length; x++) { 873 if (elms[x].getAttribute('data-ivent').indexOf('hotovo_') == 0) continue; 874 const iventsSplit = elms[x].getAttribute('data-ivent').split("___"); 875 for (let i = 0; i < iventsSplit.length; i++) { 876 const iventSplit = iventsSplit[i].split("__"); 877 if (iventSplit.length < 2) console.log("initMe() - " + elms[x].id + " - data-ivent: " + elms[x].getAttribute('data-ivent')); 878 const isPassive = (iventsSplit[i].indexOf('__pasivni') > -1) ? true : false; 879 if (typeof window[iventSplit[1]] !== "function") { 880 console.log("initMe() - " + elms[x].id + " - FUNCTION NOT FOUND - " + iventSplit[1]); 881 } 882 else { 883 elms[x].addEventListener(iventSplit[0], function (event) { window[iventSplit[1]](this, event); }, { passive: isPassive }); 884 } 885 } 886 elms[x].setAttribute('data-ivent', 'hotovo_' + elms[x].getAttribute('data-ivent')); 887 } 888 } catch (ex) { writeErrLog2(scriptNazev + '.' + arguments.callee.name + '()', ex); } 889} 890 891if (document.readyState == 'loading') { 892 document.addEventListener('DOMContentLoaded', initMe); 893} else { 894 // DOM is ready! 895 initMe(); 896} 897//#endregion 898 899//#region CHYBY_LOGOVANI 900var xhr_jschyba = null; 901function writeErrLog2(debugInfo, errorMessage) { 902 LogErrorInCookies2(debugInfo, errorMessage); 903} 904 905function LogErrorInCookies2(debugInfo, errorMessage, errorObj, errSource, errLineno, errColno) { 906 var errorMsg = ''; 907 try { 908 var errorDescript = ''; 909 if (typeof errorObj !== 'undefined') { 910 errorMsg = createErrorMsg(errorObj); 911 debugInfo = scriptNazev; 912 } 913 else if (typeof errorMessage === 'string' && typeof errSource === 'string' && typeof errLineno === 'string' && typeof errColno === 'string') { 914 errorMsg = errorMessage; 915 if (document.readyState) errorMsg += ' | document.readyState: ' + document.readyState.toString(); 916 errorMsg += ' | Error Source: ' + errSource; 917 errorMsg += ' | Error LineNumber: ' + errLineno; 918 errorMsg += ' | Error ColumnNumber: ' + errColno; 919 } 920 else if (typeof errorMessage === 'string') { 921 errorMsg = errorMessage; 922 } 923 else if (errorMessage) { 924 errorMsg = createErrorMsg(errorMessage); 925 } 926 927 var debugInfoFull = window.location.href + '; ' + debugInfo; 928 929 console.log(debugInfo + '\r\n' + errorDescript + '\r\n' + errorMsg.replace(/ \| /gi, '\r\n')); 930
931 if (!xhr_jschyba) xhr_jschyba = new XMLHttpRequest(); 932 var postData = 'DebugInfo=' + encodeURIComponent(debugInfoFull) + "&ErrorDescription=" + encodeURIComponent(errorDescript) + "&ErrorMessage=" + encodeURIComponent(errorMsg.replace(/\</gi, '[').replace(/\>/gi, ']')); 933 934 xhr_jschyba.open("POST", '/async/logjserrorasnyc.aspx?debuginfo=' + encodeURIComponent(debugInfo)); 935 xhr_jschyba.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 936 xhr_jschyba.send(postData); 937 } 938 catch (ex) { } 939} 940 941function writeErrLog(debugInfo, errorMessage) { 942 LogErrorInCookies2(debugInfo, errorMessage); 943} 944function LogErrorInCookies(debugInfo, errorMessage) { 945 LogErrorInCookies2(debugInfo, errorMessage); 946} 947 948function createErrorMsg(errObj) { 949 var errorMsg = ''; 950 if (errObj.message) errorMsg = errObj.message; 951 if (errObj.description) errorDescript = errObj.description; 952 if (document.readyState) errorMsg += ' | document.readyState: ' + document.readyState.toString(); 953 if (errObj.name) errorMsg += ' | Error Name: ' + errObj.name; 954 if (errObj.stack) errorMsg += ' | Error Stack: ' + errObj.stack; 955 if (errObj.lineNumber) errorMsg += ' | Error LineNumber: ' + errObj.lineNumber; 956 if (errObj.columnNumber) errorMsg += ' | Error ColumnNumber: ' + errObj.columnNumber; 957 return errorMsg; 958} 959//#endregion
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.