1var localeString = 'cs_CZ'; 2var update_slider = false; 3var mapa; 4var default_sort_vzd = true; 5 6function load() { 7} 8 9function loadFacebook() { 10 jQuery('.facebook_like').attr('src', 'http://www.facebook.com/plugins/like.php?href=' + 'http://' + document.domain + '&layout=button_count&show_faces=false&width=250&action=like&colorscheme=light&height=80&locale=' + localeString); 11} 12 13function showGeoregion(id) { 14 jQuery('.georegion_' + id + '_preview').toggle(); 15 jQuery('.georegion_' + id + '_full').toggle(); 16} 17 18function otevriOknoSmall(url) { 19 window.open(url, "_blank", "width=1000,height=600,scrollbars=yes,toolbar=yes"); 20 return false; 21} 22 23function otevriOknoSmall2(url) { 24 window.open(url, "_blank", "width=600,height=400,scrollbars=yes,toolbar=yes"); 25 return false; 26} 27 28jQuery(function () { 29 updateItinerarModul(false); 30}); 31 32function showhide(id) { 33 jQuery('#' + id).toggleClass('showhide_hidden'); 34 if (jQuery('#link_' + id).hasClass('showhide_plus')) { 35 jQuery('#link_' + id).removeClass('showhide_plus'); 36 jQuery('#link_' + id).addClass('showhide_minus'); 37 } else { 38 jQuery('#link_' + id).removeClass('showhide_minus'); 39 jQuery('#link_' + id).addClass('showhide_plus'); 40 } 41} 42 43 44var itinerarReloadPage = false; 45var itinerarReloadPageLocation = ''; 46 47function updateItinerarModul(reloadovat) { 48 console.log("updating modul"); 49 var url = '/resource/accountCheck.php?' + Math.round(new Date().getTime() / 1000); 50 var img = new Image(); 51 jQuery(img).load( 52 function () { 53 jQuery.post('/resource/itinerarAjax.php', { akce: 'updateModule' }, 54 function (data) { 55 var logged = data[0]; 56 data = data.substr(1); 57 jQuery('.uzivatel').html(data); 58 if (reloadovat && itinerarReloadPage) { 59 if (itinerarReloadPageLocation == '') itinerarReloadPageLocation = window.location; 60 window.location = itinerarReloadPageLocation; 61 } 62 } 63 ); 64 } 65 ); 66 img.src = url; 67} 68 69function userLogout() { 70 var currentUrl = encodeURIComponent(btoa(window.location.href)); 71 var callback = encodeURIComponent(window.location.protocol + "//" + window.location.host + "/resource/account.php?a=Logout&c=" + currentUrl); 72 window.location.href = "https://users.czecot.com/account/?a=Logout&c=" + callback; 73} 74 75function userLogin(url) { 76 const loginWindow = window.open(url, '_blank', "width=600,height=400,scrollbars=yes,toolbar=yes"); 77 78 // https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript 79 const timer = setInterval(function() { 80 if (loginWindow.closed) { 81 clearInterval(timer); 82 // Third-party background cookie checks are blocked in Firefox/Safari, preventing session sync. 83 // We do a top-level redirect here so that the browser allows cookies, fetching the new user hash. 84 var currentUrl = encodeURIComponent(btoa(window.location.href)); 85 var callback = encodeURIComponent(window.location.protocol + "//" + window.location.host + "/resource/account.php?a=CheckCookie&c=" + currentUrl); 86 window.location.href = "https://users.czecot.com/account/?a=CheckCookie&c=" + callback; 87 } 88 }, 500); 89 return false; 90} 91 92function AddFavorite(linkObj, addUrl, addTitle) { 93 if (document.all && !window.opera) { 94 window.external.AddFavorite(addUrl, addTitle); 95 return false; 96 } 97 else if (window.opera && window.print) { 98 linkObj.title = addTitle; 99 return true; 100 } 101 else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) { 102 window.sidebar.addPanel(addTitle, addUrl, ''); 103 return false; 104 } 105 return false; 106} 107 108 109 110 111 112/*** GEOSRANDY ***/ 113 114var vrstva; 115var map; 116var markers; 117var listenRedraw = false; 118 119var GF = GF || {} 120 121 122GF.Geosranda = function (data) { 123 this.data = data; 124} 125 126 127GF.Geosranda.prototype.getHtml = function () { 128 return this.data.html; 129} 130 131GF.Geosranda.prototype.getAtributy = function () { 132 return this.data.atributy; 133} 134 135GF.Geosranda.prototype.getFaktory = function () { 136 return this.data.faktory; 137} 138 139GF.Geosranda.prototype.getVozickar = function () { 140 return this.data.vozickar; 141} 142GF.Geosranda.prototype.getKocarek = function () { 143 return this.data.kocarek; 144} 145GF.Geosranda.prototype.getSnih = function () { 146 return this.data.snih; 147} 148GF.Geosranda.prototype.getKolo = function () { 149 return this.data.kolo; 150} 151GF.Geosranda.prototype.isMarkerAdded = function () { 152 return this.data.markerAdded; 153} 154GF.Geosranda.prototype.setMarkerAdded = function (val) { 155 return this.data.markerAdded = val; 156} 157GF.Geosranda.prototype.getMarker = function () { 158 return this.data.marker; 159} 160GF.Geosranda.prototype.getTyp = function () { 161 return this.data.typ; 162} 163GF.Geosranda.prototype.getWgs84lat = function () { 164 return this.data.wgs84lat; 165} 166GF.Geosranda.prototype.getWgs84long = function () { 167 return this.data.wgs84long; 168} 169GF.Geosranda.prototype.getID = function () { 170 return this.data.id_ukol; 171} 172GF.Geosranda.prototype.getVzdalenost = function () { 173 return this.data.vzdalenost; 174} 175GF.Geosranda.prototype.setVzdalenost = function (vzdalenost) { 176 var vzd = ''; 177 if (vzdalenost > 1000) vzd = Math.round(vzdalenost / 100) / 10 + " km"; 178 else vzd = Math.round(vzdalenost) + " m"; 179 this.data.html = this.data.html.replace(/XXVZDXX/g, vzd); 180 this.data.html = this.data.html.replace(/geosranda_vzdalenost/g, "geosranda_vzdalenost2"); 181 this.data.vzdalenost = vzdalenost; 182} 183GF.Geosranda.prototype.getCasAvg = function () { 184 return this.data.cas_avg; 185} 186GF.Geosranda.prototype.getBody = function () { 187 return this.data.body; 188} 189GF.Geosranda.prototype.getZiskaneBody = function () { 190 return this.data.ziskane_body; 191} 192GF.Geosranda.prototype.getCreated = function () { 193 return this.data.created; 194} 195 196 197 198GF.Geosrandy = { 199 items: [], 200 lat: 0, 201 lon: 0, 202 sliders: [ 203 1, 204 1, 205 1, 206 1 207 ], 208 na_stranku: 3, 209 add: function (geosranda) { 210 this.items.push(geosranda); 211 }, 212 checkIkona: function (id) { 213 jQuery('#geosranda_ikona_' + id).toggleClass('checked'); 214 GF.Geosrandy.reloadSeznam(); 215 }, 216 countDistance: function () { 217 var l = this.items.length; 218 for (i = 0; i < l; i++) { 219 var vzdalenost = distance(this.items[i].getWgs84lat(), this.items[i].getWgs84long(), this.lat, this.lon); 220 this.items[i].setVzdalenost(vzdalenost); 221 } 222 jQuery('.geosranda_vzdalenost').show(); 223 }, 224 countDistancePlain: function () { 225 var l = this.items.length; 226 for (i = 0; i < l; i++) { 227 var vzdalenost = distance(this.items[i].getWgs84lat(), this.items[i].getWgs84long(), this.lat, this.lon); 228 var vzd = ''; 229 if (vzdalenost > 1000) vzd = Math.round(vzdalenost / 100) / 10 + " km"; 230 else vzd = Math.round(vzdalenost) + " m"; 231 jQuery('#geosranda_' + this.items[i].getID() + ' .geosranda_vzdalenost').html(vzd).show(); 232 //this.items[i].setVzdalenost(vzdalenost); 233 } 234 jQuery('.geosranda_vzdalenost').show(); 235 }, 236 populateHash: function () { 237 var hash = document.location.hash.replace('#', ''); 238 if (hash != '') { 239 var lat = 0; 240 var lng = 0; 241 var zoom = 0; 242 var hash_assoc = []; 243 var temp = hash.split('&'); 244 for (i = 0; i < temp.length; i++) { 245 var temp2 = temp[i].split('='); 246 if (temp2[0] == 'x') lat = temp2[1]; 247 if (temp2[0] == 'y') lng = temp2[1]; 248 if (temp2[0] == 'z') zoom = temp2[1]; 249 if (temp2[0] == 's0') { 250 jQuery('#slider_0').slider('option', 'value', temp2[1]); 251 jQuery('#slider_0 a').html(temp2[1]); 252 } 253 if (temp2[0] == 's1') { 254 jQuery('#slider_1').slider('option', 'value', temp2[1]); 255 jQuery('#slider_1 a').html(temp2[1]); 256 } 257 if (temp2[0] == 's2') { 258 jQuery('#slider_2').slider('option', 'value', temp2[1]); 259 jQuery('#slider_2 a').html(temp2[1]); 260 } 261 if (temp2[0] == 's3') { 262 jQuery('#slider_3').slider('option', 'value', temp2[1]); 263 jQuery('#slider_3 a').html(temp2[1]); 264 } 265 if (temp2[0] == 't') { 266 var pole = temp2[1].split(','); 267 if (pole.indexOf('nehrane') == -1) jQuery('#filter_nehrane:visible').attr('checked', false); 268 if (pole.indexOf('nedohrane') == -1) jQuery('#filter_nedohrane:visible').attr('checked', false); 269 if (pole.indexOf('odehrane') == -1) jQuery('#filter_odehrane:visible').attr('checked', false); 270 } 271 if (temp2[0] == 'f1' && temp2[1] == 't') jQuery("#filter_vozickar").attr('checked', true); 272 if (temp2[0] == 'f2' && temp2[1] == 't') jQuery("#filter_kocarek").attr('checked', true); 273 if (temp2[0] == 'f3' && temp2[1] == 't') jQuery("#filter_snih").attr('checked', true); 274 if (temp2[0] == 'f4' && temp2[1] == 't') jQuery("#filter_kolo").attr('checked', true); 275 if (temp2[0] == 'o') { 276 default_sort_vzd = false;
277 jQuery("#filter_sort").val(temp2[1]); 278 jQuery('#filter_sort').msDropDown(); 279 } 280 } 281 if (lat > 0 && lng > 0 && zoom > 0) { 282 map.setCenter(SMap.Coords.fromWGS84(lng, lat)); 283 map.setZoom(parseInt(zoom)); 284 } 285 } 286 }, 287 reloadSeznam: function (source) { 288 listenRedraw = false; 289 var html = ""; 290 var pages = []; 291 source = source || ''; 292 293 var onlyvisible = false; 294 var dw = 0; 295 var dh = 0; 296 if (source == 'map') { 297 onlyvisible = true; 298 var size = map.getSize(); /* port size */ 299 var half = new SMap.Pixel(Math.round(size.x / 2), Math.round(size.y / 2)); 300 dw = half.x; 301 dh = half.y; 302 } 303 304 var container = jQuery('#geosrandy_container'); 305 container.addClass("loading"); 306 307 var typy = []; 308 if (jQuery('#filter_nehrane:checked').length > 0) typy.push('nehrane'); 309 if (jQuery('#filter_nedohrane:checked').length > 0) typy.push('nedohrane'); 310 if (jQuery('#filter_odehrane:checked').length > 0) typy.push('odehrane'); 311 312 var atributy = []; 313 var tpole = jQuery('.geosranda_ikona.checked'); 314 if (tpole.length > 0) { 315 for (i = 0; i < tpole.length; i++) { 316 atributy.push(parseInt(tpole[i].id.replace('geosranda_ikona_', ''))); 317 } 318 } 319 320 var counter = 1; 321 var akt_html = ''; 322 var l = this.items.length; 323 var points = []; 324 var vybrane = []; 325 for (i = 0; i < l; i++) { 326 // otestovat, jestli vyhovuje filtrum 327 var zobrazit = true; 328 var faktory_vyhovuje = true; 329 var faktory = this.items[i].getFaktory(); 330 for (j = 0; j < this.sliders.length; j++) { 331 if (this.sliders[j] > faktory[j]) faktory_vyhovuje = false;
332 } 333 if (!faktory_vyhovuje) zobrazit = false; 334 335 var temp = jQuery("#filter_vozickar:checked").length; 336 if (temp > 0 && !this.items[i].getVozickar()) zobrazit = false; 337 var temp = jQuery("#filter_kocarek:checked").length; 338 if (temp > 0 && !this.items[i].getKocarek()) zobrazit = false; 339 var temp = jQuery("#filter_snih:checked").length; 340 if (temp > 0 && !this.items[i].getSnih()) zobrazit = false; 341 var temp = jQuery("#filter_kolo:checked").length; 342 if (temp > 0 && !this.items[i].getKolo()) zobrazit = false; 343 344 if (jQuery.inArray(this.items[i].getTyp(), typy) < 0) zobrazit = false; 345 if (atributy.length > 0) { 346 var mamatribut = false; 347 for (j = 0; j < this.items[i].getAtributy().length; j++) { 348 if (atributy.indexOf(this.items[i].getAtributy()[j]) >= 0) mamatribut = true; 349 } 350 if (!mamatribut) zobrazit = false; 351 } 352 353 354 if (zobrazit) { 355 if (!this.items[i].isMarkerAdded()) { 356 this.items[i].setMarkerAdded(true); 357 vrstva.addMarker(this.items[i].getMarker()); 358 } 359 points.push(this.items[i].getMarker().getCoords()); 360 } else { 361 if (this.items[i].isMarkerAdded()) { 362 this.items[i].setMarkerAdded(false); 363 vrstva.removeMarker(this.items[i].getMarker()); 364 } 365 continue; 366 } 367 368 if (onlyvisible) { 369 // chceme jen objekty, kde je viditelny marker 370 var pos = this.items[i].getMarker().getCoords().toPixel(map); 371 var dx = Math.abs(pos.x); 372 var dy = Math.abs(pos.y); 373 var visible = !(dx > dw || dy > dh); 374 if (!visible) continue; 375 } 376 377 378 vybrane.push(this.items[i]); 379 } 380 381 var sort = jQuery('#filter_sort').val(); 382 //console.log("sorting: " + sort); 383 vybrane = vybrane.sort(function (a, b) { 384 if (sort == 'vzdalenost') { 385 if (a.getVzdalenost() < b.getVzdalenost()) return -1; 386 else if (a.getVzdalenost() > b.getVzdalenost()) return 1; 387 else return 0; 388 } 389 if (sort == 'cas_avg') { 390 if (a.getCasAvg() < b.getCasAvg()) return -1; 391 else if (a.getCasAvg() > b.getCasAvg()) return 1; 392 else return 0; 393 } 394 if (sort == 'body') { 395 if (a.getBody() < b.getBody()) return 1; 396 else if (a.getBody() > b.getBody()) return -1; 397 else return 0; 398 } 399 if (sort == 'created') { 400 if (a.getCreated() < b.getCreated()) return 1; 401 else if (a.getCreated() > b.getCreated()) return -1; 402 else return 0; 403 } 404 if (sort == 'ziskane_body') { 405 if (a.getZiskaneBody() < b.getZiskaneBody()) return 1; 406 else if (a.getZiskaneBody() > b.getZiskaneBody()) return -1; 407 else return 0; 408 } 409 }); 410 411 for (i = 0; i < vybrane.length; i++) { 412 akt_html += vybrane[i].getHtml(); 413 if (counter++ >= this.na_stranku) { 414 pages.push(akt_html); 415 akt_html = ''; 416 counter = 1; 417 } 418 } 419 420 421 if (!onlyvisible) { 422 var res = map.computeCenterZoom(points); 423 if (res[1] > 13) res[1] = 13; 424 map.setCenterZoom(res[0], res[1]); 425 } 426 427 428 if (akt_html != '') pages.push(akt_html); 429 430 var pagination = '<ul>'; 431 for (i = 0; i < pages.length; i++) { 432 html += '<div class="geosranda_page" id="geosranda_page_' + i + '"'; 433 if (i > 0) html += ' style="display: none;"'; 434 html += '>'; 435 html += pages[i]; 436 html += '</div>'; 437 pagination += '<li id="geosrandy_pagination_' + i + '" class="geosrandy_pagination' + (i == 0 ? ' active' : '') + '"><a href="javascript:geosrandyChangePage(' + i + ')">' + (i + 1) + '</a></li>'; 438 } 439 pagination += '</ul>'; 440 441 html += '<div class="pagination">'; 442 443 html += '<div class="vyhledano">' + resources['vyhledano'] + ': ' + vybrane.length + '</div>' 444 if (pages.length > 1) html += pagination; 445 446 html += '<div class="clear"></div></div>'; 447 448 container.removeClass("loading"); 449 jQuery('#geosrandy_container').html(html); 450 listenRedraw = true; 451 vybrane = null; 452 453 //update hash 454 if (true) { 455 var center = map.getCenter(); 456 var zoom = map.getZoom(); 457 var temp = center.toWGS84(); 458 var t = typy.toString(); 459 var str = 'x=' + temp[1] + '&y=' + temp[0] + '&z=' + zoom + '&t=' + t; 460 for (j = 0; j < this.sliders.length; j++) { 461 str += '&s' + j + '=' + this.sliders[j]; 462 } 463 var temp = jQuery("#filter_vozickar:checked").length; 464 if (temp > 0) str += '&f1=t'; 465 else str += '&f1=f'; 466 var temp = jQuery("#filter_kocarek:checked").length; 467 if (temp > 0) str += '&f2=t'; 468 else str += '&f2=f'; 469 var temp = jQuery("#filter_snih:checked").length; 470 if (temp > 0) str += '&f3=t'; 471 else str += '&f3=f'; 472 var temp = jQuery("#filter_kolo:checked").length; 473 if (temp > 0) str += '&f4=t'; 474 else str += '&f4=f'; 475 str += '&o=' + jQuery('#filter_sort').val(); 476 document.location.hash = str; 477 } 478 } 479} 480 481GF.GeosrandyNew = { 482 items: [], 483 lat: 0, 484 lon: 0, 485 sliders: [ 486 1, 487 1, 488 1, 489 1 490 ], 491 na_stranku: 3, 492 add: function (geosranda) { 493 this.items.push(geosranda); 494 }, 495 checkIkona: function (id) { 496 jQuery('#geosranda_ikona_' + id).toggleClass('checked'); 497 GF.GeosrandyNew.reloadSeznam(); 498 }, 499 countDistance: function () { 500 var l = this.items.length; 501 for (i = 0; i < l; i++) { 502 var vzdalenost = distance(this.items[i].getWgs84lat(), this.items[i].getWgs84long(), this.lat, this.lon); 503 this.items[i].setVzdalenost(vzdalenost); 504 } 505 jQuery('.geosranda_vzdalenost').show(); 506 }, 507 countDistancePlain: function () { 508 var l = this.items.length; 509 for (i = 0; i < l; i++) { 510 var vzdalenost = distance(this.items[i].getWgs84lat(), this.items[i].getWgs84long(), this.lat, this.lon); 511 var vzd = ''; 512 if (vzdalenost > 1000) vzd = Math.round(vzdalenost / 100) / 10 + " km"; 513 else vzd = Math.round(vzdalenost) + " m"; 514 jQuery('#geosranda_' + this.items[i].getID() + ' .geosranda_vzdalenost').html(vzd).show(); 515 //this.items[i].setVzdalenost(vzdalenost); 516 } 517 jQuery('.geosranda_vzdalenost').show(); 518 }, 519 populateHash: function () { 520 var hash = document.location.hash.replace('#', ''); 521 if (hash != '') { 522 var lat = 0; 523 var lng = 0; 524 var zoom = 0; 525 var hash_assoc = []; 526 var temp = hash.split('&'); 527 for (i = 0; i < temp.length; i++) { 528 var temp2 = temp[i].split('='); 529 if (temp2[0] == 'x') lat = temp2[1]; 530 if (temp2[0] == 'y') lng = temp2[1]; 531 if (temp2[0] == 'z') zoom = temp2[1]; 532 if (temp2[0] == 's0') { 533 jQuery('#slider_0').slider('option', 'value', temp2[1]); 534 jQuery('#slider_0 a').html(temp2[1]); 535 } 536 if (temp2[0] == 's1') { 537 jQuery('#slider_1').slider('option', 'value', temp2[1]); 538 jQuery('#slider_1 a').html(temp2[1]); 539 } 540 if (temp2[0] == 's2') { 541 jQuery('#slider_2').slider('option', 'value', temp2[1]); 542 jQuery('#slider_2 a').html(temp2[1]); 543 } 544 if (temp2[0] == 's3') { 545 jQuery('#slider_3').slider('option', 'value', temp2[1]); 546 jQuery('#slider_3 a').html(temp2[1]); 547 } 548 if (temp2[0] == 't') { 549 var pole = temp2[1].split(','); 550 if (pole.indexOf('nehrane') == -1) jQuery('#filter_nehrane:visible').attr('checked', false); 551 if (pole.indexOf('nedohrane') == -1) jQuery('#filter_nedohrane:visible').attr('checked', false); 552 if (pole.indexOf('odehrane') == -1) jQuery('#filter_odehrane:visible').attr('checked', false); 553 } 554 if (temp2[0] == 'f1' && temp2[1] == 't') jQuery("#filter_vozickar").attr('checked', true); 555 if (temp2[0] == 'f2' && temp2[1] == 't') jQuery("#filter_kocarek").attr('checked', true); 556 if (temp2[0] == 'f3' && temp2[1] == 't') jQuery("#filter_snih").attr('checked', true); 557 if (temp2[0] == 'f4' && temp2[1] == 't') jQuery("#filter_kolo").attr('checked', true); 558 if (temp2[0] == 'o') { 559 default_sort_vzd = false;
560 jQuery("#filter_sort").val(temp2[1]); 561 jQuery('#filter_sort').msDropDown(); 562 } 563 } 564 if (lat > 0 && lng > 0 && zoom > 0) { 565 //map.setCenter(SMap.Coords.fromWGS84(lng, lat)); 566 //map.setZoom(parseInt(zoom)); 567 } 568 } 569 }, 570 reloadSeznam: function (source) { 571 listenRedraw = false; 572 var html = ""; 573 var pages = []; 574 source = source || ''; 575 576 var onlyvisible = false; 577 var dw = 0; 578 var dh = 0; 579 if (source == 'map') { 580 onlyvisible = true; 581 var size = map.getSize(); /* port size */ 582 var half = new SMap.Pixel(Math.round(size.x / 2), Math.round(size.y / 2)); 583 dw = half.x; 584 dh = half.y; 585 } 586 587 var container = jQuery('#geosrandy_container'); 588 container.addClass("loading"); 589 590 var typy = []; 591 if (jQuery('#filter_nehrane:checked').length > 0) typy.push('nehrane'); 592 if (jQuery('#filter_nedohrane:checked').length > 0) typy.push('nedohrane'); 593 if (jQuery('#filter_odehrane:checked').length > 0) typy.push('odehrane'); 594 595 var atributy = []; 596 var tpole = jQuery('.geosranda_ikona.checked'); 597 if (tpole.length > 0) { 598 for (i = 0; i < tpole.length; i++) { 599 atributy.push(parseInt(tpole[i].id.replace('geosranda_ikona_', ''))); 600 } 601 } 602 603 var counter = 1; 604 var akt_html = ''; 605 var l = this.items.length; 606 var points = []; 607 var vybrane = []; 608 for (i = 0; i < l; i++) { 609 // otestovat, jestli vyhovuje filtrum 610 var zobrazit = true; 611 var faktory_vyhovuje = true; 612 var faktory = this.items[i].getFaktory(); 613 for (j = 0; j < this.sliders.length; j++) { 614 if (this.sliders[j] > faktory[j]) faktory_vyhovuje = false;
615 } 616 if (!faktory_vyhovuje) zobrazit = false; 617 618 var temp = jQuery("#filter_vozickar:checked").length; 619 if (temp > 0 && !this.items[i].getVozickar()) zobrazit = false; 620 var temp = jQuery("#filter_kocarek:checked").length; 621 if (temp > 0 && !this.items[i].getKocarek()) zobrazit = false; 622 var temp = jQuery("#filter_snih:checked").length; 623 if (temp > 0 && !this.items[i].getSnih()) zobrazit = false; 624 var temp = jQuery("#filter_kolo:checked").length; 625 if (temp > 0 && !this.items[i].getKolo()) zobrazit = false; 626 627 if (jQuery.inArray(this.items[i].getTyp(), typy) < 0) zobrazit = false; 628 if (atributy.length > 0) { 629 var mamatribut = false; 630 for (j = 0; j < this.items[i].getAtributy().length; j++) { 631 if (atributy.indexOf(this.items[i].getAtributy()[j]) >= 0) mamatribut = true; 632 } 633 if (!mamatribut) zobrazit = false; 634 } 635 636 637 if (zobrazit) { 638 if (!this.items[i].isMarkerAdded()) { 639 this.items[i].setMarkerAdded(true); 640 //vrstva.addMarker(this.items[i].getMarker()); 641 markers.addLayer(this.items[i].getMarker()); 642 } 643 //points.push(this.items[i].getMarker().getCoords()); 644 } else { 645 if (this.items[i].isMarkerAdded()) { 646 this.items[i].setMarkerAdded(false); 647 //vrstva.removeMarker(this.items[i].getMarker()); 648 //this.items[i].getMarker().remove(); 649 markers.removeLayer(this.items[i].getMarker()); 650 } 651 continue; 652 } 653 654 if (onlyvisible) { 655 // chceme jen objekty, kde je viditelny marker 656 let latlng = this.items[i].getMarker().getLatLng(); 657 let layerPoint = map.latLngToLayerPoint(latlng); 658 console.log('layerPoint',layerPoint); 659 var pos = layerPoint; 660 var dx = Math.abs(pos.x); 661 var dy = Math.abs(pos.y); 662 var visible = !(dx > dw || dy > dh); 663 if (!visible) continue; 664 } 665 666 667 vybrane.push(this.items[i]); 668 } 669 670 var sort = jQuery('#filter_sort').val(); 671 //console.log("sorting: " + sort); 672 vybrane = vybrane.sort(function (a, b) { 673 if (sort == 'vzdalenost') { 674 if (a.getVzdalenost() < b.getVzdalenost()) return -1; 675 else if (a.getVzdalenost() > b.getVzdalenost()) return 1; 676 else return 0; 677 } 678 if (sort == 'cas_avg') { 679 if (a.getCasAvg() < b.getCasAvg()) return -1; 680 else if (a.getCasAvg() > b.getCasAvg()) return 1; 681 else return 0; 682 } 683 if (sort == 'body') { 684 if (a.getBody() < b.getBody()) return 1; 685 else if (a.getBody() > b.getBody()) return -1; 686 else return 0; 687 } 688 if (sort == 'created') { 689 if (a.getCreated() < b.getCreated()) return 1; 690 else if (a.getCreated() > b.getCreated()) return -1; 691 else return 0; 692 } 693 if (sort == 'ziskane_body') { 694 if (a.getZiskaneBody() < b.getZiskaneBody()) return 1; 695 else if (a.getZiskaneBody() > b.getZiskaneBody()) return -1; 696 else return 0; 697 } 698 }); 699 700 for (i = 0; i < vybrane.length; i++) { 701 akt_html += vybrane[i].getHtml(); 702 if (counter++ >= this.na_stranku) { 703 pages.push(akt_html); 704 akt_html = ''; 705 counter = 1; 706 } 707 } 708 709 710 if (!onlyvisible) { 711 //var res = map.computeCenterZoom(points); 712 //if (res[1] > 13) res[1] = 13; 713 //map.setCenterZoom(res[0], res[1]); 714 } 715 716 717 if (akt_html != '') pages.push(akt_html); 718 719 var pagination = '<ul>'; 720 for (i = 0; i < pages.length; i++) { 721 html += '<div class="geosranda_page" id="geosranda_page_' + i + '"'; 722 if (i > 0) html += ' style="display: none;"'; 723 html += '>'; 724 html += pages[i]; 725 html += '</div>'; 726 pagination += '<li id="geosrandy_pagination_' + i + '" class="geosrandy_pagination' + (i == 0 ? ' active' : '') + '"><a href="javascript:geosrandyChangePage(' + i + ')">' + (i + 1) + '</a></li>'; 727 } 728 pagination += '</ul>'; 729 730 html += '<div class="pagination">'; 731 732 html += '<div class="vyhledano">' + resources['vyhledano'] + ': ' + vybrane.length + '</div>' 733 if (pages.length > 1) html += pagination; 734 735 html += '<div class="clear"></div></div>'; 736 737 container.removeClass("loading"); 738 jQuery('#geosrandy_container').html(html); 739 listenRedraw = true; 740 vybrane = null; 741 742 //update hash 743 if (true) { 744 var center = map.getCenter(); 745 console.log('center',center.lat); 746 var zoom = map.getZoom(); 747 //var temp = center.toWGS84(); 748 var t = typy.toString(); 749 var str = 'x=' + center.lng + '&y=' + center.lat + '&z=' + zoom + '&t=' + t; 750 for (j = 0; j < this.sliders.length; j++) { 751 str += '&s' + j + '=' + this.sliders[j]; 752 } 753 var temp = jQuery("#filter_vozickar:checked").length; 754 if (temp > 0) str += '&f1=t'; 755 else str += '&f1=f'; 756 var temp = jQuery("#filter_kocarek:checked").length; 757 if (temp > 0) str += '&f2=t'; 758 else str += '&f2=f'; 759 var temp = jQuery("#filter_snih:checked").length; 760 if (temp > 0) str += '&f3=t'; 761 else str += '&f3=f'; 762 var temp = jQuery("#filter_kolo:checked").length; 763 if (temp > 0) str += '&f4=t'; 764 else str += '&f4=f'; 765 str += '&o=' + jQuery('#filter_sort').val(); 766 document.location.hash = str; 767 } 768 } 769} 770 771 772function geosrandyChangePage(i) { 773 var container = jQuery('#geosrandy_container'); 774 container.addClass("loading"); 775 jQuery('.geosranda_page').hide(); 776 jQuery('#geosranda_page_' + i).show(); 777 jQuery('.geosrandy_pagination').removeClass('active'); 778 jQuery('#geosrandy_pagination_' + i).addClass('active'); 779 container.removeClass('loading'); 780} 781 782function changeTab(i) { 783 jQuery('.block5_right').hide(); 784 jQuery('#tab_content_' + i).show(); 785 jQuery('.block5_left li').removeClass('bg'); 786 jQuery('#tab_' + i).addClass('bg'); 787} 788 789 790 791var ukol_aktivni = 0; 792var ukol_celkem = 5; 793 794function nextUkol() { 795 if (ukol_celkem > 1) { 796 var last = ukol_aktivni; 797 ukol_aktivni++; 798 if (ukol_aktivni >= ukol_celkem) ukol_aktivni = 0; 799 setUkol(last); 800 } 801} 802 803function prevUkol() { 804 if (ukol_celkem > 1) { 805 var last = ukol_aktivni; 806 ukol_aktivni--; 807 if (ukol_aktivni < 0) ukol_aktivni = ukol_celkem - 1; 808 setUkol(last); 809 } 810} 811 812function setUkol(last) { 813 var lastEl = jQuery('#ukol_' + last); 814 var newEl = jQuery('#ukol_' + ukol_aktivni); 815 lastEl.css('z-index', 10); 816 newEl.css('z-index', 9); 817 newEl.show(); 818 jQuery('#ukol_' + last).hide("fade", {}, 500); 819} 820 821var nukol_aktivni = 0;
822var nukol_celkem = 5; 823 824function nextNUkol() { 825 if (nukol_celkem > 1) { 826 var last = nukol_aktivni; 827 nukol_aktivni++; 828 if (nukol_aktivni >= nukol_celkem) nukol_aktivni = 0; 829 setNUkol(last); 830 } 831} 832 833function prevNUkol() { 834 if (nukol_celkem > 1) { 835 var last = nukol_aktivni; 836 nukol_aktivni--; 837 if (nukol_aktivni < 0) nukol_aktivni = nukol_celkem - 1; 838 setNUkol(last); 839 } 840} 841 842function setNUkol(last) { 843 var lastEl = jQuery('#nukol_' + last); 844 var newEl = jQuery('#nukol_' + nukol_aktivni); 845 lastEl.css('z-index', 10); 846 newEl.css('z-index', 9); 847 newEl.show(); 848 jQuery('#nukol_' + last).hide("fade", {}, 500); 849} 850 851var aktivity_aktivni = 0; 852var aktivity_celkem = 4; 853 854function nextAktivita() { 855 var last = aktivity_aktivni; 856 aktivity_aktivni++; 857 if (aktivity_aktivni >= aktivity_celkem) aktivity_aktivni = 0; 858 setAktivita(last, "right"); 859} 860 861function prevAktivita() { 862 var last = aktivity_aktivni; 863 aktivity_aktivni--; 864 if (aktivity_aktivni < 0) aktivity_aktivni = aktivity_celkem - 1; 865 setAktivita(last, "left"); 866} 867 868function setAktivita(last, dir) { 869 var lastEl = jQuery('#aktivity_' + last); 870 var newEl = jQuery('#aktivity_' + aktivity_aktivni); 871 lastEl.css('z-index', 9); 872 newEl.css('z-index', 10); 873 newEl.hide(); 874 jQuery('#aktivity_' + aktivity_aktivni).show("slide", { direction: dir }, 500, function () { lastEl.hide() }); 875} 876 877function distance(lat1, lon1, lat2, lon2) { 878 var radlat1 = Math.PI * lat1 / 180; 879 var radlat2 = Math.PI * lat2 / 180; 880 var radlon1 = Math.PI * lon1 / 180; 881 var radlon2 = Math.PI * lon2 / 180; 882 var theta = lon1 - lon2; 883 var radtheta = Math.PI * theta / 180; 884 var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta); 885 dist = Math.acos(dist); 886 dist = dist * 180 / Math.PI; 887 dist = dist * 60 * 1.1515; 888 dist = dist * 1.609344; 889 return dist * 1000; 890} 891 892 893function thumbDown(id_ukol_pokus, id_stav, own) { 894 thumbRate(id_ukol_pokus, id_stav, -1, own); 895} 896 897function thumbUp(id_ukol_pokus, id_stav, own) { 898 thumbRate(id_ukol_pokus, id_stav, 1, own); 899} 900 901function thumbRate(id_ukol_pokus, id_stav, rate, own) { 902 jQuery.post('/resource/ajax.php', { 903 akce: 'thumbRate', 904 id_ukol_pokus: id_ukol_pokus, 905 id_stav: id_stav, 906 rate: rate 907 }, function (data) { 908 if (data == "1") { 909 var html = jQuery('#zaznam_hodnoceni_' + id_ukol_pokus + '_' + id_stav).html(); 910 var bodu = parseInt(html); 911 if (rate == 1) { 912 bodu++; 913 jQuery('#zaznam_span_up_' + id_ukol_pokus + '_' + id_stav).show().addClass('active'); 914 jQuery('#zaznam_a_up_' + id_ukol_pokus + '_' + id_stav).hide(); 915 jQuery('#zaznam_span_down_' + id_ukol_pokus + '_' + id_stav).show(); 916 jQuery('#zaznam_a_down_' + id_ukol_pokus + '_' + id_stav).hide(); 917 if (own) alert(resources['own_hodnoceni'] + ' BG'); 918 } 919 else { 920 bodu--; 921 jQuery('#zaznam_span_down_' + id_ukol_pokus + '_' + id_stav).show().addClass('active'); 922 jQuery('#zaznam_a_down_' + id_ukol_pokus + '_' + id_stav).hide(); 923 jQuery('#zaznam_span_up_' + id_ukol_pokus + '_' + id_stav).show(); 924 jQuery('#zaznam_a_up_' + id_ukol_pokus + '_' + id_stav).hide(); 925 } 926 if (bodu > 0) { 927 jQuery('#zaznam_hodnoceni_html_' + id_ukol_pokus + '_' + id_stav).removeClass('zaznam_hodnoceni_red').removeClass('zaznam_hodnoceni_gray').addClass('zaznam_hodnoceni_green').html('+ ' + bodu); 928 } else if (bodu < 0) { 929 jQuery('#zaznam_hodnoceni_html_' + id_ukol_pokus + '_' + id_stav).removeClass('zaznam_hodnoceni_green').removeClass('zaznam_hodnoceni_gray').addClass('zaznam_hodnoceni_red').html('- ' + Math.abs(bodu)); 930 } else jQuery('#zaznam_hodnoceni_html_' + id_ukol_pokus + '_' + id_stav).removeClass('zaznam_hodnoceni_green').removeClass('zaznam_hodnoceni_red').addClass('zaznam_hodnoceni_gray').html('0'); 931 } 932 }); 933} 934 935function schovej2(co) { 936 var item = document.getElementById(co); 937 var link = document.getElementById(co + 'img'); 938 if (item == null) return false;
939 if (item.style.display == 'none') { 940 item.style.display = ''; 941 link.className = "icon_minus"; 942 } 943 else { 944 item.style.display = 'none'; 945 link.className = "icon_plus"; 946 } 947} 948 949function shareLink(id1, id2) { 950 jQuery('#sharelink_' + id1 + '_' + id2).toggle(); 951 jQuery('#sharelink_' + id1 + '_' + id2 + ' input').focus().select(); 952} 953 954function fullscreenMap() { 955 jQuery('#geosranda_map').toggleClass('fullscreen'); 956 jQuery('#fullscreen_map').toggleClass('fa-arrows-alt').toggleClass('fa-times'); 957 mapa.syncPort(); 958}
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.