1/* 2 * 3 * NPU 4 * Author: Martin Winkler @ PORTA 5 * url: http://www.portadesign.cz/ 6 * 7 */ 8 9/**************************************************************************************************************************************************************************************** 10DOCUMENT READY 11****************************************************************************************************************************************************************************************/ 12 13var lastSentFormData = null; 14var disableHashChange = false; 15var sliders = []; 16 17function filterClearButton() { 18 // Form filter clearing 19 $('.form-filter:not(.no-clear-btn)').append('<a href="javascript:void(0)" class="clear">ZruÅ¡it filtr</a>'); 20 $('.form-filter .clear').click(function() { 21 var form = $(this).closest('.form-filter'); 22 if (form.length) { 23 form[0].reset(); 24 form.find('input[type="checkbox"]').trigger('change'); 25 $.uniform.update(); 26 form.submitForm(); 27 } 28 }); 29} 30 31$(document).ready(function($){ 32 33 svg4everybody(); 34 35 // Gallery isotope 36 $(window).load(function(){ 37 initIsotope(); 38 }); 39 40 // Count to 41 var statsFinish = 0; 42 $(window).on('load scroll',function() { 43 if ( statsFinish == 0 ) { 44 var num = $('.stat-num'); 45 if ( inViewport(num) ) { 46 num.countTo(); 47 statsFinish = 1 48 } 49 } 50 }); 51 52 // Scrollovánà ke kotvÄ 53 $('.to-anchor').scrollToAnchor(); 54 55 // Match height 56 $(window).on('load resizeEnd',function() { 57 matchHeightInit(); 58 }); 59 60 // Uniform 61 $(window).on('load resizeEnd',function() { 62 $('.uf').uniform(); 63 }); 64 65 // Toggle - active class on checked checkbox 66 $('form.std input[type="checkbox"],form.std input[type="radio"]').on('change', function(){ 67 if ( $(this).is(':checked') ) { 68 $('[name="'+ $(this).attr('name') +'"]').closest('.toggle').removeClass('active'); 69 $(this).closest('.toggle').addClass('active'); 70 $(this).closest('span').addClass('checked'); 71 } 72 else { 73 $(this).closest('.toggle').removeClass('active'); 74 $(this).closest('span').removeClass('checked'); 75 } 76 }); 77 $('form.std input[type="checkbox"],form.std input[type="radio"]').change(); 78 79 // Comparison photo 80 $('.comparison').twentytwenty(); 81 82 // Hints 83 $('.properties .item').qtip({ 84 position: { 85 my: 'bottom center', 86 at: 'top center', 87 adjust: { 88 x: 0, 89 y: 0 90 }, 91 viewport: true 92 }, 93 style: { 94 tip: { 95 width: 20, 96 height: 10 97 }, 98 classes: 'qtip-dark' 99 } 100 }); 101 102 // Hints dark 103 $('.cal-event').qtip({ 104 position: { 105 my: 'bottom center', 106 at: 'top center', 107 adjust: { 108 x: 0, 109 y: -10 110 }, 111 viewport: true 112 }, 113 style: { 114 tip: { 115 width: 20, 116 height: 10 117 }, 118 classes: 'qtip-dark' 119 } 120 }); 121 122 // Dropdown v hlaviÄce 123 $('.drop-trig').each(function() { 124 $(this).qtip({ 125 content: { 126 text: $('#' + $(this).attr('data-id')) 127 }, 128 show: { 129 event: 'click' 130 }, 131 hide: { 132 event: 'unfocus click' 133 }, 134 position: { 135 my: 'top center', 136 at: 'bottom center', 137 viewport: $(window), 138 adjust: { 139 screen: true 140 }, 141 adjust: { 142 x: 0, 143 y: 10 144 } 145 }, 146 style: { 147 tip: { 148 width: 17, 149 height: 9 150 }, 151 classes: 'qtip-dropdown' 152 } 153 }).bind('click', function(event){ event.preventDefault(); return false; }); 154 }); 155 156 // Show/hide 157 $('.sh-trig').toggler(); 158 159 // Show more once 160 $('.sh-trig-once').toggler({ 161 hideTrigger: true, 162 scrollToContent: true 163 }); 164 165 // Show/hide text (char limit) 166 $('.char-limit').readmore({ 167 speed: 75, 168 lessLink: '<div class="intro last" style="padding-top: 15px;"><a href="#">Skrýt</a></div>', 169 moreLink: '<div class="intro last" style="padding-top: 15px;"><a href="#">Zobrazit vÃce</a></div>', 170 collapsedHeight: 200 171 }); 172 173 // Scrollspy 174 $(".scrollspy").scrollSpy(); 175 176 // Fixer 177 $(window).on('load scroll',function() { 178 if ( $('.fixer').length ) { 179 $('.fixer-start').each(function() { 180 var scrollTop = $(window).scrollTop(); 181 var winH = $(window).height(); 182 var fixElWrapper = $(this); 183 var fixEl = fixElWrapper.find('.fixer'); 184 var offset = 0; 185 if ( fixEl.attr('data-offset') ) { 186 var offset = fixEl.data('offset'); 187 } 188 189 var fixElWrapperTop = fixElWrapper.offset().top + offset; 190 191 var fixElHeight = fixEl.height(); 192 var end = $('.fixer-end').height() + $('.fixer-end').offset().top - fixEl.height(); 193 194 // Top panel 195 if ( scrollTop > fixElWrapperTop ) { 196 fixEl.addClass('fixed'); 197 // Hide in the end 198 if ( scrollTop > end ) { 199 fixEl.fadeOut(); 200 } 201 else { 202 fixEl.fadeIn(); 203 } 204 } 205 else { 206 fixEl.removeClass('fixed'); 207 } 208 }); 209 } 210 }); 211 212 // Tickets show/hide 213 $('.tickets .item').each(function(){ 214 var item = $(this); 215 var btn = item.find('.show-trigger'); 216 var content = item.find('.sh-content'); 217 218 btn.click(function() { 219 if ( ! content.hasClass('active')) { 220 content.show().addClass('active'); 221 btn.find('.text').text(btn.data('less')); 222 $(window).trigger('resize'); 223 } 224 else { 225 content.hide().removeClass('active'); 226 btn.find('.text').text(btn.data('more')); 227 } 228 }); 229 }); 230 231 // File list icons 232 $(".file-list a[href$='.doc'],.file-list a[href$='.docx']").addClass("doc"); 233 $(".file-list a[href$='.xls'],.file-list a[href$='.xlsx']").addClass("xls"); 234 $(".file-list a[href$='.pdf']").addClass("pdf"); 235 $(".file-list a[href$='.zip'],.file-list a[href$='.rar']").addClass("zip"); 236 $(".file-list a[href$='.jpg'],.file-list a[href$='.jpeg']").addClass("jpg"); 237 238 $(".dl-list a[href$='.doc'],.dl-list a[href$='.docx']").closest('.item').addClass("doc"); 239 $(".dl-list a[href$='.xls'],.dl-list a[href$='.xlsx']").closest('.item').addClass("xls"); 240 $(".dl-list a[href$='.pdf']").closest('.item').addClass("pdf"); 241 $(".dl-list a[href$='.zip'],.dl-list a[href$='.rar']").closest('.item').addClass("zip"); 242 $(".dl-list a[href$='.jpg'],.dl-list a[href$='.jpeg']").closest('.item').addClass("jpg"); 243 244 filterClearButton(); 245 246 // Perfect scrollbar 247 $('.std-nav .sub-nav-item').perfectScrollbar(); 248 249 // External icon 250 $('a[target="_blank"]').each(function() { 251 if ( $(this).children('img').length > 0 ) { 252 $(this).addClass('no-after-icon'); 253 } 254 }); 255 $('.footer a[target="_blank"]').each(function() { 256 $(this).addClass('no-after-icon'); 257 }); 258 $('a[target="_blank"]:not(.no-after-icon)').each(function() { 259 $(this).append('<svg class="icon icon-external"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/static/svg/svg-sprite.svg#icon-external"></use></svg>'); 260 }); 261 262 // Filter topic 263 $(window).on('load',function() { 264 if( $('.filter-topic').length > 0 ) { 265 var checkbox = $('.filter-topic input[type="checkbox"]'); 266 267 checkbox.on('change',function() { 268 if( $(this).is(':checked') ) { 269 $(this).closest('.cell').find('label').addClass('checked'); 270 } 271 else { 272 $(this).closest('.cell').find('label').removeClass('checked'); 273 } 274 }).trigger('change'); 275 } 276 }); 277 278 /********************************************** 279 DATEPICKER 280 **********************************************/ 281 282 $(function($){
283 $.datepicker.regional['cs'] = { 284 renderer: $.ui.datepicker.defaultRenderer, 285 monthNames: ['leden','únor','bÅezen','duben','kvÄten','Äerven','Äervenec','srpen','záÅÃ','ÅÃjen','listopad','prosinec'], 286 monthNamesShort: ['led','úno','bÅe','dub','kvÄ','Äer', 287 'Ävc','srp','záÅ','ÅÃj','lis','pro'], 288 dayNames: ['nedÄle', 'pondÄlÃ', 'úterý', 'stÅeda', 'Ätvrtek', 'pátek', 'sobota'], 289 dayNamesShort: ['ne', 'po', 'út', 'st', 'Ät', 'pá', 'so'], 290 dayNamesMin: ['ne','po','út','st','Ät','pá','so'], 291 dateFormat: 'dd.mm.yyyy', 292 firstDay: 1, 293 prevText: '<DÅÃve', prevStatus: '', 294 prevJumpText: '<<', prevJumpStatus: '', 295 nextText: 'PozdÄji>', nextStatus: '', 296 nextJumpText: '>>', nextJumpStatus: '', 297 currentText: 'NynÃ', currentStatus: '', 298 todayText: 'NynÃ', todayStatus: '', 299 clearText: '-', clearStatus: '', 300 closeText: 'ZavÅÃt', closeStatus: '', 301 yearStatus: '', monthStatus: '', 302 weekText: 'Týd', weekStatus: '', 303 dayStatus: 'DD d MM', 304 defaultStatus: '', 305 isRTL: false 306 }; 307 $.datepicker.setDefaults($.datepicker.regional['cs']); 308 }); 309 310 $(function() { 311 $("#seasonSince").datepicker({ 312 showOn: "both", 313 buttonImage: "/static/img/jquery-ui/datepicker/datepicker.svg", 314 /*buttonImageOnly: true,*/ 315 dateFormat: 'd. m. yy', 316 onClose: function( selectedDate ) { 317 $( "#seasonUntil" ).datepicker( "option", "minDate", selectedDate ); 318 } 319 }); 320 $("#seasonUntil").datepicker({ 321 showOn: "both", 322 buttonImage: "/static/img/jquery-ui/datepicker/datepicker.svg", 323 /*buttonImageOnly: true,*/ 324 dateFormat: 'd. m. yy', 325 onClose: function( selectedDate ) { 326 $( "#seasonSince" ).datepicker( "option", "maxDate", selectedDate ); 327 } 328 }); 329 }); 330 331 /********************************************** 332 HEADER 333 **********************************************/ 334 335 // Fixed header 336 if ( $('.el-fix').length ) { 337 (function() { 338 var header = document.querySelector(".el-fix"); 339 new Headroom(header, { 340 tolerance: { 341 down : 80, 342 up: 20 343 }, 344 offset: $('.el-fix-wrap').offset().top, 345 onPin : function() { 346 $(document).trigger('onPin'); 347 }, 348 onUnpin : function() { 349 $(document).trigger('onUnpin'); 350 } 351 }).init(); 352 }()); 353 354 // Body fixed header 355 $(window).on('load resizeEnd',function() { 356 $('.el-fix-wrap').css({ height: $('.el-fix').height() }); 357 }); 358 } 359 360 // Search css hack 361 $('.search input.text').on('focus blur',function() { 362 if ( $(this).is(':focus') ) { 363 $(this).closest('.search').addClass('focus'); 364 } 365 else { 366 $(this).closest('.search').removeClass('focus'); 367 } 368 }); 369 370 // Search mobile 371 $('.search-btn').click(function() { 372 var searchBtn = $(this); 373 var search = $('.search'); 374 if ( search.is(':hidden') ) { 375 searchBtn.addClass('active'); 376 search.addClass('active'); 377 } 378 else { 379 searchBtn.removeClass('active'); 380 search.removeClass('active'); 381 } 382 }); 383 $(document).on('onPin onUnpin',function() { 384 $('.search-btn').removeClass('active'); 385 $('.search').removeClass('active'); 386 }); 387 388 /********************************************** 389 TABS 390 **********************************************/ 391 392 // Záložky - tipy na výlet 393 $(function() { 394 $('.tabs-trip').easytabs({ 395 tabs: ".tab-nav-trip > ul > li:not(.disabled)", 396 panelContext: $('.tab-content-trip'), 397 updateHash: false 398 }); 399 }); 400 401 $(function() { 402 // Záložky standartnà 403 initStdTabs(); 404 }); 405 406 //skryje intro taby 407 if (location.hash) { 408 $('.tab.tab-intro').hide(); 409 } 410 411 $(window).on('load resizeEnd',function() { 412 $('.tab.active').each(function() { 413 var id = $(this).attr('id'); 414 415 $('.tab-nav-mobile a').removeClass('active'); 416 $('.tab-nav-mobile a[href="#'+id+'"]').addClass('active'); 417 }); 418 }); 419 420 /********************************************** 421 SUB NAVIGATION 422 **********************************************/ 423 424 $('.std-nav a[data-id]').click(function(e) { 425 var trigger = $(this); 426 var subNavClass = trigger.attr('data-id'); 427 var subNav = $('#'+subNavClass); 428 429 if ( ! trigger.hasClass('opened') ) { 430 showNav(subNav,trigger); 431 } 432 else { 433 hideNav(subNav,trigger); 434 } 435 e.preventDefault(); 436 }); 437 438 $('.sub-nav .close').click(function() { 439 var nav = $(this).closest('.sub-nav-item'); 440 var trigger = $('[data-id="'+ nav.attr('id') +'"]') 441 hideNav(nav,trigger); 442 }); 443 444 $(document).on('click onUnpin onUnpin',function(e) { 445 if ( ! $('.sub-nav-item.opened').is(e.target) && $('.sub-nav-item.opened').has(e.target).length === 0 && $('.std-nav > ul > li').has(e.target).length === 0) { 446 $('.sub-nav-item').removeClass('opened'); 447 $('.std-nav .opened').removeClass('opened'); 448 449 $('.logo-holder').removeClass('small'); 450 451 $('.content-overlay').remove(); 452 } 453 }); 454 455 function showNav(nav,trigger) { 456 trigger.closest('li').siblings('li').find('a.opened').trigger('click'); 457 trigger.closest('ul').find('a.opened').trigger('click'); 458 459 if (trigger.hasClass('main-link')) { // pouze hlavnà položky menu 460 if ($(trigger).siblings('.sub-nav-wrap').find('li.active').length ) { // pouze navigace s aktivnà položkou 461 462 // Zobrazà aktuálnà panel a vÅ¡echny rodiÄe 463 // TODO: zcyklit 464 var id = $('.sub-nav-item').find('li.active').closest('.sub-nav-item').addClass('opened').attr('id'); 465 var link = $('[data-id="'+ id +'"]:not(.main-link)'); 466 link.closest('.sub-nav-item').addClass('opened'); 467 link.closest('li').addClass('active'); 468 link.addClass('opened'); 469 470 var id = $('.sub-nav-item').find('li.active').closest('.sub-nav-item').addClass('opened').attr('id'); 471 var link = $('[data-id="'+ id +'"]:not(.main-link)'); 472 link.closest('.sub-nav-item').addClass('opened'); 473 link.closest('li').addClass('active'); 474 link.addClass('opened'); 475 476 var id = $('.sub-nav-item').find('li.active').closest('.sub-nav-item').addClass('opened').attr('id'); 477 var link = $('[data-id="'+ id +'"]:not(.main-link)'); 478 link.closest('.sub-nav-item').addClass('opened'); 479 link.closest('li').addClass('active'); 480 link.addClass('opened'); 481 482 $('.sub-nav-item').find('li.active').find('a').addClass('opened'); 483 } 484 } 485 486 nav.addClass('opened'); 487 trigger.addClass('opened'); 488 489 $('.sub-nav-item.opened').height('auto'); 490 $('.sub-nav-item.opened').matchHeight(); 491 $('.sub-nav').scroll(); 492 493 // Logo zmenÅ¡it 494 $('.logo-holder').addClass('small'); 495 496 // PÅidat overlay 497 if ( ! $('.content-overlay').length > 0 ) { 498 $('.content').append('<div class="content-overlay"></div>'); 499 $('.content-overlay').addClass('active'); 500 } 501 } 502 503 function hideNav(nav,trigger) { 504 nav.removeClass('opened').nextAll().removeClass('opened').find('a').removeClass('opened'); 505 nav.nextAll().find('a').removeClass('opened'); 506 507 nav.find('a').removeClass('opened'); 508 trigger.removeClass('opened'); 509 510 $('.sub-nav-item.opened').height('auto'); 511 $('.sub-nav-item.opened').matchHeight(); 512 513 // Odstranit overlay, logo defaultnÄ 514 if ( ! $('.sub-nav-item').hasClass('opened') ) { 515 $('.content-overlay').remove(); 516 $('.logo-holder').removeClass('small'); 517 } 518 } 519
520 /********************************************** 521 RESIZE END / SCROLL END 522 **********************************************/ 523 524 var resizeEnd; 525 $(window).on('resize', function() { 526 clearTimeout(resizeEnd); 527 resizeEnd = setTimeout(function() { 528 $(window).trigger('resizeEnd'); 529 }, 300); 530 }); 531 532 var scrollEnd; 533 $(window).on('scroll', function() { 534 clearTimeout(scrollEnd); 535 scrollEnd = setTimeout(function() { 536 $(window).trigger('scrollEnd'); 537 }, 100); 538 }); 539 540 /********************************************** 541 FLASH MESSAGES 542 **********************************************/ 543 544 // Close flash messages 545 closeFM(); 546 547 /********************************************** 548 FANCYBOX 549 **********************************************/ 550 551 defaultFancyboxConfig = { 552 width: 'auto', 553 height: 230, 554 padding: 0, 555 margin: 10, 556 autoSize: true, 557 autoResize: true, 558 autoHeight: true, 559 autoWidth: true, 560 fitToView: true, 561 openMethod: 'dropIn', 562 openSpeed: 250, 563 closeMethod: 'dropOut', 564 closeSpeed: 150, 565 tpl: { 566 wrap: '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 567 closeBtn : '<a title="ZavÅÃt" class="fancybox-item fancybox-close" href="javascript:;"><div class="slider-arrow slider-arrow--right"><svg class="icon icon-cross"><use xlink:href="/static/svg/svg-sprite.svg#icon-cross" /></svg></div></a>' 568 }, 569 beforeShow: function() { 570 $(window).trigger('resize'); 571 } 572 }; 573 574 imageFancyboxConfig = { 575 type: 'image', 576 width: 'auto', 577 height: 'auto', 578 padding: 0, 579 margin: 50, 580 autoSize: true, 581 autoResize: true, 582 autoHeight: true, 583 autoWidth: true, 584 fitToView: true, 585 openMethod: 'dropIn', 586 openSpeed: 250, 587 closeMethod: 'dropOut', 588 closeSpeed: 150, 589 tpl: { 590 closeBtn : '<a title="ZavÅÃt" class="fancybox-item fancybox-close" href="javascript:;"><div class="slider-arrow slider-arrow--right"><svg class="icon icon-cross"><use xlink:href="/static/svg/svg-sprite.svg#icon-cross" /></svg></div></a>', 591 next : '<a title="DalÅ¡Ã" class="fancybox-nav fancybox-next" href="javascript:;"><div class="slider-arrow slider-arrow--right"><svg height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g stroke="#d92505" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" fill="none"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></div></svg>\n</a>', 592 prev : '<a title="PÅedchozÃ" class="fancybox-nav fancybox-prev" href="javascript:;"><div class="slider-arrow slider-arrow--left"><svg height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g fill="none" transform="matrix(-1 0 0 1 19 0)" stroke="#d92505" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></svg></div>\n</a>' 593 }, 594 iframe: { 595 preload: true, 596 allow: 'geolocation', 597 geolocation: true 598 } 599 }; 600 601 confirmationFancyboxConfig = $.extend(true, {}, defaultFancyboxConfig); 602 603 // Fancybox 604 if ($.fn.fancybox) { 605 606 // Standard fancybox 607 $('.fancybox').fancybox(imageFancyboxConfig); 608 $("a[href$='.jpg']:not(.no-fancybox),a[href$='.jpeg']:not(.no-fancybox),a[href$='.png']:not(.no-fancybox),a[href$='.gif']:not(.no-fancybox),a[href$='.JPG']:not(.no-fancybox),a[href$='.JPEG']:not(.no-fancybox),a[href$='.PNG']:not(.no-fancybox),a[href$='.GIF']:not(.no-fancybox)").fancybox(imageFancyboxConfig); 609 610 // Custom animations 611 (function ($, F) { 612 // Opening animation - fly from the top 613 F.transitions.dropIn = function() { 614 var endPos = F._getPosition(true); 615 616 endPos.top = (parseInt(endPos.top, 10) - 500) + 'px'; 617 endPos.opacity = 0; 618 619 F.wrap.css(endPos).show().animate({ 620 top: '+=500px', 621 opacity: 1 622 }, { 623 duration: F.current.openSpeed, 624 complete: F._afterZoomIn 625 }); 626 }; 627 628 // Closing animation - fly to the top 629 F.transitions.dropOut = function() { 630 F.wrap.removeClass('fancybox-opened').animate({ 631 top: '-=500px', 632 opacity: 0 633 }, { 634 duration: F.current.closeSpeed, 635 complete: F._afterZoomOut 636 }); 637 }; 638 639 // Next gallery item - fly from left side to the center 640 F.transitions.slideIn = function() { 641 var endPos = F._getPosition(true); 642
643 endPos.left = (parseInt(endPos.left, 10) - 200) + 'px'; 644 endPos.opacity = 0; 645 646 F.wrap.css(endPos).show().animate({ 647 left: '+=200px', 648 opacity: 1 649 }, { 650 duration: F.current.nextSpeed, 651 complete: F._afterZoomIn 652 }); 653 }; 654 655 // Current gallery item - fly from center to the right 656 F.transitions.slideOut = function() { 657 F.wrap.removeClass('fancybox-opened').animate({ 658 left: '+=200px', 659 opacity: 0 660 }, { 661 duration: F.current.prevSpeed, 662 complete: function () { 663 $(this).trigger('onReset').remove(); 664 } 665 }); 666 }; 667 668 }(jQuery, jQuery.fancybox)); 669 670 // Modal box 671 $('.modal-trigger').fancybox(defaultFancyboxConfig); 672 673 iframeFancyboxConfig = { 674 type: 'iframe', 675 width: '100%', 676 height: '100%', 677 padding: 0, 678 margin: 10, 679 autoSize: true, 680 autoResize: true, 681 autoHeight: true, 682 autoWidth: true, 683 fitToView: true, 684 openMethod: 'dropIn', 685 openSpeed: 250, 686 closeMethod: 'dropOut', 687 closeSpeed: 150, 688 tpl: { 689 wrap: '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 690 closeBtn: '<a title="ZavÅÃt" class="fancybox-item fancybox-close" href="javascript:;"><div class="slider-arrow slider-arrow--right"><svg class="icon icon-cross"><use xlink:href="/static/svg/svg-sprite.svg#icon-cross" /></svg></div></a>' 691 }, 692 beforeShow: function () { 693 $(window).trigger('resize'); 694 } 695 }; 696 $('.modal-trigger-iframe').fancybox(iframeFancyboxConfig); 697 698 // Configurable hijack popups 699 $('a.configurable-hijack-trigger').each(function() { 700 var active = $(this).attr('data-active'); 701 var hijackName = $(this).attr('data-hijack-name'); 702 var lastModification = $(this).attr('data-last-modification'); 703 var expireDays = parseInt($(this).attr('data-expire-days')); 704 var delay = parseInt($(this).attr('data-delay')) * 1000; 705 var cookie = hijackName + lastModification; 706 var selector = this; 707 708 if ( window.location.search.indexOf(hijackName) >= 0 || (active == '1' && $.cookie(cookie) != 'true') ) { 709 setTimeout(function() { 710 var fancyboxConfig = {}; 711 jQuery.extend(true, fancyboxConfig, defaultFancyboxConfig, { 712 beforeClose: function() { 713 if (expireDays > 0) $.cookie(cookie, 'true', { path: '/', expires: expireDays }); 714 else $.cookie(cookie, 'false'); 715 } 716 }); 717 $(selector).fancybox(fancyboxConfig).trigger('click'); 718 }, delay); 719 } 720 721 $('.fancybox-overlay, .modal-box a').on('click', function(e) { 722 if (expireDays > 0) $.cookie(cookie, 'true', { path: '/', expires: expireDays }); 723 else $.cookie(cookie, 'false'); 724 725 $.fancybox.close(); 726 }); 727 }); 728 } 729 730 /********************************************** 731 SLIDERS 732 **********************************************/ 733 734 // Sudo slider 735 if ($.fn.sudoSlider) { 736 737 // PÅesunuto do fce kvůli afterAjax 738 initSliders(); 739 } 740 741 /********************************************** 742 INIT JS VALIDATION 743 **********************************************/ 744 745 initJsValidation(); 746 747 /********************************************** 748 INIT AJAX 749 **********************************************/ 750 751 $('body').on('click', 'a.ajax', function() { 752 $(this).myAjax($(this).attr('data-to-inject')); 753 return false; 754 }); 755 $('body').on('submit', 'form.ajax', function() { 756 $(this).myAjax($(this).attr('data-to-inject')); 757 return false; 758 }); 759 760 /********************************************** 761 AUTO POPULATE FORMS 762 **********************************************/ 763 764 $('form[data-populate]').each(function(){ 765 $(this).values(); 766 }); 767 768 /********************************************** 769 HASHCHANGE 770 **********************************************/ 771 772 $(window).on('hashchange', function(e) { 773 var hash = location.hash; 774 if (!disableHashChange) { 775 if (hash) { 776 var formData = $.deparam(hash.substr(1)); 777 if (formData.formId) { 778 var formName = '#'+formData.formId.charAt(0).toUpperCase()+formData.formId.slice(1)+'FormType'; 779 if (formData && formData.formId && $(formName).length) { 780 $(formName).values(formData);
781 $(formName).submitForm(); 782 } else if ($(jQuerySelectorEscape(hash)).length) { 783 $(jQuerySelectorEscape(hash)).click(); 784 } 785 } 786 } else if (e.originalEvent && e.originalEvent.oldURL) { 787 hash = e.originalEvent.oldURL.substring(e.originalEvent.oldURL.indexOf('#') + 1); 788 var formData = $.deparam(hash.substr(1)); 789 if (formData && formData.formId && $(formName).length) { 790 var form = $(formName); 791 if ($('#page', form).length) { 792 $('#page', form).val(1); 793 } 794 if ($('#offset', form).length) { 795 $('#offset', form).val(0); 796 } 797 if ($('#day', form).length) { 798 $('#day', form).val(''); 799 } 800 $(form).submitForm(); 801 } 802 } 803 } 804 if (disableHashChange) { 805 disableHashChange = false; 806 } 807 }); 808 809 $(window).hashchange(); 810 811 /****** 812 MERGE LATER FILE STUFF 813 ******/ 814 // used in photo galleries on sight objects 815 $('.shh').each(function() { 816 817 var shh = this; 818 var trig = $(this).find('.shh-trig'); 819 var rawOptions = $(this).attr('data-options'); 820 var options = (rawOptions) ? JSON.parse(rawOptions) : {}; 821 822 var shhh = function(act) { 823 if (act == 'toggle') { 824 var shhList = $(shh).find('.shh-list > div').slice(options.list); 825 shhList.each(function(index) { 826 $(this).fadeIn(function () { 827 if (options.matchHeight && index == (shhList.length - 1)) { 828 matchHeightInit(true); 829 } 830 }); 831 }); 832 if (options.hide === false) { 833 trig.hide(); 834 } else { 835 } 836 } else if (act == 'init') { 837 if (options.list) { 838 if ($(shh).find('.shh-list > div').length <= options.list) trig.hide(); 839 else $(shh).find('.shh-list > div').slice(options.list).each(function() { $(this).hide(); }); 840 } 841 } 842 $(window).resize(); 843 }; 844 845 shhh('init'); 846 847 trig.click(function() { shhh('toggle'); }); 848 }); 849 // set notice FM cookie on close (1 day) 850 $('.fm-notice-set-cookie').click(function() { 851 var wrapper = $(this).closest('.fm-notice-wrapper'); 852 if (wrapper.length && wrapper.attr('id')) { 853 $.cookie('fm-notice-' + wrapper.attr('id'), 'true', { path: '/' }) 854 } 855 }); 856 // show FM notices if no block cookie is set 857 $('.fm-notice-wrapper').each(function() { 858 var wrapper = $(this); 859 if (wrapper.attr('id')) { 860 if ($.cookie('fm-notice-' + wrapper.attr('id')) != 'true') { 861 wrapper.show(); 862 } 863 } 864 }); 865 $('.svg-map.link-map path[data-id]').each(function() { 866 $(this).click(function() { 867 var regionId = $(this).attr('data-id'); 868 var el = $('.link-list a[data-id=' + regionId + ']'); 869 if(el.length > 0 ) { 870 el[0].click(); 871 } 872 }); 873 }); 874 // Active class on dropdown 875 var activeNavigationItems = $('#sub-nav ul.sub-nav a[href="' + document.location.pathname + '"]'); 876 if (!activeNavigationItems.length) { 877 var lastIndexOfSlash = document.location.pathname.lastIndexOf('/'); 878 var tmpUrl = document.location.pathname.substr(0, lastIndexOfSlash); 879 if (lastIndexOfSlash > -1) { 880 activeNavigationItems = $('#sub-nav ul.sub-nav a[href="' + tmpUrl + '"]'); 881 } 882 } 883 if (activeNavigationItems.length) { 884 activeNavigationItems.closest('li').addClass('active'); 885 } 886 // Active class on mobile navigation 887 var activeNavigationItems = $('.mobile-nav a[href="' + document.location.pathname + '"]'); 888 if (!activeNavigationItems.length) { 889 var lastIndexOfSlash = document.location.pathname.lastIndexOf('/'); 890 var tmpUrl = document.location.pathname.substr(0, lastIndexOfSlash); 891 if (lastIndexOfSlash > -1) { 892 activeNavigationItems = $('.mobile-nav a[href="' + tmpUrl + '"]'); 893 } 894 } 895 if (activeNavigationItems.length) { 896 activeNavigationItems.closest('li').addClass('active'); 897 } 898 899}); 900 901/**************************************************************************************************************************************************************************************** 902FUNCTIONS 903****************************************************************************************************************************************************************************************/ 904 905function jQuerySelectorEscape(expression) { 906 return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&'); 907} 908 909function initStdTabs() 910{ 911 $('.tabs-std').each(function() { 912 if (!$(this).attr('data-tabs-initialized')) { 913 $(this).find('.tab-content-std').show(); 914 if ( $(this).hasClass('collapsed') ) { 915 var $collapsed = true; 916 } 917 else { 918 var $collapsed = false;
919 } 920 921 if ( $(this).attr('data-first') == 'true' ) { 922 var $defaultTab = "li:first-child"; 923 } 924 else { 925 var $defaultTab = undefined; 926 } 927 928 $(this).easytabs({ 929 animate: false, 930 tabs: ".tab-nav-std > ul > li", 931 panelContext: $('.tab-content-std'), 932 collapsible: true, 933 collapsedByDefault: $collapsed, 934 defaultTab: $defaultTab, 935 updateHash: true 936 }); 937 938 // PÅi zmÄnÄ nascrolluje na obsah 939 if (!$(this).attr('data-no-scroll')) { 940 $(this).bind('easytabs:after', function(evt, tab, panel, data) { 941 initSmaps(); 942 var id = tab.attr('href').replace('#',''); 943 $("html:not(:animated),body:not(:animated)").animate({ 944 scrollTop: panel.offset().top - 59 - $('.headroom').height() 945 }, 500); 946 947 $(window).resize(); 948 }); 949 } 950 951 //skryje intro taby 952 $(this).bind('easytabs:before', function() { 953 $('.tab.tab-intro').hide(); 954 }); 955 956 // Mobile menu fake tab-nav 957 $('.tab-nav-mobile li a', this).click(function(event) { 958 var href = $(this).attr('href'); 959 960 $('.tab-nav-desktop a[href="'+ href +'"]').click(); 961 962 // Active tÅÃda 963 if ( ! $(this).hasClass('active') ) { 964 $(this).closest('.tab-content').find('.tab-nav-mobile a').andSelf().removeClass('active'); 965 $(this).addClass('active'); 966 } else { 967 $(this).removeClass('active'); 968 } 969 event.preventDefault(); 970 }); 971 972 $(this).attr('data-tabs-initialized', true); 973 } 974 }); 975} 976 977function loadOptimalizedSlideImages(slider, slideNumber, slides) 978{ 979 // load slides from slider they are not explicitly passed 980 if (!slides && slider.length && slideNumber) { 981 var slides = $([]); 982 for (var i = slideNumber; i <= (parseInt(slideNumber) + parseInt(slider.getOption('slideCount'))); i++) { 983 var slide = slider.getSlide(i); 984 slides = slides.add(slide); 985 } 986 } 987 988 // load the current slide image + the next one 989 if (slides && slides.length) { 990 slides.each(function() { 991 var slide = $(this); 992 // load images as background 993 var backgroundImageElements = slide.find('[data-image-background]'); 994 if (slide.attr('data-image-background')) { 995 backgroundImageElements = backgroundImageElements.add(slide); 996 } 997 backgroundImageElements.each(function() { 998 var image = $(this).attr('data-image-background'); 999 if (!$(this).css('background-image') || $(this).css('background-image') == 'none') { 1000 $(this).css('background-position', 'center center'); 1001 $(this).css('background-repeat', 'no-repeat'); 1002 $(this).css('background-image', 'url(' + image + ')'); 1003 } 1004 }); 1005 // load images as tag 1006 var tagImageElements = slide.find('[data-image-tag]'); 1007 if (slide.attr('data-image-tag')) { 1008 tagImageElements = tagImageElements.add(slide); 1009 } 1010 tagImageElements.each(function() { 1011 if ($(this).find('img').length === 0) { 1012 $(this).prepend($(this).attr('data-image-tag')); 1013 } 1014 }); 1015 }); 1016 } 1017} 1018 1019function initSliders() { 1020 // Teaser slider 1021 $('.teaser-slider').each(function() { 1022 var el = $(this); 1023 1024 el.attr('data-numeric') == 'true' ? ifNumeric = true : ifNumeric = false; 1025 1026 var panelNum = el.find('.panel').length; 1027 1028 if ( panelNum > 1 && ! el.hasClass('active') ) { 1029 el.addClass('active'); 1030 var slider = null; 1031 var options = { 1032 effect: 'slide', 1033 vertical: false, 1034 auto: true, 1035 pause: 7000, 1036 speed: 350, 1037 autowidth: false, 1038 continuous: true, 1039 prevNext: true, 1040 numeric: ifNumeric, 1041 slideCount: 1, 1042 responsive: true, 1043 customLink: 'a.customLink', 1044 prevHtml: '<a href="#" class="prev" title="PÅedchozÃ"><svg class="icon" height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g fill="none" transform="matrix(-1 0 0 1 19 0)" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></svg></a>', 1045 nextHtml: '<a href="#" class="next" title="DalÅ¡Ã"><svg class="icon" height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" fill="none"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></svg></a>', 1046 touch: false, 1047 mouseTouch: true 1048 }; 1049 if (el.attr('data-optimalized')) { 1050 options.initCallback = function() { 1051 loadOptimalizedSlideImages(slider, 1); 1052 }; 1053 options.beforeAnimation = function(t) { 1054 loadOptimalizedSlideImages(slider, t); 1055 }; 1056 } 1057 slider = el.find('.slider').sudoSlider(options); 1058 } else if(el.attr('data-optimalized')) { 1059 loadOptimalizedSlideImages(null, null, el.find('.panel')); 1060 } 1061 }); 1062 1063 // Gallery slider
1064 $('.item-slider').each(function(index) { 1065 id = $(this).attr('id'); 1066 sliders[id] = []; 1067 var el = $(this); 1068 1069 // Data atributy slideru 1070 el.attr('data-slides') ? sliders[id]['slideNum'] = el.attr('data-slides') : sliders[id]['slideNum'] = 1; 1071 el.attr('data-slides-tablet') ? sliders[id]['slideNumTablet'] = el.attr('data-slides-tablet') : sliders[id]['slideNumTablet'] = 1; 1072 el.attr('data-slides-mobile') ? sliders[id]['slideNumMobile'] = el.attr('data-slides-mobile') : sliders[id]['slideNumMobile'] = 1; 1073 el.attr('data-auto') ? sliders[id]['slideAuto'] = el.data('auto') : sliders[id]['slideAuto'] = true; 1074 el.attr('data-continuous') ? sliders[id]['slideContinuous'] = el.data('continuous') : sliders[id]['slideContinuous'] = true; 1075 1076 // Pokud panely pÅetékajà -> inicializace slideru 1077 var panelNum = el.find('.panel').length; 1078 var width = el.width(); 1079 var slideCount; 1080 1081 if (width > 860) { 1082 slideCount = sliders[id]['slideNum']; 1083 } else if (width > 540) { 1084 slideCount = sliders[id]['slideNumTablet']; 1085 } else { 1086 slideCount = sliders[id]['slideNumMobile']; 1087 } 1088 1089 if ( panelNum > slideCount ) { 1090 initSlider(el, id); 1091 } else { 1092 loadOptimalizedSlideImages(null, null, el.find('.panel')); 1093 } 1094 }); 1095 1096 // SouÄet panelů na Åádku 1097 /*function calculateListInRow(el) { 1098 var listInRow = 0; 1099 el.find('.panel').each(function() { 1100 if( $(this).prev().length > 0 ) { 1101 if($(this).position().top != $(this).prev().position().top) return false; 1102 listInRow++; 1103 } 1104 else { 1105 listInRow++; 1106 } 1107 }); 1108 return listInRow; 1109 }*/ 1110 1111 // Inicializace slideru 1112 function initSlider(el, id) { 1113 var options = { 1114 //effect: 'fade', 1115 vertical: false, 1116 auto: sliders[id]['slideAuto'], 1117 pause: 8000, 1118 speed: 250, 1119 autowidth: false, 1120 continuous: sliders[id]['slideContinuous'], 1121 prevNext: true, 1122 numeric: false, 1123 slideCount: sliders[id]['slideNum'], 1124 responsive: true, 1125 initCallback: function() { 1126 matchHeightInit(true); 1127 el.addClass('enabled'); 1128 }, 1129 customLink: 'a.customLink', 1130 prevHtml: '<a href="#" class="prev" title="PÅedchozÃ"><svg class="icon" height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g fill="none" transform="matrix(-1 0 0 1 19 0)" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></svg></a>', 1131 nextHtml: '<a href="#" class="next" title="DalÅ¡Ã"><svg class="icon" height="19" viewBox="0 0 19 19" width="19" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" fill="none"><path d="m3.958333 9.5h11.083334"/><path d="m10.291667 14.25 4.75-4.75"/><path d="m10.291667 4.75 4.75 4.75"/></g></svg></a>', 1132 touch: false, 1133 mouseTouch: true 1134 }; 1135 if (el.attr('data-optimalized')) { 1136 options.initCallback = function() { 1137 loadOptimalizedSlideImages(sliders[id]['slider'], 1); 1138 el.addClass('enabled'); 1139 matchHeightInit(true); 1140 }; 1141 options.beforeAnimation = function(t) { 1142 loadOptimalizedSlideImages(sliders[id]['slider'], t); 1143 }; 1144 } 1145 // Slider init 1146 sliders[id]['slider'] = el.find('.slider').sudoSlider(options).each(function() { 1147 // stop slider after navigation click 1148 var nav = $(this).siblings('.nav').find('a'); 1149 nav.click(function() { 1150 sliders[id]['slider'].stopAuto(); 1151 }); 1152 }); 1153 } 1154 1155 // ZmÄna poÄtu panelů pÅi zmÄnÄ velikosti okna 1156 $(window).on("resizeEnd focus", function () { 1157 for (var i in sliders) { 1158 if (!sliders.hasOwnProperty(i) || !sliders[i].hasOwnProperty('slider')) continue; 1159 1160 var width = sliders[i]['slider'].width(); 1161 1162 var orgSlideCount = sliders[i]['slider'].getOption("slideCount"); 1163 var slideCount; 1164 1165 if (width > 860) { 1166 slideCount = sliders[i]['slideNum']; 1167 } else if (width > 540) { 1168 slideCount = sliders[i]['slideNumTablet']; 1169 } else { 1170 slideCount = sliders[i]['slideNumMobile']; 1171 } 1172 1173 // ZmÄna poÄtu slajdů 1174 if (slideCount != orgSlideCount) { 1175 sliders[i]['slider'].setOption("slideCount", slideCount); 1176 } 1177 // Single class 1178 if (slideCount == 1) {
1179 sliders[i]['slider'].closest('.item-slider').addClass('single'); 1180 } 1181 else { 1182 sliders[i]['slider'].closest('.item-slider').removeClass('single'); 1183 } 1184 1185 // fix velke vysky slideru pri prepinani tabu 1186 $('.slider').css({ height: 'auto' }).removeClass('height-matched').matchHeight(); 1187 /* 1188 $('.post-list .item .text').css({ height: 'auto' }).removeClass('height-matched').matchHeight(); 1189 $('.post-list .item h3, .post-list .item .h3').css({ height: 'auto' }).removeClass('height-matched').matchHeight(); 1190 */ 1191 matchHeightInit(true); 1192 1193 sliders[i]['slider'].adjust(); 1194 }; 1195 }).resize(); 1196} 1197 1198// Timer od 0 1199/** 1200 * Number.prototype.format(n, x, s, c) 1201 * 1202 * @param integer n: length of decimal 1203 * @param integer x: length of whole part 1204 * @param mixed s: sections delimiter 1205 * @param mixed c: decimal delimiter 1206 */ 1207Number.prototype.formatNumber = function(n, x, s, c) { 1208 var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')', 1209 num = this.toFixed(Math.max(0, ~~n)); 1210 1211 return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ',')); 1212}; 1213(function($) { 1214 $.fn.countTo = function(options) { 1215 options = $.extend({}, $.fn.countTo.defaults, options || {}); 1216 1217 var loops = Math.ceil(options.speed / options.refreshInterval) 1218 1219 $(this).each(function() { 1220 var el = this, 1221 loopCount = 0, 1222 value = options.from, 1223 interval = setInterval(updateTimer, options.refreshInterval), 1224 amount = $(this).data('amount'), 1225 increment = (amount - options.from) / loops, 1226 plus = '', 1227 html = '' 1228 if ( $(this).data('plus') == true ) { 1229 plus = '<span class="plus">+</span>' 1230 } 1231 1232 function updateTimer() { 1233 value += increment; 1234 loopCount++; 1235 1236 if (options.thousandsSeparator) { 1237 html = value.formatNumber(options.decimals, 3, options.thousandsSeparator, ','); 1238 } else { 1239 html = value.toFixed(options.decimals); 1240 } 1241 html += plus; 1242 $(el).html(html); 1243 1244 if (typeof(options.onUpdate) == 'function') { 1245 options.onUpdate.call(el, value); 1246 } 1247 1248 if (loopCount >= loops) { 1249 clearInterval(interval); 1250 value = amount; 1251 1252 if (typeof(options.onComplete) == 'function') { 1253 options.onComplete.call(el, value); 1254 } 1255 } 1256 } 1257 }); 1258 }; 1259 1260 $.fn.countTo.defaults = { 1261 from: 0, 1262 speed: 1000, 1263 thousandsSeparator: ' ', 1264 refreshInterval: 10, 1265 decimals: 0, 1266 onUpdate: null, 1267 onComplete: null 1268 }; 1269})(jQuery); 1270 1271// Scrollspy 1272(function($) { 1273 $.fn.scrollSpy = function (settings) { 1274 1275 settings = jQuery.extend({ 1276 showSpeed: 100, 1277 callback: function() {} 1278 }, settings); 1279 1280 var topMenu = $(this); 1281 1282 if ( topMenu.length ) { 1283 // Cache selectors 1284 var lastId, 1285 topMenuHeight = topMenu.outerHeight(), 1286 1287 // All list items 1288 menuItems = topMenu.find("a"), 1289 1290 // Anchors corresponding to menu items 1291 scrollItems = menuItems.map(function(){ 1292 var item = $( $(this).attr("href") ); 1293 if (item.length) { return item; } 1294 }); 1295 1296 // Bind to scroll 1297 $(window).bind('load scroll', function(){ 1298 // Get container scroll position 1299 var fromTop = $(this).scrollTop() + topMenuHeight + 50; 1300 1301 // Get id of current scroll item 1302 var cur = scrollItems.map(function(){ 1303 if ($(this).offset().top < fromTop) 1304 return this; 1305 }); 1306 // Get the id of the current element 1307 cur = cur[cur.length-1]; 1308 var id = cur && cur.length ? cur[0].id : ""; 1309 1310 if (lastId !== id) { 1311 lastId = id; 1312 // Set/remove active class 1313 menuItems 1314 .parent().removeClass("active") 1315 .end().filter("[href=#"+id+"]").parent().addClass("active"); 1316 } 1317 }); 1318 } 1319 1320 } 1321})(jQuery); 1322 1323// Isotope 1324function initIsotope() { 1325 var $isotopeEl = $('.isotope') 1326 var $num = $isotopeEl.attr('data-num'); 1327 if ( ! $num ) { $num = 4 } 1328 1329 $isotopeEl.isotope({ 1330 resizable: false, 1331 masonry: { 1332 columnWidth: ( $isotopeEl.width() / $num) 1333 } 1334 }); 1335 1336 $(window).smartresize(function(){ 1337 $isotopeEl.isotope({ 1338 masonry: { 1339 columnWidth: ( $isotopeEl.width() / $num) 1340 } 1341 }); 1342 }); 1343 $(window).resize(); 1344} 1345 1346function reloadIsotope() { 1347 var $isotopeEl = $('.isotope') 1348 var $num = $isotopeEl.attr('data-num');
1349 if ( ! $num ) { $num = 4 } 1350 1351 $isotopeEl.isotope('destroy'); 1352 $isotopeEl.isotope({ 1353 resizable: false, 1354 masonry: { 1355 columnWidth: ( $isotopeEl.width() / $num) 1356 } 1357 }); 1358} 1359 1360// Smart resize for Isotope.js 1361(function($,sr){ 1362 1363 // debouncing function from John Hann 1364 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 1365 var debounce = function (func, threshold, execAsap) { 1366 var timeout; 1367 1368 return function debounced () { 1369 var obj = this, args = arguments; 1370 function delayed () { 1371 if (!execAsap) 1372 func.apply(obj, args); 1373 timeout = null; 1374 }; 1375 1376 if (timeout) 1377 clearTimeout(timeout); 1378 else if (execAsap) 1379 func.apply(obj, args); 1380 1381 timeout = setTimeout(delayed, threshold || 100); 1382 }; 1383 } 1384 // smartresize 1385 jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; 1386})(jQuery,'smartresize'); 1387 1388// Close Flash message 1389function closeFM() { 1390 $('body').delegate('.flash-message .close', 'click', function() { 1391 $(this).closest('.flash-message').fadeOut(); 1392 return false; 1393 }); 1394 1395 if ( $('.flash-message').length ) { 1396 setTimeout(function() { 1397 $('.flash-message' + '[data-hide="fade"]').fadeOut(); 1398 $('.flash-message' + '[data-hide="slide"]').animate({'top': '-100'}, 200, function() { 1399 $('.flash-message' + '[data-hide="slide"]').hide(); 1400 }); 1401 }, 5000 ); 1402 } 1403} 1404 1405// Univerzálnà show/hide 1406(function($) { 1407 $.fn.toggler = function (settings) { 1408 1409 settings = jQuery.extend({ 1410 showSpeed: 100, 1411 hideSpeed: 100, 1412 hideTrigger: false, 1413 slide: false, 1414 scrollToContent: false, 1415 offsetScroll: 0, 1416 hideOnDocumentClick: false, 1417 documentClickElement: '', 1418 hideOnEscape: false 1419 }, settings); 1420 1421 $(this).each(function() { 1422 1423 var trigger = $(this), 1424 content = $('#' + trigger.data('content')); 1425 1426 // Radio nebo checkbox 1427 if ( trigger.is(':radio') || trigger.is(':checkbox') ) { 1428 var name = trigger.attr('name'); 1429 1430 $('[name=' + name + ']').on('change', function() { 1431 content.hide(); 1432 }); 1433 trigger.on('change', function() { 1434 if ( $(this).is(':checked') ) { 1435 content.fadeIn(settings.showSpeed); 1436 } 1437 else { 1438 content.hide(); 1439 } 1440 }); 1441 $(window).on('load',function() { 1442 if ( trigger.is(':checked') ) { 1443 content.fadeIn(settings.showSpeed); 1444 } 1445 }); 1446 } 1447 // Standardnà element 1448 else { 1449 function scrollToContent() { 1450 var offset = 0; 1451 if ( settings.offsetScroll ) { 1452 offset = settings.offsetScroll 1453 } 1454 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: $(content).offset().top + offset }, 500, function() { 1455 //window.location.hash = content.attr('id'); 1456 }); 1457 } 1458 1459 function scrollToTrigger() { 1460 var offset = 0; 1461 if ( settings.offsetScroll ) { 1462 offset = settings.offsetScroll + 200 1463 } 1464 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: $('[data-content=' + trigger.attr('data-content') + ']').offset().top + offset }, 500, function() { 1465 //window.location.hash = content.attr('id'); 1466 }); 1467 } 1468 1469 trigger.on('click',function() { 1470 if ( content.is(':hidden') ) { 1471 if ( settings.slide ) { 1472 content.slideDown(settings.showSpeed,function() { 1473 if ( settings.scrollToContent ) { 1474 scrollToContent(); 1475 }; 1476 }); 1477 } 1478 else { 1479 content.fadeIn(settings.showSpeed,function() { 1480 if ( settings.scrollToContent ) { 1481 scrollToContent(); 1482 }; 1483 }); 1484 } 1485 1486 $(this).addClass('active').find('.text').text( $(this).attr('data-less') ); 1487 1488 if ( settings.hideTrigger ) { 1489 trigger.hide(); 1490 } 1491 } 1492 else { 1493 if ( settings.slide ) { 1494 content.slideUp(settings.hideSpeed,function() { 1495 if ( settings.scrollToContent ) { 1496 scrollToTrigger(); 1497 }; 1498 }); 1499 } 1500 else { 1501 content.fadeOut(settings.hideSpeed,function() { 1502 if ( settings.scrollToContent ) { 1503 scrollToTrigger(); 1504 }; 1505 }); 1506 } 1507 $(this).removeClass('active').find('.text').text( $(this).attr('data-more') ); 1508 1509 if ( settings.hideTrigger ) { 1510 $('[data-content=' + trigger.attr('data-content') + ']').fadeIn(settings.hideSpeed); 1511 } 1512 } 1513 return false;
1514 }); 1515 } 1516 // Hide on document click 1517 if ( settings.hideOnDocumentClick ) { 1518 $(document).bind('click',function(e) { 1519 if ( ! $(settings.documentClickElement).is(e.target) && $(settings.documentClickElement).has(e.target).length === 0) { 1520 content.fadeOut(); 1521 } 1522 }); 1523 } 1524 // Escape button 1525 if ( settings.hideOnEscape ) { 1526 $(document).keyup(function(e){ 1527 if (e.keyCode === 27) { 1528 content.fadeOut(); 1529 } 1530 }); 1531 } 1532 }); 1533 } 1534})(jQuery); 1535 1536// Plynulý scroll ke kotvÄ 1537(function($) { 1538 $.fn.scrollToAnchor = function(settings) { 1539 1540 settings = jQuery.extend({ 1541 speed : 500 1542 }, settings); 1543 1544 return this.each(function(){ 1545 var caller = this 1546 $(caller).click(function (event) { 1547 event.preventDefault() 1548 var locationHref = window.location.href 1549 var elementClick = $(caller).attr("href") 1550 1551 var destination = $(elementClick).offset().top; 1552 1553 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { 1554 history.pushState(null, null, elementClick) 1555 }); 1556 return false; 1557 }); 1558 }); 1559 } 1560})(jQuery); 1561 1562// Zobrazenà elementu ve viewportu 1563function inViewport(el) { 1564 if ( $(el).length ) { 1565 var elH = $(el).height(), 1566 elTop = $(el).offset().top, 1567 scrollTop = $(window).scrollTop(), 1568 winH = $(window).height(); 1569 fixedHeaderH = 0; // výška fixnà hlaviÄky 1570 1571 return ( (elTop + elH) > (scrollTop + fixedHeaderH ) && (scrollTop - elH) > (elTop - winH) ); 1572 } 1573} 1574 1575//submit form via JS, allows injection or change of values 1576$.fn.submitForm = function(toInject) { 1577 if (typeof toInject === 'object') { 1578 for (var key in toInject) { 1579 //change a value if element exits 1580 if ($("input[name='"+key+"']", this).length > 0) { 1581 $("input[name='"+key+"']", this).val(toInject[key]); 1582 } else {//or insert a new one if it doesn't 1583 if (toInject.hasOwnProperty(key)) { 1584 $('<input>').attr({ 1585 type: 'hidden', 1586 id: key, 1587 name: key, 1588 value: toInject[key] 1589 }).appendTo(this); 1590 } 1591 } 1592 } 1593 } 1594 1595 //reset offset if stars are not aligned 1596 if ($(this).hasClass('ajax')) { 1597 normalizeOffset($(this).attr('id')); 1598 } 1599 1600 $(this).submit(); 1601 1602 //set offset to page after submission 1603 if ($(this).hasClass('ajax')) { 1604 normalizeOffset($(this).attr('id'), true); 1605 } 1606}; 1607 1608/* jQuery.values: get or set all of the name/value pairs from child input controls 1609 * @argument data {array} If included, will populate all child controls. 1610 * @argument inputPrefix {string} If included, will prefix all inputs and uppercase the first char 1611 * @returns element if data was provided, or array of values if not 1612*/ 1613$.fn.values = function(data, inputPrefix) { 1614 var els = $(this).find(':input').get(); 1615 1616 //if data and inputPrefix are not passed we try to read them from the data-populate and data-populate-prefix attributes 1617 if (typeof data != 'undefined') { 1618 if (typeof data != 'object') { 1619 data = JSON.parse(data); 1620 } 1621 } else { 1622 var dataAttr = $(this).attr('data-populate'); 1623 if (typeof dataAttr != "undefined") { 1624 data = JSON.parse(dataAttr); 1625 if (typeof data != 'object') { 1626 data = JSON.parse(data); 1627 } 1628 } 1629 } 1630 if (typeof inputPrefix == 'undefined') { 1631 inputPrefix = $(this).attr('data-populate-prefix'); 1632 } 1633 1634 if(typeof data == 'undefined') { 1635 // return all data 1636 data = {}; 1637 1638 $.each(els, function() { 1639 //var inputName = (typeof inputPrefix == 'string') ? (inputPrefix + this.name.charAt(0).toUpperCase() + this.name.slice(1)) : this.name; 1640 var multiCheckbox = (this.type == 'checkbox' && this.name.indexOf("[]") > -1); 1641 if (this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password/i.test(this.type))) { 1642 if (multiCheckbox) { 1643 if (data[this.name] == undefined) data[this.name] = []; 1644 data[this.name].push($(this).val()); 1645 } else { 1646 data[this.name] = $(this).val(); 1647 } 1648 } 1649 }); 1650 return data; 1651 } else { 1652 $.each(els, function() { 1653 var key = this.name; 1654 var isMultiCheckbox = (this.type == 'checkbox' && key.indexOf("[]") > -1); 1655 if (isMultiCheckbox) { 1656 key = key.replace("[]", ''); 1657 } 1658 if (typeof inputPrefix == 'string') { 1659 key = key.replace(inputPrefix, ''); 1660 key = key.charAt(0).toLowerCase() + key.slice(1); 1661 } 1662 if (this.name && data[key]) { 1663 if (isMultiCheckbox) { 1664 $(this).attr("checked", ($.inArray($(this).val(), data[key]) >= 0)); 1665 }
1665 else if (this.type == 'checkbox' || this.type == 'radio') { 1666 $(this).attr("checked", (data[key] == $(this).val())); 1667 } else { 1668 $(this).val(data[key]); 1669 } 1670 } 1671 }); 1672 return $(this); 1673 } 1674}; 1675 1676/* 1677 jQuery deparam is an extraction of the deparam method from Ben Alman's jQuery BBQ 1678 http://benalman.com/projects/jquery-bbq-plugin/ 1679*/ 1680(function ($) { 1681 $.deparam = function (params, coerce) { 1682 var obj = {}, 1683 coerce_types = { 'true': !0, 'false': !1, 'null': null }; 1684 1685 // Iterate over all name=value pairs. 1686 $.each(params.replace(/\+/g, ' ').split('&'), function (j,v) { 1687 var param = v.split('='), 1688 key = decodeURIComponent(param[0]), 1689 val, 1690 cur = obj, 1691 i = 0, 1692 1693 // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it 1694 // into its component parts. 1695 keys = key.split(']['), 1696 keys_last = keys.length - 1; 1697 1698 // If the first keys part contains [ and the last ends with ], then [] 1699 // are correctly balanced. 1700 if (/\[/.test(keys[0]) && /\]$/.test(keys[keys_last])) { 1701 // Remove the trailing ] from the last keys part. 1702 keys[keys_last] = keys[keys_last].replace(/\]$/, ''); 1703 1704 // Split first keys part into two parts on the [ and add them back onto 1705 // the beginning of the keys array. 1706 keys = keys.shift().split('[').concat(keys); 1707 1708 keys_last = keys.length - 1; 1709 } else { 1710 // Basic 'foo' style key. 1711 keys_last = 0; 1712 } 1713 1714 // Are we dealing with a name=value pair, or just a name? 1715 if (param.length === 2) { 1716 val = decodeURIComponent(param[1]); 1717 1718 // Coerce values. 1719 if (coerce) { 1720 val = val && !isNaN(val) ? +val // number 1721 : val === 'undefined' ? undefined // undefined 1722 : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null 1723 : val; // string 1724 } 1725 1726 if ( keys_last ) { 1727 // Complex key, build deep object structure based on a few rules: 1728 // * The 'cur' pointer starts at the object top-level. 1729 // * [] = array push (n is set to array length), [n] = array if n is 1730 // numeric, otherwise object. 1731 // * If at the last keys part, set the value. 1732 // * For each keys part, if the current level is undefined create an 1733 // object or array based on the type of the next keys part. 1734 // * Move the 'cur' pointer to the next level. 1735 // * Rinse & repeat. 1736 for (; i <= keys_last; i++) { 1737 key = keys[i] === '' ? cur.length : keys[i]; 1738 cur = cur[key] = i < keys_last 1739 ? cur[key] || (keys[i+1] && isNaN(keys[i+1]) ? {} : []) 1740 : val; 1741 } 1742 1743 } else { 1744 // Simple key, even simpler rules, since only scalars and shallow 1745 // arrays are allowed. 1746 1747 if ($.isArray(obj[key])) { 1748 // val is already an array, so push on the next value. 1749 obj[key].push( val ); 1750 1751 } else if (obj[key] !== undefined) { 1752 // val isn't an array, but since a second value has been specified, 1753 // convert val into an array. 1754 obj[key] = [obj[key], val]; 1755 1756 } else { 1757 // val is a scalar. 1758 obj[key] = val; 1759 } 1760 } 1761 1762 } else if (key) { 1763 // No value was defined, so set something meaningful. 1764 obj[key] = coerce 1765 ? undefined 1766 : ''; 1767 } 1768 }); 1769 1770 return obj; 1771 }; 1772})(jQuery); 1773 1774//send form or href click via ajax 1775//on forms allows injection or change of values 1776$.fn.myAjax = function(toInject) { 1777 var url = null; 1778 var requestData = null; 1779 var form = null; 1780 if (this.prop('tagName').toLowerCase() == 'form') { 1781 form = this.closest('form') 1782 url = form.attr('action'); 1783 if (typeof toInject === 'object') { 1784 for (var key in toInject) { 1785 //change a value if element exits 1786 if ($("input[name='"+key+"']", form).length > 0) { 1787 $("input[name='"+key+"']", form).val(toInject[key]); 1788 } else {//or insert a new one if it doesn't 1789 if (toInject.hasOwnProperty(key)) { 1790 $('<input>').attr({ 1791 type: 'hidden', 1792 id: key, 1793 name: key, 1794 value: toInject[key] 1795 }).appendTo(form); 1796 } 1797 } 1798 } 1799 } 1800 1801 if (this.attr('data-persist-to-hash')) { 1802 disableHashChange = true; 1803 1804 //apply form id on correct load more button 1805 var firstParentTab = this.closest('.tab'); 1806 var loadMoreButton = null; 1807 if (firstParentTab.length) { // look in possible tab container 1808 var secondParentTab = firstParentTab.parent().closest('.tab');
1809 loadMoreButton = $('a.load-more-items', firstParentTab).first(); 1810 if (!loadMoreButton.length && secondParentTab.length) { // look in possible second tab container 1811 loadMoreButton = $('a.load-more-items', secondParentTab).first(); 1812 } 1813 } 1814 // look on whole page 1815 if (!loadMoreButton || !loadMoreButton.length) { 1816 loadMoreButton = $('a.load-more-items').first(); 1817 } 1818 if (loadMoreButton && loadMoreButton.length) { 1819 loadMoreButton.attr('data-form-id', form.attr('id')); 1820 } 1821 1822 //do not serialize the offset (we want all items after a full page reload) 1823 var values = $('#'+this.attr('id')).values(); 1824 delete values['offset']; 1825 1826 //reset page if filter changed 1827 if (values.page) { 1828 var page = values.page; 1829 delete values['page']; 1830 if (lastSentFormData !== null && JSON.stringify(lastSentFormData) !== JSON.stringify(values)) { 1831 page = 1; 1832 $('input#page', this).val('1'); 1833 $('input#offset', this).val('0'); 1834 } 1835 lastSentFormData = jQuery.extend({}, values); 1836 values.page = page; 1837 } 1838 1839 window.location.hash = '#'+$.param(values); 1840 } 1841 1842 requestData = form.serializeArray(); 1843 if (form.prop('enctype') == 'multipart/form-data') { 1844 var formData = new FormData(); 1845 for (var p in requestData) { 1846 formData.append(requestData[p].name, requestData[p].value); 1847 } 1848 jQuery.each($('input[type=file]', form), function(i, input) { 1849 if (input.files.length) { 1850 formData.append(input.name, input.files[0]); 1851 } 1852 }); 1853 requestData = formData; 1854 } 1855 } else { 1856 url = this.attr('href'); 1857 requestData = toInject; 1858 if (this.attr('data-persist-to-hash') && this.attr('id')) { 1859 disableHashChange = true; 1860 window.location.hash = '#'+this.attr('id'); 1861 } 1862 } 1863 1864 $('<div id="loader"><div class="loader-inner"></div></div>').hide().appendTo('body').show() 1865 1866 var ajaxOptions = { 1867 url: (url) ? url : window.location.href, 1868 type: (form == null) ? 'GET' : 'POST', 1869 data: requestData 1870 } 1871 if (form && form.prop('enctype') == 'multipart/form-data') { 1872 ajaxOptions.contentType = false;
1873 ajaxOptions.processData = false; 1874 ajaxOptions.cache = false; 1875 } 1876 1877 var hideLoader = true; 1878 $.ajax(ajaxOptions).done(function(responseData) { 1879 //handle snippets 1880 var popup = null; 1881 var evalScript = null; 1882 for(var key in responseData.snippets) { 1883 switch(responseData.snippets[key].type) { 1884 case 'element': { 1885 if (responseData.snippets[key].reloadIsotope) { 1886 $(key).html(responseData.snippets[key].body).imagesLoaded(function() { 1887 reloadIsotope(); 1888 }); 1889 } else { 1890 $(key).html(responseData.snippets[key].body); 1891 } 1892 } break; 1893 case 'element-append': { 1894 $(key).append(responseData.snippets[key].body); 1895 } break; 1896 case 'popup': { 1897 popup = responseData.snippets[key].body; 1898 } break; 1899 case 'popup-close': { 1900 $.fancybox.close(); 1901 } break; 1902 case 'redirect': { 1903 document.location.href = responseData.snippets[key].body; 1904 hideLoader = false; 1905 } break; 1906 case 'redirect-ajax': { 1907 var url = responseData.snippets[key].body; 1908 var trigger = $('<a href="'+url+'" class="ajax"></a>').appendTo('body'); 1909 trigger.click(); 1910 trigger.remove(); 1911 hideLoader = false;
1912 } break; 1913 case 'remove': { 1914 if (typeof responseData.snippets[key].body === 'object') { 1915 for (var index in responseData.snippets[key].body) { 1916 $(responseData.snippets[key].body[index]).remove(); 1917 } 1918 } else { 1919 $(responseData.snippets[key].body).remove(); 1920 } 1921 } break; 1922 case 'hide': { 1923 if (typeof responseData.snippets[key].body === 'object') { 1924 for (var index in responseData.snippets[key].body) { 1925 $(responseData.snippets[key].body[index]).hide(); 1926 } 1927 } else { 1928 $(responseData.snippets[key].body).hide(); 1929 } 1930 } break; 1931 case 'show': { 1932 if (typeof responseData.snippets[key].body === 'object') { 1933 for (var index in responseData.snippets[key].body) { 1934 $(responseData.snippets[key].body[index]).show(); 1935 } 1936 } else { 1937 $(responseData.snippets[key].body).show(); 1938 } 1939 } break; 1940 case 'populate': { 1941 if ($(key).length && $(key).is('form')) { 1942 $(key).values(responseData.snippets[key].body['data'], responseData.snippets[key].body['prefix']); 1943 if ($(key).attr('data-js-validation')) { 1944 $(key).valid(); 1945 } 1946 } 1947 } break; 1948 case 'eval': { 1949 evalScript = responseData.snippets[key].body; 1950 } break; 1951 } 1952 //reload on null snippet 1953 //if (responseData[key] == null) window.location.reload(); 1954 } 1955 //check if there was a popup 1956 if (popup != null) { 1957 $('#loader').remove() 1958 var tmp = $.fancybox.open(popup, defaultFancyboxConfig); 1959 } 1960 //check if there was an eval 1961 if (evalScript != null) { 1962 eval(evalScript); 1963 } 1964 1965 $('.accordion.collapsible .item').each((i, el) => { 1966 const item = $(el) 1967 const head = item.find('.item-head') 1968 const more = item.find('.more') 1969 const moreText = $(more.find('.text')) 1970 1971 more.on('click', (e) => { 1972 e.preventDefault() 1973 if (item.hasClass('is-active')) { 1974 head.removeClass('is-active') 1975 item.removeClass('is-active') 1976 moreText.text(moreText.data('more')) 1977 } else { 1978 head.addClass('is-active') 1979 item.addClass('is-active') 1980 moreText.text(moreText.data('less')) 1981 } 1982 }) 1983 }) 1984 }).fail(function() { 1985 alert('That is an error.'); 1986 }).always(function() { 1987 afterAjax(); 1988 if (hideLoader) { 1989 initSmaps() 1990 $('#loader').remove() 1991 } 1992 }); 1993} 1994 1995//initializes validate.js rules from Zend backend validation rules in data attributes 1996function initJsValidation() 1997{ 1998 $('form').each(function() { 1999 if ($(this).attr('data-validation-initialized')) return; 2000 2001 if ($(this).attr('data-js-validation')) { 2002 var messages = {}; 2003 var errorWrapperSelector = $(this).attr('data-error-wrapper-selector'); 2004 var errorWrapperClass = $(this).attr('data-error-wrapper-class'); 2005 var errorClassOnElement = $(this).attr('data-error-class-on-element'); 2006 $('input[data-error-messages], textarea[data-error-messages], checkbox[data-error-messages], select[data-error-messages]', this).each(function() { 2007 messages[$(this).attr('name')] = JSON.parse($(this).attr('data-error-messages')); 2008 }); 2009 //additional rules 2010 var rules = {}; 2011 $('*', this).filter(':input').each(function() { 2012 if ($(this).attr('id') == undefined) return; 2013 var depends = $(this).attr('depends'); 2014 if (depends != undefined) 2015 depends = JSON.parse(depends); 2016 else return; 2017 2018 var dependentValSelectors = []; 2019 if (!Array.isArray(depends.key)) depends.key = [depends.key]; 2020 2021 for (var i in depends.key) { 2022 var key = depends.key[i]; 2023 var dependentElement = $('*[name="'+key+'"]'); 2024 var dependentValSelector = (dependentElement.attr('type') == 'radio') ? 'input[name="'+key+'"]:checked' : '#'+key; 2025 dependentValSelectors.push(dependentValSelector); 2026 } 2027 var elementId = $(this).attr('id'); 2028 rules[elementId] = { 2029 required: { 2030 depends: function() { 2031 for (var i in dependentValSelectors) { 2032 if ($(dependentValSelectors[i]).val() == depends.value) return true; 2033 } 2034 return false; 2035 } 2036 } 2037 }; 2038 if (depends.hasOwnProperty('additionalValidators')) { 2039 for (var i in depends.additionalValidators) {
2040 rules[elementId][i] = depends.additionalValidators[i]; 2041 } 2042 } 2043 }); 2044 $(this).validate({ 2045 'errorClass': $(this).attr('data-error-class'), 2046 'errorElement': $(this).attr('data-error-element'), 2047 errorPlacement: function(error, element) { 2048 $('.error-placement-wrapper[data-element-id=' + element.attr('id') + ']').html(error); 2049 }, 2050 highlight: function(element) { 2051 if (errorWrapperSelector && errorWrapperClass) { 2052 $(element).closest(errorWrapperSelector).addClass(errorWrapperClass); 2053 } 2054 if (errorClassOnElement) { 2055 $(element).addClass(errorClassOnElement); 2056 } 2057 }, 2058 unhighlight: function(element) { 2059 if (errorWrapperSelector && errorWrapperClass) { 2060 $(element).closest(errorWrapperSelector).removeClass(errorWrapperClass); 2061 } 2062 $('.error-placement-wrapper[data-element-id=' + element.id + ']').empty(); 2063 if (errorClassOnElement) { 2064 $(element).removeClass(errorClassOnElement); 2065 } 2066 }, 2067 'messages': messages, 2068 rules: rules, 2069 submitHandler: function(form) { 2070 //prevent multiple form submissions 2071 if (!$(form).attr('data-form-submitted') || $(this).attr('data-allow-multiple-submissions')) { 2072 $(form).attr('data-form-submitted', '1'); 2073 if ($(form).hasClass('ajax')) { 2074 $(form).myAjax($(form).attr('data-to-inject')); 2075 } else { 2076 form.submit(); 2077 } 2078 } 2079 } 2080 }); 2081 $(this).attr('data-validation-initialized', '1'); 2082 } else { 2083 //prevent multiple form submissions on no-js-validated forms 2084 if (!$(this).hasClass('ajax') && !$(this).attr('data-allow-multiple-submissions')) { 2085 $(this).submit(function() { 2086 if (!$(this).attr('data-form-submitted')) { 2087 $(this).attr('data-form-submitted', '1'); 2088 this.submit(); 2089 return true; 2090 } else { 2091 return false; 2092 } 2093 }); 2094 } 2095 } 2096 }); 2097} 2098 2099//upload widget init functions 2100$.fn.updateUploadAddRemove = function() { 2101 if ($('.part-optional:hidden', this).length == 0) { 2102 $(".add-upload", this).hide(); 2103 } else { 2104 $(".add-upload", this).show(); 2105 } 2106 2107 if ($('.part-optional:visible', this).length == 0) { 2108 $(".remove-upload", this).hide(); 2109 } else { 2110 $(".remove-upload", this).show(); 2111 } 2112} 2113function initUploadWidgets() { 2114 //form sections switches init 2115 $(".upload-widget input[type=hidden][name^='edit_']").each(function() { 2116 $(this).change(); 2117 }); 2118 $(".upload-widget").each(function() { 2119 $(this).updateUploadAddRemove(); 2120 }); 2121} 2122 2123function afterAjax() { 2124 //initUploadWidgets(); 2125 2126 initStdTabs(); 2127 2128 initJsValidation(); 2129 2130 initSliders(); 2131 2132 // Stejná výška elementů 2133 $(window).resize(); 2134 2135 // Close FM 2136 closeFM(); 2137 2138 // Match height 2139 matchHeightInit(); 2140 2141 // init geo distance calculations 2142 // geoInit(); 2143 2144 // filter clear button 2145 filterClearButton(); 2146} 2147 2148// Match height 2149function matchHeightInit(force) { 2150 var queue = ['.item-eq', '.news.list .item-inner', '.post-list .item h3', 2151 '.post-list .item .h3', '.post-list .item .text', '.banners .item-inner', 2152 '.lectures .item-inner']; 2153 2154 queue.forEach(function(selector) { 2155 if (!force) { 2156 selector += ':not(.height-matched)'; 2157 } 2158 2159 var notMatched = $(selector); 2160 if (!notMatched.hasClass( "disable-height-matched" )) { 2161 notMatched.css({ height: 'auto' }); 2162 notMatched.matchHeight(); 2163 notMatched.addClass('height-matched'); 2164 } 2165 }); 2166}
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.