1$(document).ready(function () { 2 3 $('.tooltipped').tooltip({ 4 delay: 50, 5 position: 'top' 6 }); 7 8 $('.modal').modal(); 9 10 $('.dropdown-button').dropdown({ 11 belowOrigin: true, // Displays dropdown below the button 12 }); 13 14 // That trigeres select2 error previously 15 //$("select:not(.select2)").material_select(); 16 17 $('ul.tabs').tabs({ 18 swipeable: false 19 }); 20 21 $('.carousel.carousel-slider').carousel({ 22 fullWidth: true 23 }); 24 25 autoplayStart(); 26 27 function autoplayStart() { 28 setTimeout(autoplaySetNextSlide, 10000); 29 setTimeout(autoplaySetNextBanner, 5000); 30 } 31 32 function autoplaySetNextSlide() { 33 $('#mainCarousel.carousel').carousel('next'); 34 setTimeout(autoplaySetNextSlide, 10000); 35 } 36 37 function autoplaySetNextBanner() { 38 $('#bannerCarousel.carousel').carousel('next'); 39 setTimeout(autoplaySetNextBanner, 5000); 40 } 41 42 stickyBanner(); 43}); 44 45function stickyBanner() { 46 // Side banner element 47 let sideBanner = $('#sideBanner.sticky'); 48 49 // Run only if side banner exists and browser width is greater than 1200 50 if (sideBanner.length > 0 && $(window).width() >= 1200) { 51 // Side banner container 52 let mainContainer = sideBanner.parent().parent(); 53 // Side banner original top value 54 let sideBannerOriginalTop = sideBanner.offset().top; 55 // // Side banner container height 56 // let originalParentHeight = mainContainer.height(); 57 58 // Run on load page 59 $(document).ready(function () { 60 // Side banner current bottom with margin 61 let sideBannerBottom = sideBanner.offset().top + 600 + 15; 62 // Side banner container current bottom 63 let parentBottom = mainContainer.offset().top + mainContainer.height(); 64 65 // If banner loaded to bottom of container do nothing 66 if (parentBottom <= sideBannerBottom) { 67 sideBanner.removeClass('fixed bottom'); 68 } else { // Run on scroll event if container is larger than banner 69 setBannerClass(sideBanner, mainContainer, sideBannerOriginalTop); 70 71 $(window).scroll(function () { 72 setBannerClass(sideBanner, mainContainer, sideBannerOriginalTop); 73 }); 74 } 75 }); 76 } 77} 78 79function setBannerClass(sideBanner, mainContainer, sideBannerOriginalTop) { 80 // Side banner current top 81 let sideBannerTop = sideBannerOriginalTop - $(window).scrollTop(); 82 // Side banner current bottom with margin 83 // let sideBannerBottom = sideBanner.offset().top + 600 + 15; 84 // Side banner container current bottom 85 let parentBottom = mainContainer.offset().top + mainContainer.height(); 86 87 // Side banner is scrolled 100px or less to top 88 if (sideBannerTop <= 100) { 89 sideBanner.removeClass('bottom').css('bottom', 'unset').addClass('fixed'); 90 } 91 92 // Side banner is scrolled back to original position 93 if (sideBannerOriginalTop >= $(window).scrollTop() + 100) { 94 sideBanner.removeClass('fixed bottom').css('bottom', 'unset'); 95 } 96 97 // Side banner is scrolled to bottom of the container 98 if ($(window).height() + $(window).scrollTop() - 200 >= parentBottom) { 99 sideBanner.addClass('bottom').css('bottom', $(document).height() - parentBottom).removeClass('fixed'); 100 } 101} 102 103var listType = { 104 setType: (type) => { 105 // Store 106 localStorage.setItem("listType", type); 107 }, 108 getType: () => { 109 // Retrieve from local storage 110 var listType = localStorage.getItem("listType"); 111 return listType; 112 } 113}; 114 115 116var listOfOffers = { 117 autoLoad: () => { 118 if (listType.getType() != undefined) { 119 if (listType.getType() == 'vertical') { 120 let _this = $('.offer-list-switcher .fa-th').parent(); 121 listOfOffers.loadVertical(_this); 122 } else { 123 let _this = $('.offer-list-switcher .fa-th-list').parent(); 124 listOfOffers.loadHorizontal(_this); 125 } 126 } 127 }, 128 129 loadVertical: (_this) => { 130 $('.offer-list-switcher div').removeClass('active blue'); 131 $(_this).addClass('active blue'); 132 133 $('.list-of-offers .offer').addClass('offer-horizontal'); 134 $('.list-of-offers .offer .offer-box-feedback').addClass('up-arrow'); 135 $('.list-of-offers .col').addClass('m6 l4'); 136 listType.setType('vertical'); 137 }, 138 139 loadHorizontal: (_this) => { 140 $('.offer-list-switcher div').removeClass('active blue'); 141 $(_this).addClass('active blue'); 142 143 $('.list-of-offers .offer').removeClass('offer-horizontal'); 144 $('.list-of-offers .offer .offer-box-feedback').removeClass('up-arrow'); 145 $('.list-of-offers .col').removeClass('m6 l4'); 146 listType.setType('horizontal'); 147 }, 148 149 forceHorizontal: () => { 150 console.log('init:forceHorizontal'); 151 $('.list-of-offers .offer').addClass('offer-horizontal'); 152 $('.list-of-offers .offer .offer-box-feedback').addClass('up-arrow'); 153 $('.list-of-offers .col').addClass('m6 l4'); 154 }, 155}; 156 157$(document).ready(function () { 158 159 160 $('.offer-list-switcher .fa-th').parent().click(function () { 161 listOfOffers.loadVertical(this); 162 }); 163 164 $('.offer-list-switcher .fa-th-list').parent().click(function () { 165 listOfOffers.loadHorizontal(this); 166 }); 167 168 listOfOffers.autoLoad(); 169 170 function forceHorizontal() { 171 172 let _this = $('.offer-list-switcher .fa-th').parent(); 173 $('.offer-list-switcher div').removeClass('active blue'); 174 $(_this).addClass('active blue'); 175 176 $('.list-of-offers .offer').addClass('offer-horizontal'); 177 $('.list-of-offers .offer .offer-box-feedback').addClass('up-arrow'); 178 $('.list-of-offers .col').addClass('m6 l3'); 179 180 $('.list-of-offers').removeClass('hide'); 181 } 182 183 /** 184 * Ukrywamy switcher + dajemy obowiazkowo widok kafelkowy 185 */ 186 if (window.innerWidth <= 1000) { 187 forceHorizontal(); 188 $('.offer-list-switcher').remove(); 189 190 } 191}); 192 193 194var setCarouselDimension = () => { 195 const currentPath = window.location.pathname; 196 if (currentPath == '') {
197 let carouselRatio = 500 / 1920;//rozmiar foto do slidera 198 let carouselWidth = $('.carousel-slider').width(); 199 $('.slider').css('height', (carouselRatio * carouselWidth) + 'px'); 200 } else { 201 $('.slider').css('height', 'auto'); 202 } 203}; 204$(document).ready(function () { 205 setCarouselDimension(); 206}); 207$(window).resize(function () { 208 setCarouselDimension(); 209 stickyBanner(); 210}); 211/* main search */ 212$(document).ready(function () { 213 $('#search-dropdown-main-page a').click(function (e) { 214 e.preventDefault(); 215 let type = $(this).data('search-type'); 216 $('.searchType-button span').text(type); 217 $('.searchType-input').val(type); 218 }); 219 220 /* prevent search query */ 221 $('#mainSearch').submit(function (e) { 222 var searchValue = $(this).find("input[name=query]").val(); 223 var numberOfChars = searchValue.length; 224 if (numberOfChars < 3) { 225 e.preventDefault(); 226 Materialize.toast('Enter at least 3 characters', 4000); 227 } 228 }); 229}); 230 231 232/* mobile menu */ 233$(document).ready(function () { 234 var m = $('.mobile-nav-button a'); 235 236 $('.mobile-nav-button').sideNav({ 237 menuWidth: 300, // Default is 300 238 edge: 'left', // Choose the horizontal origin 239 closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor 240 draggable: true, // Choose whether you can drag to open on touch screens, 241 preventScrolling: false, 242 onOpen: function (el) { 243 // $('select').select2("close"); 244 setTimeout(function () { 245 m.find('.fa').removeClass('fa-bars active'); 246 m.find('.fa').addClass('fa-close'); 247 }, 250); 248 }, // A function to be called when sideNav is opened 249 onClose: function (el) { 250 setTimeout(function () { 251 m.find('.fa').addClass('fa-bars active'); 252 m.find('.fa').removeClass('fa-close'); 253 }, 250); 254 }, // A function to be called when sideNav is closed 255 }); 256}); 257 258 259$(document).ready(function () { 260 $(".fadeIn").each(function () { 261 var src = $(this).data("src"); 262 if (src) { 263 var img = new Image(); 264 img.style.opacity = "0"; 265 img.onload = function () { 266 img.style.opacity = "1"; 267 $(this).parent().removeClass('imageLoader'); 268 }; 269 $(this).append(img); 270 img.src = src; 271 } 272 }); 273}); 274 275 276var loader = { 277 on: (thisData) => { 278 thisData.html('<i class="fa fa-circle-o-notch fa-spin m-0"></i>'); 279 thisData.addClass('disabled'); 280 }, 281 off: (thisData) => { 282 setTimeout(function () { 283 thisData.html(oldButton); 284 thisData.removeClass('disabled'); 285 }, 750); 286 } 287}; 288 289 290/********************************/
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.