1jQuery($ => { 2 3 $(document).ready(() => { 4 5 6 7 (function init() { 8 9 anchorSectionFix(); 10 11 activeLogo(); 12 13 slider(); 14 15 //bgSlider(); 16 17 scrollSmooth(); 18 19 postsCarousel(); 20 21 headerFixed(0); 22 23 scrollUpArrow(); 24 25 textBg(); 26 27 iconsFiles(); 28 29 emptyHead(); 30 31 menuArrow(); 32 33 activeMenuFixed(); 34 35 aos(); 36 37 //modal(); 38 39 //pdfViewer(); 40 41 tooltip(); 42 43 selectedOffer(); 44 45 menuCopy(); 46 47 //pannellumViewer(); 48 49 tableResp(); 50 51 loadMore(); 52 53 })(); 54 55 function anchorSectionFix() { 56 const HEADER_OFFSET = 90; // wysokoÅÄ sticky headera w px 57 const DURATION = 900; // czas animacji w ms (zwiÄksz dla wolniejszego efektu) 58 59 // Funkcja easing â easeInOutCubic (pÅynne wejÅcie i wyjÅcie) 60 function easeInOutCubic(t) { 61 return t < 0.5 62 ? 4 * t * t * t 63 : 1 - Math.pow(-2 * t + 2, 3) / 2; 64 } 65 66 function smoothScrollTo(targetY) { 67 const startY = window.scrollY; 68 const distance = targetY - startY; 69 let startTime = null; 70 71 function step(timestamp) { 72 if (!startTime) startTime = timestamp; 73 const elapsed = timestamp - startTime; 74 const progress = Math.min(elapsed / DURATION, 1); 75 const ease = easeInOutCubic(progress); 76 77 window.scrollTo(0, startY + distance * ease); 78 79 if (progress < 1) { 80 requestAnimationFrame(step); 81 } 82 } 83 84 requestAnimationFrame(step); 85 } 86 87 function getTargetTop(target) { 88 return target.getBoundingClientRect().top + window.scrollY - HEADER_OFFSET; 89 } 90 91 // --- 1. PÅynne scrollowanie dla linków na TEJ SAMEJ stronie --- 92 document.querySelectorAll('a[href*="#"]').forEach(function (link) { 93 link.addEventListener('click', function (e) { 94 const url = new URL(link.href); 95 const currentPath = window.location.pathname.replace(/\/$/, ''); 96 const linkPath = url.pathname.replace(/\/$/, ''); 97 const hash = url.hash; 98 99 if (currentPath === linkPath && hash) { 100 const target = document.querySelector(hash); 101 if (target) { 102 e.preventDefault(); 103 history.pushState(null, '', hash); 104 smoothScrollTo(getTargetTop(target)); 105 } 106 } 107 }); 108 }); 109 110 // --- 2. ObsÅuga przyjÅcia z INNEJ podstrony z hashem w URL --- 111 if (window.location.hash) { 112 const target = document.querySelector(window.location.hash); 113 if (target) { 114 setTimeout(function () { 115 smoothScrollTo(getTargetTop(target)); 116 }, 300); 117 } 118 } 119 } 120 121 122 function loadMore() { 123 124 let posts = $('.posts__item'); 125 126 if (posts.length == 0) { 127 128 $('.alm-load-more-btn').hide(); 129 130 } 131 132 } 133 134 135 136 function tableResp() { 137 138 // $('article:not(.types-rejsy):not(.types-cruises):not(.types-kreuzfahrten) table').stacktable(); 139 140 $('article section__schedule___route:not(.section__schedule___route--pd) table').stacktable(); 141 142 } 143 144 145 146 function scrollSmooth() { 147 148 // Select all links with hashes 149 150 $('a[href*="#"]') 151 152 // Remove links that don't actually link to anything 153 154 .not('[href="#"]') 155 156 .not('[href="#0"]') 157 158 .click(function (event) { 159 160 // On-page links 161 162 if ( 163 164 location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 165 166 && 167 168 location.hostname == this.hostname 169 170 ) { 171 172 // Figure out element to scroll to 173 174 var target = $(this.hash); 175 176 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 177 178 // Does a scroll target exist? 179 180 if (target.length) { 181 182 // Only prevent default if animation is actually gonna happen 183 184 event.preventDefault(); 185 186 $('html, body').animate({ 187 188 scrollTop: target.offset().top 189 190 }, 1000, function () { 191 192 // Callback after animation 193 194 // Must change focus! 195 196 var $target = $(target); 197
198 $target.focus(); 199 200 if ($target.is(":focus")) { // Checking if the target was focused 201 202 return false; 203 204 } else { 205 206 $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable 207 208 $target.focus(); // Set focus again 209 210 }; 211 212 }); 213 214 } 215 216 } 217 218 }); 219 220 } 221 222 223 224 function pannellumViewer() { 225 226 pannellum.viewer("panorama", { 227 228 "type": "equirectangular", 229 230 "panorama": "https://pannellum.org/images/alma.jpg" 231 232 }); 233 234 } 235 236 237 238 function activeLogo() { 239 240 if ($('body').hasClass('active-km')) { 241 242 //$('.custom-logo-link').attr('href', '/komunikacja-miejska'); 243 244 } 245 246 else if ($('body').hasClass('active-sp')) { 247 248 $('.custom-logo-link').attr('href', '/stacja-paliw'); 249 250 } 251 252 else if ($('body').hasClass('active-w')) { 253 254 $('.custom-logo-link').attr('href', '/warsztat'); 255 256 } 257 258 } 259 260 261 262 function menuCopy() { 263 264 $('.fixed-navigation').clone().appendTo('.site-header .main-navigation > div'); 265 266 } 267 268 269 270 function selectedOffer() { 271 272 let pageTitle = $('.single-offer .section__header > h1'); 273 274 let options = $('.single-offer .wpcf7-form select[name="your-offer"] > option'); 275 276 for (let i = 0; i < options.length; i++) { 277 278 if ($(options[i]).val() == $(pageTitle[0]).text().trim()) { 279 280 $(options[i]).prop('selected', true); 281 282 } 283 284 } 285 286 } 287 288 289 290 function tooltip() { 291 292 $('[data-toggle="tooltip"]').tooltip(); 293 294 } 295 296 297 298 function slider() { 299 300 $('.slider .slider__items').slick({ 301 302 arrows: false, 303 304 dots: true, 305 306 pauseOnHover: false, 307 308 fade: true, 309 310 speed: 1000, 311 312 autoplaySpeed: 4000, 313 314 infinite: true, 315 316 autoplay: true, 317 318 slidesToShow: 1, 319 320 slidesToScroll: 1, 321 322 prevArrow: '<a type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>', 323 324 nextArrow: '<a type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>' 325 326 }); 327 328 // $('.slider').on('afterChange', function(event, slick, currentSlide) { 329 330 // nextSlide = currentSlide; 331 332 // if (nextSlide !== currSlide) { 333 334 // $('.slick-active').removeClass('animated zoomIn'); 335 336 // $('.slick-active').addClass('hidden'); 337 338 // } 339 340 // }); 341 342 } 343 344 345 346 function bgSlider() { 347 348 $('.slider__video-bg').bgVideo({ 349 350 fullScreen: false, // Sets the video to be fixed to the full window - your <video> and it's container should be direct descendents of the <body> tag 351 352 fadeIn: 0, // Milliseconds to fade video in/out (0 for no fade) 353 354 pauseAfter: 0, // Seconds to play before pausing (0 for forever) 355 356 fadeOnPause: false, // For all (including manual) pauses 357 358 fadeOnEnd: false, // When we've reached the pauseAfter time 359 360 showPausePlay: false, // Show pause/play button 361 362 pausePlayXPos: 'right', // left|right|center 363 364 pausePlayYPos: 'top', // top|bottom|center 365 366 pausePlayXOffset: '15px', // pixels or percent from side - ignored if positioned center 367 368 pausePlayYOffset: '15px' // pixels or percent from top/bottom - ignored if positioned center 369 370 }); 371 372 } 373 374 375 376 function menuArrow() { 377 378 let menuItemHasChildren = $('.menu-item-has-children > a'); 379 380 for (let i = 0; i < menuItemHasChildren.length; i++) { 381 382 $(menuItemHasChildren[i]).append('<i class="fas fa-chevron-down"></i>'); 383 384 } 385 386 } 387 388 389 390 function aos() { 391 392 AOS.init(); 393 394 } 395 396 397 398 function headerFixed(top) { 399 400 let scroll = $(window).scrollTop(); 401 402 let oh = $('.site-header').outerHeight(); 403 404 if (scroll > top) { 405 406 $('body').addClass('header-fixed'); 407 408 $('.site-header').addClass('header-fixed'); 409 410 } else { 411 412 $('body').removeClass('header-fixed'); 413 414 $('.site-header').removeClass('header-fixed'); 415 416 } 417 418 $(window).scroll(function () { 419 420 let scroll = $(window).scrollTop(); 421 422 let oh = $('.site-header').outerHeight(); 423 424 if (scroll > top) { 425 426 $('body').addClass('header-fixed'); 427 428 $('.site-header').addClass('header-fixed'); 429 430 } else { 431 432 $('body').removeClass('header-fixed'); 433 434 $('.site-header').removeClass('header-fixed'); 435 436 } 437 438 }) 439 440 } 441 442 443 444 function postsCarousel() { 445 446 $(".offer-grid-wrap").each(function () { 447 let offerWrap = $(this); 448 449 if (offerWrap.find('.offer-feat').length) { 450 $(offerWrap).addClass('hasfeat'); 451 // console.log($(offerWrap).find('.offer-feat')); 452 } else { 453 $(offerWrap).addClass('nofeat'); 454 } 455 }); 456 457 458 459 $('.offer-grid-wrap.hasfeat .offer-carousel').slick({ 460 infinite: true, 461 462 autoplay: true, 463 464 pauseOnHover: false, 465 466 // centerMode: true, 467 468 adaptiveHeight: true, 469 470 centerPadding: '30px', 471 472 slidesToShow: 3, 473 474 slidesToScroll: 1, 475 476 // dots: true, 477 478 prevArrow: '<a type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>', 479 480 nextArrow: '<a type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>', 481 482 responsive: [ 483 484 { 485 486 breakpoint: 1025, 487 488 settings: { 489 490 slidesToShow: 2, 491 492 slidesToScroll: 1, 493 494 dots: false 495 496 } 497 498 }, 499 500 { 501 502 breakpoint: 769, 503 504 settings: { 505 506 slidesToShow: 1, 507 508 slidesToScroll: 1, 509 510 dots: false 511 512 } 513 514 } 515 516 ], 517 }) 518 519 $('.offer-grid-wrap.nofeat .offer-carousel').slick({ 520 infinite: true, 521 522 autoplay: true, 523 524 // centerMode: true, 525 526 pauseOnHover: false, 527 528 adaptiveHeight: true, 529 530 centerPadding: '30px', 531 532 slidesToShow: 4, 533 534 slidesToScroll: 1, 535 536 // dots: true, 537 538 prevArrow: '<a type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>', 539 540 nextArrow: '<a type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>', 541 542 responsive: [ 543 544 { 545 546 breakpoint: 1025, 547 548 settings: { 549 550 slidesToShow: 2, 551 552 slidesToScroll: 1, 553 554 dots: false 555 556 } 557 558 }, 559 560 { 561 562 breakpoint: 769, 563 564 settings: { 565 566 slidesToShow: 1, 567 568 slidesToScroll: 1, 569 570 dots: false 571 572 } 573 574 } 575 576 ], 577 }) 578 579 $('.logo-carousel').slick({ 580 infinite: true, 581 582 autoplay: true, 583 584 // centerMode: true, 585 586 pauseOnHover: false, 587 588 adaptiveHeight: true, 589 590 centerPadding: '30px', 591 592 slidesToShow: 8, 593 594 slidesToScroll: 1, 595 596 // dots: true, 597 598 prevArrow: '<a type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>', 599 600 nextArrow: '<a type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>', 601 602 responsive: [ 603 604 { 605 606 breakpoint: 1025, 607 608 settings: { 609 610 slidesToShow: 4, 611 612 slidesToScroll: 1, 613 614 dots: false 615 616 } 617 618 }, 619 620 { 621 622 breakpoint: 769, 623 624 settings: { 625 626 slidesToShow: 2, 627 628 slidesToScroll: 1, 629 630 dots: false 631 632 } 633 634 } 635 636 ], 637 }); 638 639 $('.post-carousel').slick({ 640 641 infinite: true, 642 643 // autoplay: true, 644 645 // centerMode: true, 646 647 adaptiveHeight: true, 648 649 centerPadding: '30px', 650 651 slidesToShow: 4, 652 653 slidesToScroll: 1, 654 655 dots: true, 656 657 prevArrow: '<a type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>', 658 659 nextArrow: '<a type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>', 660 661 responsive: [ 662 663 { 664 665 breakpoint: 1025, 666 667 settings: { 668 669 slidesToShow: 2, 670 671 slidesToScroll: 1, 672 673 dots: false 674 675 } 676 677 }, 678 679 { 680 681 breakpoint: 769, 682 683 settings: { 684 685 slidesToShow: 1, 686 687 slidesToScroll: 1, 688 689 dots: false 690 691 } 692 693 } 694 695 ], 696 697 }) 698 699 .on("setPosition", function () { 700 701 resizeSlider(); 702 703 }); 704 705 $(window).on("resize", function (e) { 706 707 resizeSlider(); 708 709 }); 710 711 let slickHeight = $(".slick-track").outerHeight(); 712 713 714 715 let slideHeight = $(".slick-track").find(".slick-slide").outerHeight(); 716 717 718 719 function resizeSlider() { 720 721 $(".slick-track") 722 723 .find(".slick-slide .slide-wrap") 724 725 .css("height", slickHeight + "px"); 726 727 } 728 729 } 730 731 732 733 function scrollUpArrow() { 734 735 $('.scroll-up').click(() => { 736 737 $('html, body').animate({ 738 739 scrollTop: 0 740 741 }, 1000); 742 743 return !1 744 745 }); 746 747 if ($(window).scrollTop() > 100) { 748 749 $('.scroll-up').show() 750 751 } else { 752 753 $('.scroll-up').hide() 754 755 } 756 757 $(window).scroll(function () { 758 759 if ($(this).scrollTop() > 100) { 760 761 $('.scroll-up').show() 762 763 } else { 764 765 $('.scroll-up').hide() 766 767 } 768 769 }) 770 771 } 772 773 774 775 function modal() { 776 777 $('#reservModal').modal({ 778 779 780 781 }) 782 783 } 784 785 786 787 function activeMenuFixed() { 788 789 // let currUrl = location.protocol + '//' + location.host + location.pathname; //without params 790 791 // let currUrlArr = currUrl.split('/'); 792 793 794 795 // let menuFixedItems = $('.fixed-navigation ul > li'); 796 797 798 799 // let postCats = $('body.single-post .entry-meta__cats > a'); 800 801 802 803 // let homeActive = true; 804 805 806 807 // for (let i = 0; i < menuFixedItems.length; i++) { 808 809 // for (let j = 0; j < currUrlArr.length; j++) { 810 811 // if ($(menuFixedItems[i]).find('a').attr('href') != '/') { 812 813 // if ($(menuFixedItems[i]).find('a').attr('href') == ('/' + currUrlArr[j])) { 814 815 // $(menuFixedItems[i]).addClass('current-menu-item'); 816 817 // homeActive = false;
818 819 // } 820 821 // } 822 823 // } 824 825 // } 826 827 828 829 // for (let i = 0; i < menuFixedItems.length; i++) { 830 831 // for (let j = 0; j < postCats.length; j++) { 832 833 // if ($(menuFixedItems[i]).find('a').attr('href') != '/') { 834 835 // let postCatUrl = $(postCats[j]).attr('href') 836 837 // let postCatArr = postCatUrl.split('/'); 838 839 // for (let k = 0; k < postCatArr.length; k++) { 840 841 // if ($(menuFixedItems[i]).find('a').attr('href') == ('/' + postCatArr[k])) { 842 843 // $(menuFixedItems[i]).addClass('current-menu-item'); 844 845 // homeActive = false; 846 847 // } 848 849 // } 850 851 // } 852 853 // } 854 855 // } 856 857 858 859 // if (homeActive) { 860 861 // $(menuFixedItems[0]).addClass('current-menu-item'); 862 863 // } 864 865 866 867 if ($('body').hasClass('active-km')) { 868 869 $('#fixed-menu .menu--km').addClass('current-menu-item'); 870 871 } 872 873 else if ($('body').hasClass('active-sp')) { 874 875 $('#fixed-menu .menu--sp').addClass('current-menu-item'); 876 877 } 878 879 else if ($('body').hasClass('active-w')) { 880 881 $('#fixed-menu .menu--w').addClass('current-menu-item'); 882 883 } 884 885 else if ($('body').hasClass('active-pjm')) { 886 887 $('#fixed-menu .menu--pjm').addClass('current-menu-item'); 888 889 } 890 891 else if ($('body').hasClass('active-wa')) { 892 893 $('#fixed-menu .menu--wa').addClass('current-menu-item'); 894 895 } else { 896 897 $('#fixed-menu .menu--z').addClass('current-menu-item'); 898 899 } 900 901 902 903 } 904 905 906 907 function textBg() { 908 909 $('.sidebar-menu ul > li > a').contents().wrap('<span />'); 910 911 } 912 913 914 915 function iconsFiles() { 916 917 let filesListUrl = $('.site-main__content ul > li a'); 918 919 for (let i = 0; i < filesListUrl.length; i++) { 920 921 let filesListUrlSrc = $(filesListUrl[i]).attr('href'); 922 923 let filesListUrlArr = filesListUrlSrc.split('.'); 924 925 if (filesListUrlArr[filesListUrlArr.length - 1] == 'doc') { 926 927 $(filesListUrl[i]).append('<span class="file-icon"><i class="fas fa-file-word"></i></span>'); //or far 928 929 } 930 931 if (filesListUrlArr[filesListUrlArr.length - 1] == 'pdf') { 932 933 $(filesListUrl[i]).append('<span class="file-icon"><i class="fas fa-file-pdf"></i></span>'); //or far 934 935 } 936 937 } 938 939 } 940 941 942 943 function emptyHead() { 944 945 let headings = $('.site-main__content h1, .site-main__content h2, .site-main__content h3, .site-main__content h4, .site-main__content h5, .site-main__content h6'); 946 947 for (let i = 0; i < headings.length; i++) { 948 949 if ($(headings[i]).text() == '') { 950 951 $(headings[i]).addClass('empty'); 952 953 } 954 955 } 956 957 } 958 959 960 961 function pdfViewer() { 962 963 // If absolute URL from the remote server is provided, configure the CORS 964 965 // header on that server. 966 967 var url = 'https://zegluga.demotest.pl/wp-content/uploads/Linia_nr_16.pdf'; 968 969 970 971 // Loaded via <script> tag, create shortcut to access PDF.js exports. 972 973 var pdfjsLib = window['pdfjs-dist/build/pdf']; 974 975 976 977 // The workerSrc property shall be specified. 978 979 // pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js'; 980 981 982 983 // Asynchronous download of PDF 984 985 var loadingTask = pdfjsLib.getDocument(url); 986 987 loadingTask.promise.then(function (pdf) { 988 989 console.log('PDF loaded'); 990 991 992 993 // Fetch the first page 994 995 // var pageNumber = 1; 996 997 // pdf.getPage(pageNumber).then(function (page) { 998 999 // console.log('Page loaded'); 1000 1001 1002 1003 // var scale = 1.5; 1004 1005 // var viewport = page.getViewport({ scale: scale }); 1006 1007 1008 1009 // // Prepare canvas using PDF page dimensions 1010 1011 // var canvas = document.getElementById('pdf-canvas'); 1012 1013 // var context = canvas.getContext('2d'); 1014 1015 // canvas.height = viewport.height; 1016 1017 // canvas.width = viewport.width; 1018 1019 1020 1021 // // Render PDF page into canvas context 1022 1023 // var renderContext = { 1024 1025 // canvasContext: context, 1026 1027 // viewport: viewport 1028 1029 // }; 1030 1031 // var renderTask = page.render(renderContext); 1032 1033 // renderTask.promise.then(function () { 1034 1035 // console.log('Page rendered'); 1036 1037 // }); 1038 1039 // }); 1040 1041 1042 1043 // Fetch the first page 1044 1045 var pageNumber = 2; 1046 1047 pdf.getPage(pageNumber).then(function (page) { 1048 1049 console.log('Page loaded'); 1050 1051 1052 1053 var scale = 1.5; 1054 1055 var viewport = page.getViewport({ scale: scale }); 1056 1057 1058 1059 // Prepare canvas using PDF page dimensions 1060 1061 var canvas = document.getElementById('pdf-canvas'); 1062 1063 var context = canvas.getContext('2d'); 1064 1065 canvas.height = viewport.height; 1066 1067 canvas.width = viewport.width; 1068 1069 1070 1071 // Render PDF page into canvas context 1072 1073 var renderContext = { 1074 1075 canvasContext: context, 1076 1077 viewport: viewport 1078 1079 }; 1080 1081 var renderTask = page.render(renderContext); 1082 1083 renderTask.promise.then(function () { 1084 1085 console.log('Page rendered'); 1086 1087 }); 1088 1089 }); 1090 1091 1092 1093 1094 1095 }, function (reason) { 1096 1097 // PDF loading error 1098 1099 console.error(reason); 1100 1101 }); 1102 1103 } 1104 1105 1106 1107 }); 1108 1109});
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.