1jQuery(document).ready(function($) { 2 3 var ww = $(window).width(); 4 var wh = $(window).height(); 5 window_w = $(window).width(); 6 7 $('.newsletter_btn').click(function(e){ 8 e.preventDefault(); 9 $('#newsletter').addClass('active'); 10 }); 11 12 $('#newsletter').click(function(){ 13 $('#newsletter').removeClass('active'); 14 }); 15 16 $('.ml-embedded').click(function(e){ 17 e.stopPropagation(); 18 }); 19 20 function cookieSet(cookieName,cookieValue,nDays) { 21 var today = new Date(); 22 var expire = new Date(); 23 if (nDays==null || nDays==0) nDays=1; 24 expire.setTime(today.getTime() + 3600000*24*nDays); 25 document.cookie = cookieName+"="+escape(cookieValue) + ';expires='+expire.toGMTString()+';path=/;domain=muzeumwarszawy.pl'; 26 } 27 28 $('.cookies_close').click(function(e){ 29 e.preventDefault(); 30 cookieSet('cookieaccept','accepted',30); 31 document.getElementById("cookiebar").style.display="none"; 32 return false; 33 }); 34 35 $('svg.larger-typo').click(function(){ 36 $('html').toggleClass('larger-typo'); 37 if($('html').hasClass('larger-typo')){ 38 cookieSet('largertypo','accepted',30); 39 masonry(); 40 }else{ 41 masonry(); 42 document.cookie = 'largertypo=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=muzeumwarszawy.pl'; 43 } 44 }); 45 46 $('svg.contrast-mode').click(function(){ 47 $('html').toggleClass('contrast-mode'); 48 if($('html').hasClass('contrast-mode')){ 49 cookieSet('contrastmode','accepted',30); 50 }else{ 51 document.cookie = 'contrastmode=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=muzeumwarszawy.pl'; 52 53 } 54 }); 55 56 if($('.em-booking-form').length){ 57 $('.reservation_button').show(0); 58 }else{ 59 $('.reservation_button').hide(0); 60 } 61 62 $('.load_more').click(function(e){ 63 e.preventDefault(); 64 $(this).parents('.news_container').find('.hidden').removeClass('hidden'); 65 $(this).remove(); 66 masonry(); 67 }); 68 69 $('.counter').on('click',function(e){ 70 var url = $(this).attr('data-href'); 71 window.open(url, '_blank'); 72 }) 73 74 if($('#popup').length){ 75 var tempH = $('.popup_outer').height(); 76 $('.overall').height(tempH); 77 } 78 79 $('#popup').on('click',function(e){ 80 $(this).fadeTo(300,0,function(){ 81 $(this).remove(); 82 $('.overall').removeClass('popup_is_active'); 83 $('.overall').css({'height':'auto'}); 84 }) 85 }) 86 87 $('.popup_inner').on('click',function(e){ 88 e.stopPropagation(); 89 }) 90 91 $('#popup #close,#popup #close_mobile').on('click',function(e){ 92 e.preventDefault(); 93 $('#popup').fadeTo(300,0,function(){ 94 $('#popup').remove(); 95 $('.overall').removeClass('popup_is_active'); 96 $('.overall').css({'height':'auto'}); 97 }) 98 }) 99 100 $('a').on('click',function(e){ 101 var url = $(this).attr('href'); 102 if (url.indexOf('youtube.com') >= 0 || url.indexOf('youtu.be') >= 0 ){ 103 e.preventDefault(); 104 var videoid = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 105 $('#gallery_lightbox .full_image').append('<div class="video_holder"><iframe width="560" height="315" src="https://www.youtube.com/embed/'+videoid[1]+'?autoplay=1" frameborder="0" allowfullscreen></iframe></div>') 106 $('#download').hide(); 107 $('#gallery_lightbox').show(0).fadeTo(250,1); 108 } 109 }) 110 111 if($('.home').length){ 112 if($('body').css('clear') == 'left'){ 113 $('.slide_image,.slider_overlay').height(wh); 114 $('.home_slider').height(wh-69); 115 } 116 117 var ratio = $('.slide_image_blurred').attr('data-ratio'); 118 var height = 1.04*ww/ratio; 119 var width = 1.04*ww*ratio; 120 121 if(height>=wh){ 122 var vertical_align = (height-wh)/2; 123 $('.slide_image_blurred').height(height); 124 $('.slide_image_blurred').css({'margin-top':-vertical_align}); 125 }else{ 126 var horizontal_align = (width-wh)/2; 127 $('.slide_image_blurred').height(wh); 128 $('.slide_image_blurred').css({'width':width,'margin-left':-horizontal_align}); 129 } 130 131 } 132 133 $(window).on('resize',function(){ 134 var ww = $(window).width(); 135 var wh = $(window).height(); 136 var offset_top = $(document).scrollTop(); 137 138 if($('#popup').length){ 139 var tempH = $('.popup_outer').height(); 140 $('.overall').height(tempH); 141 } 142 143 if($('.home').length){ 144 if($('body').css('clear') == 'left'){ 145 if(ww != window_w){ 146 $('.slide_image,.slider_overlay').height(wh); 147 $('.home_slider').height(wh-69); 148 } 149 }else{ 150 $('.home_slider').css({'height':''}); 151 } 152 153 } 154 if($('body').css('clear') != 'left'){ 155 $('.header_holder').removeClass('fixed'); 156 $('.logo').stop().fadeIn(0); 157 $('header').css({'padding-top':0}); 158 }else{ 159 if(offset_top>100){ 160 $('.header_holder').addClass('fixed'); 161 $('.logo').stop().fadeOut(0); 162 $('header').css({'padding-top':0}); 163 } 164 $('body').removeClass('open_menu'); 165 $('.menu_holder').hide(); 166 } 167 }) 168 169 busy=false; 170 171 $(document).scroll(function(){ 172 if($('body').css('clear') == 'left'){ 173 var offset_top = $(this).scrollTop(); 174 if($('.open_menu').length){ 175 busy = true; 176 $('body').removeClass('open_menu'); 177 $('.menu_holder').stop().slideUp(100); 178 setTimeout(function(){ 179 $('header').css({'padding-top':0}); 180 busy=false; 181 },100) 182 } 183 if(offset_top>100){ 184 $('.header_holder').addClass('fixed'); 185 $('.logo').stop().fadeOut(0); 186 if(!busy){ 187 $('header').css({'padding-top':0}); 188 } 189 }else{ 190 $('.header_holder').removeClass('fixed'); 191 $('.logo').stop().fadeIn(0); 192 $('header').css({'padding-top':70}); 193 } 194 } 195 }) 196 197 198 $('.slide_img').each(function(index, elem){ 199 if (!elem.complete) { 200 $(elem).on('load', function(){ 201 $(this).next('.slide_image_blurred').fadeOut(300); 202 $('.slider_overlay').fadeTo(200,1); 203 }); 204 } 205 else { 206 $(this).next('.slide_image_blurred').fadeOut(300); 207 $('.slider_overlay').fadeTo(200,1); 208 } 209 }); 210 211 212 $('.reservation_button,.reservation_close').click(function (e) { 213 e.preventDefault(); 214 $('#reservation').stop().fadeToggle(200); 215 }); 216 217 if($('body').css('clear') == 'left'){ 218 $('#search_results').addClass('events_by_list'); 219 $('footer .menu-item-has-children').on('click',function(e){ 220 e.preventDefault(); 221 if($('body').css('clear') == 'left'){ 222 $('footer .menu-item-has-children.open .sub-menu').stop().slideUp(200); 223 $(this).toggleClass('open'); 224 $(this).children('.sub-menu').stop().slideToggle(200); 225 } 226 }) 227 $('.sub-menu').on('click','a',function(e){ 228 e.stopPropagation(); 229 }) 230 } 231 232 $('.menu_button').click(function (e) { 233 e.preventDefault(); 234 $('body').toggleClass('open_menu'); 235 $('.menu_holder').stop().slideToggle(100); 236 if($('.header_holder.fixed').length){ 237 if($('.open_menu').length){ 238 $('.logo').stop().fadeIn(0); 239 $('header').css({'padding-top':70}); 240 }else{ 241 $('.logo').stop().fadeOut(0); 242 setTimeout(function(){ 243 $('header').css({'padding-top':0}); 244 },100) 245 } 246 } 247 if($('.menu-item-has-children.open').length){ 248 $('.menu-item-has-children.open .sub-menu').hide(); 249 $('.menu-item-has-children.open').removeClass('open'); 250 } 251 }); 252 253 $('.share_button').on('click',function(e){ 254 e.preventDefault(); 255 $(this).toggleClass('active'); 256 $(this).children('.socials').stop().slideToggle(250); 257 }) 258 259 $('.share_button').on('click','.socials',function(e){ 260 e.stopPropagation(); 261 }) 262 263 264 $('.events_page_content:not(.events_calendar) .filter_btn').on('click',function(){ 265 $(this).parent().toggleClass('open'); 266 $(this).next('#filters').stop().slideToggle(200); 267 }) 268 269 $('.events_calendar .filter_btn').click(function(e){ 270 e.preventDefault(); 271 $(this).toggleClass('active'); 272 $('.event_filters').stop().slideToggle(250); 273 }); 274 275 276 $('.menu .address a').each(function(){ 277 $(this).replaceWith(this.childNodes); 278 }) 279 280 281 $(window).resize(function(){ 282 if($('body').css('clear') == 'left'){ 283 $('#search_results').addClass('events_by_list'); 284 $('.menu_holder').hide(0); 285 }else{ 286 $('#search_results').removeClass('events_by_list'); 287 $('.menu_holder').show(0); 288 $('body').removeClass('open_menu'); 289 } 290 }) 291 292 293 $('footer a[href*="#"]').on('click', function (e) { 294 e.preventDefault(); 295 }); 296 297 298 $('.to_top,#go_to_top').on('click',function(){ 299 $('html,body').stop().animate({scrollTop:0},350); 300 }) 301 302 $('.read_more_button').on('click',function(e){ 303 e.preventDefault(); 304 if(!$(this).hasClass('active')){ 305 $(this).addClass('active'); 306 if($('body').hasClass('en')){ 307 $(this).children('span').text('Less'); 308 }else{ 309 $(this).children('span').text('Mniej'); 310 } 311 }else{ 312 $(this).removeClass('active'); 313 if($('body').hasClass('en')){ 314 $(this).children('span').text('More'); 315 }else{ 316 $(this).children('span').text('WiÄcej'); 317 } 318 } 319 320 $(this).next().stop().slideToggle(500); 321 }) 322 323 324 if($('.gallery-item').length){ 325 n = 1; 326 $('.gallery-item').each(function(){ 327 $(this).attr('data-id',n); 328 n++; 329 }) 330 } 331 332 $('#gallery_lightbox #close').on('click',function(e){ 333 e.preventDefault(); 334 $('#gallery_lightbox').fadeTo(250,0); 335 setTimeout(function(){ 336 $('#gallery_lightbox').hide(0); 337 $('.video_holder').remove(); 338 $('#download').show(); 339 },250) 340 }) 341 342 $('.gallery-item').on('click','a',function(e){ 343 e.preventDefault(); 344 }) 345 346 $('.gallery-item').on('click',function(e){ 347 e.preventDefault(); 348 var full_img = $(this).find('a').attr('href'); 349 var data_id = $(this).attr('data-id'); 350 var caption = $(this).find('.wp-caption-text').text(); 351 if($(this).prevAll('.gallery-item').length){ 352 var prev_img = $(this).prevAll('.gallery-item:first').find('a').attr('href'); 353 var prev_data_id = $(this).prevAll('.gallery-item:first').attr('data-id'); 354 $('#gallery_lightbox .gallery_prev').attr('href',prev_img).attr('data-id',prev_data_id); 355 $('.gallery_prev').removeClass('inactive'); 356 }else{ 357 $('.gallery_prev').addClass('inactive'); 358 } 359 if($(this).nextAll('.gallery-item').length){ 360 var next_img = $(this).nextAll('.gallery-item:first').find('a').attr('href'); 361 var next_data_id = $(this).nextAll('.gallery-item:first').attr('data-id'); 362 $('#gallery_lightbox .gallery_next').attr('href',next_img).attr('data-id',next_data_id); 363 $('.gallery_next').removeClass('inactive'); 364 }else{ 365 $('.gallery_next').addClass('inactive'); 366 } 367 368 $('#gallery_lightbox .gallery_box').attr('data-id',data_id); 369 $('#gallery_lightbox .gallery_box .full_image').replaceWith('<div class="full_image" style="background-image:url('+full_img+')" ><div class="image_caption">'+caption+'</div></div>'); 370 $('#gallery_lightbox').show(0).fadeTo(250,1); 371 $('#download').attr('href',full_img); 372 }) 373 374 $('#gallery_lightbox .gallery_prev').on('click',function(e){ 375 e.preventDefault(); 376 var prev_img = $(this).attr('href'); 377 var data_id = $('#gallery_lightbox .gallery_box').attr('data-id'); 378 var full_img = $('.gallery-item[data-id="'+data_id+'"]').find('a').attr('href'); 379 var prev_img = $('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').find('a').attr('href'); 380 var prev_id = $('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').attr('data-id'); 381 var prev_caption = $('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').find('.wp-caption-text').text(); 382 383 if(!$('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').prevAll('.gallery-item:first').length){ 384 $('.gallery_prev').addClass('inactive'); 385 }else{ 386 $('.gallery_prev').removeClass('inactive'); 387 var prev_prev_img = $('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').prevAll('.gallery-item:first').find('a').attr('href'); 388 var prev_prev_id = $('.gallery-item[data-id="'+data_id+'"]').prevAll('.gallery-item:first').prevAll('.gallery-item:first').attr('data-id'); 389 $('#gallery_lightbox .gallery_prev').attr('href',prev_prev_img).attr('data-id',prev_prev_id); 390 } 391 392 if($('.gallery_next').hasClass('inactive')){ 393 $('.gallery_next').removeClass('inactive') 394 } 395 396 $('#gallery_lightbox .gallery_next').attr('href',full_img).attr('data-id',data_id); 397 $('#gallery_lightbox .gallery_box').attr('data-id',prev_id); 398 $('#gallery_lightbox .full_image').replaceWith('<div class="full_image" style="background-image:url('+prev_img+')"><div class="image_caption">'+prev_caption+'</div></div>'); 399 $('#download').attr('href',prev_img); 400 }) 401 402 $('#gallery_lightbox .gallery_next').on('click',function(e){ 403 e.preventDefault(); 404 var next_img = $(this).attr('href'); 405 var data_id = $('#gallery_lightbox .gallery_box').attr('data-id'); 406 var full_img = $('.gallery-item[data-id="'+data_id+'"]').find('a').attr('href'); 407 var next_img = $('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').find('a').attr('href'); 408 var next_id = $('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').attr('data-id'); 409 var next_caption = $('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').find('.wp-caption-text').text(); 410 411 if(!$('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').nextAll('.gallery-item:first').length){ 412 $('.gallery_next').addClass('inactive'); 413 }else{ 414 $('.gallery_next').removeClass('inactive'); 415 var next_next_id = $('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').nextAll('.gallery-item:first').attr('data-id'); 416 var next_next_img = $('.gallery-item[data-id="'+data_id+'"]').nextAll('.gallery-item:first').nextAll('.gallery-item:first').find('a').attr('href'); 417 $('#gallery_lightbox .gallery_next').attr('href',next_next_img).attr('data-id',next_next_id); 418 } 419 420 if($('.gallery_prev').hasClass('inactive')){ 421 $('.gallery_prev').removeClass('inactive') 422 } 423 424 $('#gallery_lightbox .gallery_prev').attr('href',full_img).attr('data-id',data_id); 425 $('#gallery_lightbox .gallery_box').attr('data-id',next_id); 426 $('#gallery_lightbox .full_image').replaceWith('<div class="full_image" style="background-image:url('+next_img+')"><div class="image_caption">'+next_caption+'</div></div>'); 427 $('#download').attr('href',next_img); 428 }) 429 430 431 function masonry() { 432 433 if($('.masonry').length){ 434 var $grid = $('.masonry'); 435 436 $grid.fadeOut(0).imagesLoaded(function(){ 437 $grid.fadeIn().isotope({ 438 itemSelector : '.masonry_item', 439 percentPosition: true, 440 masonry: {columnWidth: '.masonry_item'} 441 }); 442 }) 443 } 444 445 } 446 masonry(); 447 448 $('.menu_holder .menu-item-has-children').on('click','a',function(e){
449 $this = $(this); 450 delay = 0; 451 if($this.next('.sub-menu').length){ 452 e.preventDefault(); 453 if($('body').css('clear') != 'left'){ 454 455 if($('.submenu_open').length){ 456 delay = 250; 457 $submenu = $('.sub-menu.active'); 458 $submenu.stop().slideUp(250,function(){$submenu.hide().removeClass('active');}); 459 } 460 461 setTimeout(function(){ 462 if($this.next('.sub-menu').css('visibility')=='hidden'){ 463 $('.menu').addClass('active'); 464 $('.overall').addClass('submenu_open'); 465 $this.next('.sub-menu').hide().addClass('active'); 466 $this.next('.sub-menu').stop().slideDown(250); 467 }else{ 468 $('.menu').removeClass('active'); 469 $('.overall').removeClass('submenu_open'); 470 $this.next('.sub-menu').stop().slideUp(250,function(){$('.menu_holder .sub-menu').hide().removeClass('active');}); 471 } 472 },delay); 473 474 }else{ 475 $('.menu_holder .menu-item-has-children.open .sub-menu').stop().slideUp(200); 476 $this.parent().toggleClass('open'); 477 $this.next('.sub-menu').stop().slideToggle(200); 478 } 479 } 480 }) 481 482 $('body').on('click','.submenu_open',function(){ 483 $('.menu').removeClass('active'); 484 $('.overall').removeClass('submenu_open'); 485 $('.sub-menu.active').stop().slideUp(250); 486 setTimeout(function(){ 487 $('.sub-menu.active').removeClass('active'); 488 },250) 489 }) 490 491 $('body').on('click','.header_holder',function(e){ 492 if($('.submenu_open').length){ 493 e.stopPropagation(); 494 } 495 }) 496 497 $(document).scroll(function(){ 498 if($('.menu').hasClass('active')){ 499 $('.sub-menu.active').slideToggle(250); 500 $('.menu').removeClass('active'); 501 $('.overall').removeClass('submenu_open'); 502 setTimeout(function(){ 503 $('.sub-menu.active').removeClass('active'); 504 },250) 505 } 506 }) 507 508 if($('.exhibitions_page_content').length || $('.visit_page_content').length){ 509 $('.main_wrapper').on('click','a',function(e){ 510 511 if($(this).hasClass('permanent_exhibition_link')){ 512 e.preventDefault(); 513 var offset_top = $(this).parent().offset().top; 514 $('html,body').stop().animate({scrollTop:offset_top},500); 515 }else 516 if($(this).hasClass('expand')){ 517 e.preventDefault(); 518 if(!$('li.active').length){ 519 $(this).parent().next().stop().slideDown(250).fadeTo(200,1); 520 $(this).parents('li').addClass('active'); 521 }else{ 522 if($(this).parents('li').hasClass('active')){ 523 $(this).parent().next().stop().slideUp(250).fadeTo(200,0); 524 $(this).parents('li').removeClass('active'); 525 }else{ 526 $('li.active').find('.section_content').stop().slideUp(250).fadeTo(200,0); 527 $('li.active').removeClass('active'); 528 $(this).parent().next().stop().slideDown(250).fadeTo(200,1); 529 $(this).parents('li').addClass('active'); 530 } 531 } 532 if($('li.active').length){ 533 setTimeout(function(){ 534 offset_top = $('li.active').offset().top; 535 $('html,body').stop().animate({scrollTop:offset_top},500); 536 },300) 537 } 538 } 539 540 }) 541 } 542 543 544 545 546 /* CATEGORY & LOCATION FILTER */ 547 548 lang = $('body').attr('data-lang'); 549 loading = false; 550 551 $('#search_form').keypress(function(e) { 552 if (e.keyCode == 13 || e.which == 13) { 553 if(!loading){ 554 loading = true; 555 $('#search_results').addClass('loading'); 556 var from_date = $('#from_date').attr('data-val'); 557 var to_date = $('#to_date').attr('data-val'); 558 var scope = from_date+','+to_date; 559 var cat = $('.category_filter').find('.selected').attr('data-val'); 560 var loc = $('.location_filter').find('.selected').attr('data-val'); 561 var tag_term = $('.tag_filter').find('.selected').attr('data-val'); 562 var search_term = $('#search_text').val(); 563 564 var yearMonthVal = ''; 565 566 var searchEvents = '/searchEvents.php'; 567 if($('.events_calendar').length){ 568 searchEvents = '/eventsLoad.php'; 569 yearMonthVal = $('.results').attr('data-month'); 570 } 571 572 $('.events_view .mode').removeClass('active'); 573 $('.events_view .block_view').addClass('active'); 574 575 $.ajax({ 576 type: 'GET', 577 data: {yearMonth:yearMonthVal,scope:scope,from:from_date,to:to_date,category:cat,location:loc,search:search_term,tag:tag_term,language:lang}, 578 url: templateUrl+searchEvents, 579 cache: true, 580 dataType: 'html', 581 beforeSend : function(){}, 582 success: function(data){ 583 // FIX: podstawiamy tylko .results; pilnujemy trybu 584 var $data = $(data); 585 var $results = $data.filter('.results'); 586 if(!$results.length) $results = $data.find('.results').first(); 587 if($results.length){ 588 $('#search_results .results').replaceWith($results); 589 } 590 // FIX: ustaw klasÄ wrappera zgodnie z trybem 591 if ($('.list_view').hasClass('active')){ 592 $('#search_results').addClass('events_by_list'); 593 } else { 594 $('#search_results').removeClass('events_by_list'); 595 } 596 if($('.block_view').hasClass('active') && typeof masonry === 'function'){ 597 masonry(); 598 } 599 }, 600 complete: function(){ 601 setTimeout(function(){ 602 $('#search_results').removeClass('loading'); 603 loading=false; 604 },500) 605 } 606 }) 607 } 608 } 609 }); 610 611 612 var max_chars = 30; 613 614 $('#search_text').keydown( function(e){ 615 if ($(this).val().length >= max_chars) { 616 $(this).val($(this).val().substr(0, max_chars)); 617 } 618 }); 619 620 $('#search_text').keyup( function(e){ 621 if ($(this).val().length >= max_chars) { 622 $(this).val($(this).val().substr(0, max_chars)); 623 } 624 }); 625 626 function daySlider(){ 627 if($('.day-nav').length){ 628 const slider = document.querySelector('.day-nav .days'); 629 let isDown = false;
630 let startX; 631 let scrollLeft; 632 633 slider.addEventListener('mousedown', (e) => { 634 isDown = true; 635 startX = e.pageX - slider.offsetLeft; 636 scrollLeft = slider.scrollLeft; 637 }); 638 slider.addEventListener('mouseleave', () => { 639 isDown = false; 640 slider.classList.remove('active'); 641 }); 642 slider.addEventListener('mouseup', () => { 643 isDown = false; 644 slider.classList.remove('active'); 645 }); 646 slider.addEventListener('mousemove', (e) => { 647 if(!isDown) return; 648 e.preventDefault(); 649 const x = e.pageX - slider.offsetLeft; 650 const walk = (x - startX); 651 if(walk!=0){ 652 slider.classList.add('active'); 653 } 654 slider.scrollLeft = scrollLeft - walk; 655 }); 656 } 657 } 658 659 660 $(document).on('click','.event_filters li,#search_submit,.months-nav a,.month-day,.events_view .mode',function(e){ 661 e.stopPropagation(); 662 e.preventDefault(); 663 var $this = $(this); 664 665 if (loading) return; 666 loading = true; 667 $('#search_results').addClass('loading'); 668 669 // Zamknij/odÅwież UI filtrów (bez zmian) 670 if($this.parents('.event_filter').length){ 671 $this.parents('.event_filter').slideToggle(200,function(){ 672 $this.parents('.event_filter_holder').toggleClass('active'); 673 }); 674 $this.parents('.event_filter').find('li').removeClass('selected'); 675 $this.addClass('selected'); 676 var current_filter = $this.text(); 677 $this.parents('.event_filter_holder').find('.current_filter span').text(current_filter); 678 } 679 680 var from_date = $('#from_date').attr('data-val'); 681 var to_date = $('#to_date').attr('data-val'); 682 var scope = from_date+','+to_date; 683 var cat = $('.category_filter').find('.selected').attr('data-val'); 684 var loc = $('.location_filter').find('.selected').attr('data-val'); 685 var tag_term = $('.tag_filter').find('.selected').attr('data-val'); 686 var searchterm= $('#search_text').val(); 687 var search_term = searchterm.replace(/</g,"<").replace(/>/g,">"); 688 689 var monthNavVal = '0'; 690 var yearMonthVal = ''; 691 var dayVal = ''; 692 var modeVal = ''; 693 694 // KLUCZ: tryb wyliczamy z klikniÄtego elementu 695 if ($this.hasClass('list_view')) { 696 modeVal = 'list'; 697 } else if ($this.hasClass('block_view')) { 698 modeVal = ''; // kalendarz 699 } else if ($('.events_calendar').hasClass('list-view')) { 700 // jeÅli klik nie byÅ przyciskiem trybu, zachowaj bieÅ¼Ä cy tryb 701 modeVal = 'list'; 702 } 703 704 var searchEvents = '/searchEvents.php'; 705 if($('.events_calendar').length){ 706 searchEvents = '/eventsLoad.php'; 707 708 // nawigacja miesiÄ cami? 709 if($this.parents('.months-nav').length){ 710 monthNavVal = '1'; 711 yearMonthVal = $this.attr('data-month'); 712 dayVal = yearMonthVal + '-01'; 713 } else { 714 yearMonthVal = $('.results').attr('data-month') || ''; 715 } 716 717 // klik w dzieÅ? 718 if($this.parents('.day-nav').length || $this.hasClass('month-day')){ 719 dayVal = $this.attr('data-date') || $('.month-day.active').attr('data-date') || ''; 720 } else if (!dayVal) { 721 dayVal = $('.month-day.active').attr('data-date') || ''; 722 } 723 } 724 725 $.ajax({ 726 type: 'GET', 727 url: templateUrl + searchEvents, 728 cache: true, 729 dataType: 'html', 730 data: { 731 monthNav: monthNavVal, 732 yearMonth: yearMonthVal, 733 scope: scope, 734 from: from_date, 735 to: to_date, 736 category: cat, 737 location: loc, 738 search: search_term, 739 tag: tag_term, 740 language: lang, 741 day: dayVal, 742 mode: modeVal 743 }, 744 success: function(data){ 745 var $data = $(data); 746 747 if($('.events_calendar').length){ 748 // na stronie kalendarza podstawiamy day-nav, months-nav i results 749 var $newDayNav = $data.find('.day-nav').first(); 750 var $newMonths = $data.find('.months-nav').first(); 751 var $results = $data.find('.results').first(); 752 753 if($newDayNav.length){ $('.day-nav').replaceWith($newDayNav); } 754 if($newMonths.length){ $('.months-nav').replaceWith($newMonths); } 755 if($results.length){ $('#search_results .results').replaceWith($results); } 756 757 // aktywacja drag-scroll dnia 758 if (typeof daySlider === 'function') daySlider(); 759 } else { 760 // na listach/siatkach tylko .results 761 var $results = $data.filter('.results'); 762 if(!$results.length) $results = $data.find('.results').first(); 763 if($results.length){ $('#search_results .results').replaceWith($results); } 764 } 765 766 // KLUCZ: ustaw klasÄ wrappera wg aktywnego przycisku 767 if ($this.hasClass('list_view') || $('.list_view').hasClass('active')){ 768 $('#search_results').addClass('events_by_list'); 769 } else { 770 $('#search_results').removeClass('events_by_list'); 771 } 772 773 // Masonry tylko gdy jest blok/siateczka 774 if(!$('.events_calendar').length && $('.block_view').hasClass('active') && typeof masonry === 'function'){ 775 masonry(); 776 } 777 }, 778 complete: function(){ 779 setTimeout(function(){ 780 loading=false; 781 $('#search_results').removeClass('loading'); 782 },500); 783 } 784 }); 785 }); 786 787 788 daySlider(); 789 790/* 791 $('body').on('click',function(){ 792 if(!loading){ 793 if(!$(this).hasClass('ui-datepicker-prev') && !$(this).hasClass('ui-datepicker-next')){ 794 if($('.date_picker_holder').hasClass('active')){ 795 var date_picker_active = $('.date_picker_holder.active'); 796 $('.date_picker_holder.active').children('.ui-datepicker').fadeOut(200); 797 setTimeout(function(){ 798 date_picker_active.removeClass('active'); 799 },200) 800 } 801 if($('.event_filter_holder').hasClass('active')){ 802 var event_holder_active = $('.event_filter_holder.active'); 803 $('.event_filter_holder.active').children('.event_filter').slideUp(200); 804 setTimeout(function(){ 805 event_holder_active.removeClass('active'); 806 },200) 807 } 808 } 809 } 810 }) 811*/ 812 813 $('.em-categories-list a').on('click',function(e){ 814 e.preventDefault(); 815 $('.em-categories-list a').removeClass('selected'); 816 $(this).addClass('selected'); 817 }) 818 819 $('.event_filter_holder:not(active) .current_filter').on('click',function(e){ 820 e.stopPropagation(); 821 822 if(!$(this).parent().hasClass('active')){ 823 if($('.date_picker_holder').hasClass('active')){ 824 var date_picker_active = $('.date_picker_holder.active'); 825 date_picker_active.children('.ui-datepicker').fadeOut(200); 826 setTimeout(function(){ 827 date_picker_active.removeClass('active'); 828 },200) 829 } 830 if($('.event_filter_holder').hasClass('active')){ 831 var event_holder_active = $('.event_filter_holder.active'); 832 event_holder_active.children('.event_filter').slideUp(200); 833 setTimeout(function(){ 834 event_holder_active.removeClass('active'); 835 },200) 836 } 837 } 838 839 $(this).next().slideToggle(200); 840 if($(this).parent('.event_filter_holder').hasClass('active')){ 841 var $this = $(this); 842 setTimeout(function(){ 843 $this.parents('.event_filter_holder').removeClass('active'); 844 },200) 845 }else{ 846 $(this).parent('.event_filter_holder').toggleClass('active'); 847 } 848 }) 849 850 /* FILTER MODE */ 851 $('.list_view').on('click',function(e){ 852 e.preventDefault(); 853 $(this).addClass('active'); 854 $('.block_view').removeClass('active'); 855 $('#search_results').addClass('events_by_list'); 856 $('.events_calendar').addClass('list-view'); 857 }) 858 $('.block_view').on('click',function(e){ 859 e.preventDefault(); 860 $(this).addClass('active'); 861 $('.list_view').removeClass('active'); 862 $('#search_results').removeClass('events_by_list'); 863 $('.events_calendar').removeClass('list-view'); 864 masonry(); 865 }) 866 867 /* DATE FILTER */ 868 $('.date_picker').on('click',function(e){ 869 e.stopPropagation(); 870 871 if(!$(this).parent().hasClass('active')){ 872 if($('.date_picker_holder').hasClass('active')){ 873 var date_picker_active = $('.date_picker_holder.active'); 874 date_picker_active.children('.ui-datepicker').fadeOut(200); 875 setTimeout(function(){ 876 date_picker_active.removeClass('active'); 877 },200) 878 } 879 if($('.event_filter_holder').hasClass('active')){ 880 var event_holder_active = $('.event_filter_holder.active'); 881 event_holder_active.children('.event_filter').slideUp(200); 882 setTimeout(function(){ 883 event_holder_active.removeClass('active'); 884 },200) 885 } 886 } 887 888 $(this).parent('.date_picker_holder').children('.ui-datepicker').stop().fadeToggle(200); 889 $(this).parent('.date_picker_holder').toggleClass('active'); 890 }) 891 892 893 $('.ui-datepicker').on('click',function(e){ 894 e.stopPropagation(); 895 }) 896 897 $('.date_picker_holder').datepicker({ 898 899 onSelect: function(dateText, inst) { 900 901 var day = inst.selectedDay, 902 mon = inst.selectedMonth, 903 year = inst.selectedYear; 904 905 var inst = $(inst.dpDiv).find('[data-year="'+year+'"][data-month="'+mon+'"]').filter(function() { 906 return $(this).find('a').text().trim() == day; 907 }); 908 909 var date = $(this).datepicker('getDate'); 910 var formated_date = $.datepicker.formatDate('yy-mm-dd',date); 911 912 if (inst.hasClass('ui-datepicker-today')){ 913 if($('body').hasClass('en')){ 914 $(this).children('.date_picker').attr('data-val',formated_date).val('Today â '+formated_date); 915 }else{ 916 $(this).children('.date_picker').attr('data-val',formated_date).val('Dzisiaj â '+formated_date); 917 } 918 }else{ 919 $(this).children('.date_picker').attr('data-val',formated_date).val(formated_date); 920 } 921 922 923 var from_date = $('#from_date').attr('data-val'); 924 var to_date = $('#to_date').attr('data-val'); 925 var scope = from_date+','+to_date; 926 var cat = $('.category_filter').find('.selected').attr('data-val'); 927 var loc = $('.location_filter').find('.selected').attr('data-val'); 928 var tag_term = $('.tag_filter').find('.selected').attr('data-val'); 929 var search_term = $('#search_text').val(); 930 931 $(this).find('.ui-datepicker').fadeOut(200); 932 933 setTimeout(function(){ 934 $('.date_picker_holder').removeClass('active'); 935 },200) 936 937 var yearMonthVal = ''; 938 939 var searchEvents = '/searchEvents.php'; 940 if($('.events_calendar').length){ 941 searchEvents = '/eventsLoad.php'; 942 yearMonthVal = $('.results').attr('data-month'); 943 } 944 945 $.ajax({ 946 type: 'GET', 947 data: {yearMonth:yearMonthVal,scope:scope,from:from_date,to:to_date,category:cat,location:loc,search:search_term,tag:tag_term,language:lang}, 948 url: templateUrl+searchEvents, 949 cache: true, 950 dataType: 'html', 951 beforeSend : function(){}, 952 success: function(data){ 953 var $data = $(data); 954 // FIX: tylko .results 955 var $results = $data.filter('.results'); 956 if(!$results.length) $results = $data.find('.results').first(); 957 if($results.length){ 958 $('#search_results .results').replaceWith($results); 959 } 960 // FIX: wrapper zgodnie z trybem 961 if ($('.list_view').hasClass('active')){ 962 $('#search_results').addClass('events_by_list'); 963 } else { 964 $('#search_results').removeClass('events_by_list'); 965 } 966 if($('.block_view').hasClass('active') && typeof masonry === 'function'){ 967 masonry(); 968 } 969 }, 970 complete: function(){ 971 setTimeout(function(){ 972 $('#search_results').removeClass('loading'); 973 loading=false; 974 },500) 975 } 976 }) 977 978 }, 979 dateFormat: 'dd.mm.yy' 980 }); 981 982 983 $('input[readonly]').on('focus', function(ev) { 984 $(this).trigger('blur'); 985 }); 986 987 988 /* NEWS INFINITE SCROLL */ 989 990 loading = false;
991 var numberOfNews = 9; 992 page = 2; 993 994 var load_news = function(){ 995 var $news_wrap = $('.masonry'); 996 if($('.category_page').length){ 997 var cat = $('.category_page').attr('data-cat'); 998 }else{ 999 var cat = ''; 1000 } 1001 1002 $.ajax({ 1003 type : 'GET', 1004 data : {numNews: numberOfNews, pageNumber: page,category: cat, language: lang}, 1005 dataType : 'html', 1006 cache : true, 1007 url : templateUrl+'/newsLoad.php', 1008 success : function(data){ 1009 var $data = $(data).find('.news_loaded >'); 1010 var $pagination = $(data).find('.pagination'); 1011 if($data.length){ 1012 $data.css({opacity:0}); 1013 1014 $('.pagination').replaceWith($pagination); 1015 $data.waitForImages({ 1016 finished: function() { 1017 $news_wrap.append( $data ).isotope( 'appended', $data ); 1018 $data.animate({'opacity':1},400); 1019 }, 1020 waitForAll: true 1021 }); 1022 } 1023 1024 }, 1025 complete : function(){ 1026 setTimeout(function(){ 1027 loading = false; 1028 },500) 1029 } 1030 }); 1031 } 1032 1033 function loadOnScroll(){ 1034 var $window = $(window); 1035 1036 1037 $window.scroll(function() { 1038 if(!loading){ 1039 loading = true; 1040 1041 var $news_wrap = $('.masonry'); 1042 var news_wrap_offset = $news_wrap.offset(); 1043 1044 if($('.pagination .page-numbers').length && !$('.no_more_load').length){ 1045 if(($window.scrollTop() + 1046 $window.height()) > ($news_wrap.scrollTop() + 1047 $news_wrap.height() + news_wrap_offset.top - 460)) { 1048 load_news(); 1049 page++; 1050 } 1051 }else{ 1052 page=3; 1053 } 1054 1055 setTimeout(function(){ 1056 loading = false; 1057 },700) 1058 1059 } 1060 }); 1061 } 1062 1063 if($('.news_page_content').length){ 1064 loadOnScroll(); 1065 } 1066 1067 1068 $('.credits_title').hover(function(){ 1069 $('.credits_holder').addClass('active'); 1070 $('.credits').stop().fadeTo(200,1); 1071 }) 1072 1073 $('.credits_holder').hover(function(){ 1074 },function(){ 1075 if($('.credits_holder.active').length){ 1076 $('.credits_holder').removeClass('active'); 1077 $('.credits').stop().fadeTo(200,0); 1078 } 1079 }) 1080 1081});
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.