1/** 2* Template Name: Restaurantly - v1.1.0 3* Template URL: https://bootstrapmade.com/restaurantly-restaurant-template/ 4* Author: BootstrapMade.com 5* License: https://bootstrapmade.com/license/ 6*/ 7!(function($) { 8 "use strict"; 9 10 // Chromium has a odd way of handling openstreetmaps, to where the map doesn't load correctly in the iframe, so a an event listener 11 // has been added to wait for the page to load in order for the iframe to be loaded (visible), until then it will remain invisible. 12 $(window).on('load', function() { 13 14 const iframe = document.querySelector('.map_container'); 15 16 if (iframe && iframe.dataset.src) { 17 iframe.addEventListener('load', function() { 18 iframe.classList.add('loaded'); 19 }); 20 21 setTimeout(function() { 22 iframe.classList.add('loaded'); 23 }, 1000); 24 25 iframe.src = iframe.dataset.src; 26 } 27 28 }); 29 30 // Preloader 31 $(window).on('load', function() { 32 if ($('#preloader').length) { 33 $('#preloader').delay(100).fadeOut('slow', function() { 34 $(this).remove(); 35 }); 36 } 37 if (!localStorage.getItem("allowCookies")){ 38 setTimeout( function () { 39 $('#cookies-prompt').show() 40 }, 3000); 41 } 42 }); 43 44 // Smooth scroll for the navigation menu and links with .scrollto classes 45 var scrolltoOffset = $('#header').outerHeight() - 1; 46 $(document).on('click', '.nav-menu a, .mobile-nav a, .scrollto', function(e) { 47 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 48 var target = $(this.hash); 49 if (target.length) { 50 e.preventDefault(); 51 52 var scrollto = target.offset().top - scrolltoOffset; 53 54 if ($(this).attr("href") == '#header') { 55 scrollto = 0; 56 } 57 58 $('html, body').animate({ 59 scrollTop: scrollto 60 }, 1500, 'easeInOutExpo'); 61 62 if ($(this).parents('.nav-menu, .mobile-nav').length) { 63 $('.nav-menu .active, .mobile-nav .active').removeClass('active'); 64 $(this).closest('li').addClass('active'); 65 } 66 67 if ($('body').hasClass('mobile-nav-active')) { 68 $('body').removeClass('mobile-nav-active'); 69 $('.mobile-nav-overly').fadeOut(); 70 } 71 return false; 72 } 73 } 74 }); 75 76 // Activate smooth scroll on page load with hash links in the url 77 $(document).ready(function() { 78 if (window.location.hash) { 79 var initial_nav = window.location.hash; 80 if ($(initial_nav).length) { 81 var scrollto = $(initial_nav).offset().top - scrolltoOffset; 82 $('html, body').animate({ 83 scrollTop: scrollto 84 }, 1500, 'easeInOutExpo'); 85 } 86 } 87 const offers = $('.offers-ribbon .offer'); 88 const totalOffers = offers.length; 89 if (totalOffers > 3) { 90 offers.clone().slice(0, 4).map(function() { 91 $(this).addClass('hidden-phone hidden-tablet'); 92 return this; 93 }).appendTo($('.offers-ribbon .scroll')); 94 $('.offers-ribbon .nav').css('display', 'flex'); 95 } 96 97 }); 98 99 100 let offerPos = 0; 101 let offerAnimating = false; 102 $(document).on('click', '.offers-ribbon .nav.left', function(e) { 103 if (!offerAnimating) { 104 const scroll = $('.offers-ribbon .scroll'); 105 const offers = $('.offers-ribbon .offer'); 106 const totalOffers = offers.length; 107 if (offerPos === 0) { 108 offerPos = totalOffers - 4; 109 scroll.scrollLeft( 110 scroll.scrollLeft() + offers.eq(offerPos).position().left, 111 ); 112 } 113 const nextOffer = offerPos - 1; 114 const offerOffset = offers.eq(nextOffer).position(); 115 116 offerAnimating = true; 117 scroll.animate({ 118 scrollLeft: scroll.scrollLeft() + offerOffset.left, 119 }, 450, function() { 120 offerAnimating = false; 121 }); 122 123 offerPos = nextOffer; 124 } 125 }); 126 127 128 $(document).on('click', '.offers-ribbon .nav.right', function(e) { 129 if (!offerAnimating) { 130 const scroll = $('.offers-ribbon .scroll'); 131 const offers = $('.offers-ribbon .offer'); 132 const totalOffers = offers.length; 133 const nextOffer = offerPos + 1; 134 const offerOffset = offers.eq(nextOffer).position(); 135 136 offerAnimating = true; 137 scroll.animate({ 138 scrollLeft: scroll.scrollLeft() + offerOffset.left, 139 }, 450, function() { 140 offerAnimating = false; 141 if (nextOffer === totalOffers - 4) {
142 scroll.scrollLeft(0); 143 offerPos = 0; 144 } 145 }); 146 147 offerPos = nextOffer; 148 } 149 }); 150 151 $('#book-a-table select').on('change', function() { 152 $(this).css('color', $(this).val() === '' ? '#a49b89' : 'white') 153 }) 154 155 // Mobile Navigation 156 if ($('.nav-menu').length) { 157 var $mobile_nav = $('.nav-menu').clone().prop({ 158 class: 'mobile-nav d-lg-none' 159 }); 160 $('body').append($mobile_nav); 161 $('.mobile-nav').prepend('<button type="button" class="mobile-nav-close"><i class="icofont-close"></i></button>'); 162 $('#header').append('<button type="button" class="mobile-nav-toggle d-lg-none"><i class="icofont-navigation-menu"></i></button>'); 163 $('body').append('<div class="mobile-nav-overly"></div>'); 164 165 $(document).on('click', '.mobile-nav-toggle', function(e) { 166 $('body').toggleClass('mobile-nav-active'); 167 $('.mobile-nav-overly').toggle(); 168 }); 169 170 $(document).on('click', '.mobile-nav-close', function(e) { 171 $('body').removeClass('mobile-nav-active'); 172 $('.mobile-nav-overly').fadeOut(); 173 }); 174 175 $(document).on('click', '.mobile-nav .drop-down > a', function(e) { 176 e.preventDefault(); 177 $(this).next().slideToggle(300); 178 $(this).parent().toggleClass('active'); 179 }); 180 181 $(document).click(function(e) { 182 var container = $(".mobile-nav, .mobile-nav-toggle"); 183 if (!container.is(e.target) && container.has(e.target).length === 0) { 184 if ($('body').hasClass('mobile-nav-active')) { 185 $('body').removeClass('mobile-nav-active'); 186 $('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close'); 187 $('.mobile-nav-overly').fadeOut(); 188 } 189 } 190 }); 191 } else if ($(".mobile-nav, .mobile-nav-toggle").length) { 192 $(".mobile-nav, .mobile-nav-toggle").hide(); 193 } 194 195 function toggleStatusBanner() { 196 const banner = $('.status-banner'); 197 const promoVisible = !$('body').hasClass('promo-is-hidden') && $('#promo').length; 198 const promoHeight = promoVisible ? $('#promo').outerHeight() : 0; 199 const scrollTop = $(window).scrollTop(); 200 const threshold = banner.outerHeight(true) + promoHeight; 201 } 202 203 $(window).on('scroll', toggleStatusBanner); 204 $(window).on('load', toggleStatusBanner); 205 toggleStatusBanner(); 206 207 // Toggle .header-scrolled class to #header when page is scrolled 208 $(window).scroll(function() { 209 if ($(this).scrollTop() >= 0) { 210 $('#header').addClass('header-scrolled'); 211 $('#topbar').addClass('topbar-scrolled'); 212 } else { 213 $('#header').removeClass('header-scrolled'); 214 $('#topbar').removeClass('topbar-scrolled'); 215 } 216 }); 217 218 if ($(window).scrollTop() >= 0) { 219 $('#header').addClass('header-scrolled'); 220 $('#topbar').addClass('topbar-scrolled'); 221 } 222 223 // Navigation active state on scroll 224 var nav_sections = $('section'); 225 var main_nav = $('.nav-menu, .mobile-nav'); 226 227 $(window).on('scroll', function() { 228 var cur_pos = $(this).scrollTop() + 200; 229 230 nav_sections.each(function() { 231 var top = $(this).offset().top, 232 bottom = top + $(this).outerHeight(); 233 234 if (cur_pos >= top && cur_pos <= bottom) { 235 if (cur_pos <= bottom) { 236 main_nav.find('li').removeClass('active'); 237 } 238 main_nav.find('a[href="#' + $(this).attr('id') + '"]').parent('li').addClass('active'); 239 } 240 if (cur_pos < 300) { 241 $(".nav-menu ul:first li:first").addClass('active'); 242 } 243 }); 244 }); 245 246 // Back to top button 247 $(window).scroll(function() { 248 if ($(this).scrollTop() > 100) { 249 $('.back-to-top').fadeIn('slow'); 250 } else { 251 $('.back-to-top').fadeOut('slow'); 252 } 253 }); 254 255 $('.back-to-top').click(function() { 256 $('html, body').animate({ 257 scrollTop: 0 258 }, 1500, 'easeInOutExpo'); 259 return false; 260 }); 261 262 // Menu list isotope and filter 263 $(window).on('load', function() { 264 var menuIsotope = $('.menu-container').isotope({ 265 itemSelector: '.menu-item', 266 layoutMode: 'fitRows' 267 });
268 269 $('#menu-flters li').on('click', function() { 270 $("#menu-flters li").removeClass('filter-active'); 271 $(this).addClass('filter-active'); 272 273 menuIsotope.isotope({ 274 filter: $(this).data('filter') 275 }); 276 aos_init(); 277 }); 278 }); 279 280 // Events carousel (uses the Owl Carousel library) 281 $(".events-carousel").owlCarousel({ 282 autoplay: true, 283 dots: true, 284 loop: true, 285 items: 1 286 }); 287 288 // Testimonials carousel (uses the Owl Carousel library) 289 $(".testimonials-carousel, .slideshow-carousel").owlCarousel({ 290 autoplay: true, 291 dots: true, 292 loop: true, 293 autoplayTimeout: 6000, 294 responsive: { 295 0: { 296 items: 1 297 }, 298 768: { 299 items: 2 300 }, 301 900: { 302 items: 3 303 } 304 } 305 }); 306 307 // Initiate venobox lightbox 308 $(document).ready(function() { 309 $('.venobox').venobox(); 310 }); 311 312 // Init AOS 313 function aos_init() { 314 AOS.init({ 315 duration: 1000, 316 once: true 317 }); 318 } 319 $(window).on('load', function() { 320 aos_init(); 321 }); 322 323 $('#reject-cookies').on('click', function() { 324 localStorage.setItem("allowCookies", "false"); 325 window.location.reload(); 326 }); 327 328 $('#allow-cookies').on('click', function() { 329 localStorage.setItem("allowCookies", "true"); 330 $('#cookies-prompt').hide(); 331 }); 332 333})(jQuery);
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.