Array ( [USER] => amb111anceleme2t [HOME] => /home/amb111anceleme2t [SCRIPT_NAME] => /index.php [REQUEST_URI] => /api/js/b3.js?t1714114729 [QUERY_STRING] => m=api/js/b3.js&t1714114729 [REQUEST_METHOD] => GET [SERVER_PROTOCOL] => HTTP/1.1 [GATEWAY_INTERFACE] => CGI/1.1 [REDIRECT_QUERY_STRING] => m=api/js/b3.js&t1714114729 [REDIRECT_URL] => /api/js/b3.js [REMOTE_PORT] => 64515 [SCRIPT_FILENAME] => /home/amb111anceleme2t/public_html/index.php [SERVER_ADMIN] => webmaster@ambianceelements.com [CONTEXT_DOCUMENT_ROOT] => /home/amb111anceleme2t/public_html [CONTEXT_PREFIX] => [REQUEST_SCHEME] => https [DOCUMENT_ROOT] => /home/amb111anceleme2t/public_html [REMOTE_ADDR] => 18.218.127.141 [SERVER_PORT] => 443 [SERVER_ADDR] => 51.91.62.179 [SERVER_NAME] => ambianceelements.com [SERVER_SOFTWARE] => Apache [SERVER_SIGNATURE] => [PATH] => /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin [HTTP_X_HTTPS] => 1 [HTTP_HOST] => ambianceelements.com [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) [HTTP_ACCEPT] => */* [proxy-nokeepalive] => 1 [SSL_TLS_SNI] => ambianceelements.com [HTTPS] => on [SCRIPT_URI] => https://ambianceelements.com/api/js/b3.js [SCRIPT_URL] => /api/js/b3.js [UNIQUE_ID] => ZjjibCf4NT3BDjw7caamrQAAAUw [REDIRECT_STATUS] => 200 [REDIRECT_SSL_TLS_SNI] => ambianceelements.com [REDIRECT_HTTPS] => on [REDIRECT_SCRIPT_URI] => https://ambianceelements.com/api/js/b3.js [REDIRECT_SCRIPT_URL] => /api/js/b3.js [REDIRECT_UNIQUE_ID] => ZjjibCf4NT3BDjw7caamrQAAAUw [FCGI_ROLE] => RESPONDER [PHP_SELF] => /index.php [REQUEST_TIME_FLOAT] => 1715004012.2516 [REQUEST_TIME] => 1715004012 [argv] => Array ( [0] => m=api/js/b3.js&t1714114729 ) [argc] => 1 ) var modalCounter; modalCounter = 1; var isLogin = false; var forPing = []; var meetDeliveryMinimum; var mainContentLoaded; var scrolledFromTop; var currentCoordinates = []; var refreshDriverPosition; var afterLoadGoTo; var scrolledPositionOnProducts; /*! jQuery & Zepto Lazy v1.7.4 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2016 Daniel 'Eisbehr' Kern */ !function(t,e){"use strict";function r(r,a,i,l,u){function f(){L=t.devicePixelRatio>1,c(i),a.delay>=0&&setTimeout(function(){s(!0)},a.delay),(a.delay<0||a.combined)&&(l.e=v(a.throttle,function(t){"resize"===t.type&&(w=B=-1),s(t.all)}),l.a=function(t){c(t),i.push.apply(i,t)},l.g=function(){return i=n(i).filter(function(){return!n(this).data(a.loadedName)})},l.f=function(t){for(var e=0;ee.top&&-ne.left&&-n=0?w:w=n(t).width()}function h(){return B>=0?B:B=n(t).height()}function m(t){return t.tagName.toLowerCase()}function b(t,e){if(e){var r=t.split(",");t="";for(var a=0,n=r.length;at||!a.enableThrottle||l?u():n=setTimeout(u,t-f)}}function p(){--z,i.length||z||y("onFinishedAll")}function y(t,e,n){return!!(t=a[t])&&(t.apply(r,[].slice.call(arguments,1)),!0)}var z=0,w=-1,B=-1,L=!1,T="afterLoad",D="load",I="error",N="img",E="src",F="srcset",C="sizes",O="background-image";"event"==a.bind||o?f():n(t).on(D+"."+u,f)}function a(a,o){var l=this,u=n.extend({},l.config,o),f={},c=u.name+"-"+ ++i;return l.config=function(t,r){return r===e?u[t]:(u[t]=r,l)},l.addItems=function(t){return f.a&&f.a("string"===n.type(t)?n(t):t),l},l.getItems=function(){return f.g?f.g():{}},l.update=function(t){return f.e&&f.e({},!t),l},l.force=function(t){return f.f&&f.f("string"===n.type(t)?n(t):t),l},l.loadAll=function(){return f.e&&f.e({all:!0},!0),l},l.destroy=function(){return n(u.appendScroll).off("."+c,f.e),n(t).off("."+c),f={},e},r(l,u,a,f,c),u.chainable?a:l}var n=t.jQuery||t.Zepto,i=0,o=!1;n.fn.Lazy=n.fn.lazy=function(t){return new a(this,t)},n.Lazy=n.lazy=function(t,r,i){if(n.isFunction(r)&&(i=r,r=[]),n.isFunction(i)){t=n.isArray(t)?t:[t],r=n.isArray(r)?r:[r];for(var o=a.prototype.config,l=o._f||(o._f={}),u=0,f=t.length;u'); $('.dynamicLink').data('data',data); $('.dynamicLink').trigger('click'); $('.dynamicLink').remove(); } window.addEventListener("message", receiveMessage, false); function receiveMessage(event) { if (event.data.f == 'instagramwidget'){ $('.iframeInstagram').css('height',event.data.height); } } function showSuccessMessage(object){ if ($('.messagesPanel').length == 0){ $('body').append('
'); } $('.messagesPanel').html('
'+object.message+'
').addClass('show'); setTimeout(function(){ $('.messagesPanel').removeClass('show'); }, object.timeout); } function BrandPage() { this.brands = []; this.init = function(){ $('html').addClass('loading'); try{ ajaxForBrands.abort(); }catch(exc){ } ajaxForBrands = $.ajax({ context: this, timeout: 2000, error: function(){ this.init(); }, url: 'https://b3.my/api/store/getBrands.php?sessionGet='+readCookie('sessionId'), success: function(d){ $('html').removeClass('loading'); $('.brandsPlaceholder').html(d); } }); } } (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); window.fbAsyncInit = function() { FB.init({ appId : readCookie('restaurantfacebookId'), xfbml : true, version : 'v2.8' }); }; WolfFacebookLogin = Array("clockcafe.com.cy"); function loginWithFacebook(){ try{ FB.init({ appId : readCookie('restaurantfacebookId'), xfbml : true, version : 'v2.8' }); }catch(exc){ } FB.login(function(response) { dataResponse = response; FB.api('/me', 'get',{ access_token: response.authResponse.accessToken, fields: 'id,first_name,last_name' }, function(response) { dataResponse = dataResponse; dataResponse.data = response; $.ajax({ url: 'https://api.b3eats.com/login?method=facebook&sessionGet='+readCookie('sessionId'), data: dataResponse, type: 'post', success: function(d){ if (d.action == 'refresh'){ window.location.reload(); } } }) }); }, {scope: 'public_profile,email'}); } disableOthers = function(){ basePrice = parseFloat($('.basePrice').val()); if (isNaN(basePrice)){ basePrice = 0; } $('.modalFormItem .modifierClass').each(function(){ settings = $(this); if (settings.data('max') != settings.data('min')){ if (settings.data('max')){ if (settings.find('input:checked:not(.subModifierItem)').length >= settings.data('max')){ settings.find('input:not(:checked):not(.subModifierItem)').each(function(){ thisBox = $(this); if ($(this).attr('type') != 'radio'){ thisBox.addClass('disabled').prop('disabled',true); } }); //settings.find('input:not(:checked):not(.subModifierItem)').addClass('disabled').prop('disabled',true); settings.removeClass('requiredWarning'); }else{ settings.find('input:not(:checked)').removeClass('disabled').prop('disabled',false); } } }else{ if (settings.data('max')){ selectedInput = 0; checkedInput = settings.find('input:checked'); checkedInput.each(function(){ if ($(this).closest('.comboItemModifier').length == 0){ selectedInput++; } }); if (selectedInput >= settings.data('max')){ settings.find('input:not(:checked):not([type=radio]):not(.modifierInComboItem)').addClass('disabled').prop('disabled',true); }else{ settings.find('input:not(:checked)').removeClass('disabled').prop('disabled',false); } } } }); $('.modifierItem input').each(function(){ if ($(this).is(':checked')){ if ($(this).data('price') != '' && $(this).data('price') !== undefined){ basePrice = basePrice + parseFloat($(this).data('price')); } } }); quantityVariable = $('.quantityVariableDropdown option:selected').val(); if (isNaN(quantityVariable)){ quantityVariable = 1; } quantity = parseFloat($('.quantityCounter').html()); if ($('.quantityCounter').html() == ''){ quantity = parseFloat($('.quantityCounter').val()); } //$('.btnAddToBasket').data('singleprice',basePrice.toFixed(2)).attr('data-singleprice',basePrice.toFixed(2)); $('.totalFoodPrice').html((quantity*basePrice*quantityVariable).toFixed(2)); } $(document).on('click','.list-controls-mobile',function(e){ e.preventDefault(); $('.categeoryFiltersContainer').toggleClass('isVisible'); if ($('.categeoryFiltersContainer').hasClass('isVisible')){ $('.categeoryFiltersContainer').before('
'); $('html').addClass('modal-open'); }else{ $('html').removeClass('modal-open'); $('.overlayWolf').remove(); } }); refreshCartRetail = function(withMethod){ page = 'cart'; if (window.location.pathname.includes('checkout')){ page = 'checkout'; } try{ refreshingCartRetail.abort(); }catch(exc){ } refreshingCartRetail = $.ajax({ url: 'https://b3.my/api/store/cart.php', data: ({'sessionId':readCookie('sessionId'),'page':'cart','currentLink':window.location.pathname}), type:'post', success: function(d){ //console.log(d); try{ $('body').loading('stop'); }catch(exc){ } if (d.totalBasket == 0){ $('.basketTotalNumber').hide(); }else{ $('.basketTotalNumber').show().html(d.totalBasket); } $('body.category .cartPage').css('height',$('.mainContent').height()); $('.cartPage').html(d.html); if ($('.cartFixedAlways').length == 0){ $('body').append('
'); } $('.cart').css('width',$('.cartPage').width()); $('.cartFixedAlways').html('
'+d.html+'
'); $(window).trigger('resize'); } }); } changePaymentMethod = function(method,callback){ try{ changeMethodAjax.abort(); }catch(exc){ } linkForCart = 'https://api.b3eats.com/getCart' $('.btnConfirmOrder').addClass('disabled').prop('disabled',true); $('.secondaryContent').append('
'); changeMethodAjax = $.ajax({ url: linkForCart, type: 'post', data: ({'v':1,'method':method,'action':'changePaymentMethod','website':'wolf','session':readCookie('sessionId')}), cache: false, timouet: 500, error: function(){ changePaymentMethod(method,callback); }, success: function(d){ try{ refreshCartAjax.abort(); }catch(exc){ } $('.couponCode').trigger('keyup'); paymentMethodSelected = method; refreshCartAjax = $.ajax({ url: linkForCart+'?page=checkout', data: ({'method':'json','session':readCookie('sessionId')}), type: 'post', cache: false, success: function(d){ $('.secondaryContent .loading__indicator').remove(); $('.btnConfirmOrder').removeClass('disabled').prop('disabled',false); $('.popover.tour').fadeOut('fast',function(){ $(this).remove(); }); try{ $('.wolfDiscountCard').html(d.wolfDiscount.discountFinalAmount); }catch(exc){ } try{ $('.wolfDiscountCash').html(d.normalDiscount.discountFinalAmount); }catch(exc){ } $('html').removeClass('loading'); try{ $('.contentCart .body').html(d.itemsOnly); }catch(exc){ } } }); } }); } changeMethod = function(method,callback,andPostCode,andAddressId){ $('.cartMain .loading__indicator').remove(); try{ changeMethodAjax.abort(); }catch(exc){ } linkForCart = 'https://api.b3eats.com/getCart'; //$('html').addClass('loading'); $('.popover.tour').remove(); try{ if (method == 'takeaway'){ $('.popover.tour').fadeOut('fast',function(){ $(this).remove(); }); $('.postcodeAndTime').show(); tourPostCode.end(); }else{ //setPostCode($('.PostCodeMask').val(),null); } }catch(exc){ } data = {'orderMethod':method,'action':'changeMethod','session':readCookie('sessionId')}; if ($('.changeMethodPopup').length > 0){ data.responseMethod = 'json'; if (method == 'delivery'){ data.orderMethod = method; data.postCode = $.trim($('.PostCodeMask:last').val()); }else{ data.restaurantToSendOrder = $('.changeTakeAwayRestaurant.selected:last').data('id'); } } methodTried = 'takeaway'; if ($('.changeMethodPopup').length > 0 && $('.selectMethodInTab.active').data('val') == 'delivery'){ if ($('.PostCodeMask').val() != ''){ data.savePostCode = true; delete data.action ; methodTried = 'delivery'; data.orderMethod = 'delivery'; data.postCode = $('.PostCodeMask').val(); } } if (andPostCode !== undefined){ data.savePostCode = true; delete data.action ; methodTried = 'delivery'; data.postCodeFrom = 'algolia'; data.orderMethod = 'delivery'; data.postCode = andPostCode; if (andAddressId !== undefined){ data.andAddressId = andAddressId; } } changeMethodAjax = $.ajax({ url: linkForCart, type: 'post', data: (data), timeout: 3000, error: function(){ changeMethod(method,callback); }, cache: false, success: function(d){ if ($('.changeMethodPopup').length > 0 || andPostCode !== undefined){ $('.btnSaveSettings').removeClass('is-loading'); if (d.method == 'delivery' || methodTried == 'delivery'){ if (d.deliveryInArea){ loadMenu(); $('.weCanDeliver').show(); $('.weCannotDeliver').hide(); $('.changeMethodPopup').closest('.modal').modal('hide'); refreshCart(); }else{ if ($('.changeMethodPopup').length > 0){ $('.weCannotDeliver').show(); $('.weCanDeliver').hide(); $('.PostCodeMask').addClass('error'); }else{ openModalWithLink('https://api.b3eats.com/modal/notDelivered?postCode='+postCode+'&bootstrap=4&sessionGet='+readCookie('sessionId')); } $('.btnDetectLocation').removeClass('is-loading'); } }else{ loadMenu(); $('.changeMethodPopup').closest('.modal').modal('hide'); refreshCart(); } }else{ $('html').removeClass('loading'); $('.cartList').html(d); } } }); } errorGeoLocation = function(error){ if (error.code == 1){ createCookie('geolocationStatus','denied',365); } } function intersect(a, b) { var t; if (b.length > a.length) t = b, b = a, a = t; // indexOf to loop over shorter return a.filter(function (e) { return b.indexOf(e) > -1; }); } hideSpinner = function(){ $('.spinnerBox.fixed').remove(); $('body').removeClass('modalOpen'); } openModalWithLinkOld = function(link,data){ $this = $(this); $('html').addClass('loadingModal'); modalCounter++; $.ajax({ url: link, cache: false, type: 'post', success: function(d){ $('html').removeClass('loadingModal'); try{ if ($this.hasClass('closeOtherModals')){ $('.modalAjax').modal('hide'); } }catch(exc){ } id = 'modal' + modalCounter; $('html').removeClass('loading'); $('body').append(''); $('#'+id+'').modal({backdrop: 'static', keyboard: false}).modal('show'); $('body').addClass('modal-open'); } }); return false; } openModalWithText = function(text,additionalClass,modalBuilt){ $('html').addClass('loading loadingModal'); if (typeof modalCounter == 'undefined'){ modalCounter = 0; } modalCounter++; if (typeof modalBuilt == 'undefined'){ modalBuilt = true; } id = 'modal' + modalCounter; $('html').removeClass('loading loadingModal'); try{ if ($this.hasClass('closeOtherModals')){ $('.modalAjax').modal('hide'); } }catch(exc){ } id = 'modal' + modalCounter; $('html').removeClass('loading'); $('body').addClass('modal-open'); if (typeof text == 'object'){ text = text.html; } if (text.includes('modal-dialog')){ $('body').append(''); }else{ $('body').append(''); } $('#'+id+'').modal({backdrop: 'static', keyboard: false}).modal('show'); $('#'+id+' .closeButton').each(function(k,v){ console.log($(v).closest('.modal').find('.modal-content').prepend($(v))); }) } openModalWithLink = function(link,data){ $this = $(this); $('html').addClass('loading loadingModal'); if (typeof modalCounter == 'undefined'){ modalCounter = 0; } modalCounter++; zIndex = 'default'; try{ if (data.aboveIntercom){ window.intercomSettings.hide_default_launcher = true; Intercom('update'); zIndex = '2147483648'; } }catch(exc){ } createClasses = link.split('.php'); linkForClasses = createClasses[0]; createClasses = linkForClasses.split('/'); createClassName = ''; $.each(createClasses,function(key,val){ val = val.replace(".php", ""); val = val.split('?'); createClassName = createClassName + ' ' + val[0]; }); $.ajax({ url: link, type: 'post', cache: false, context: ({'className':createClassName}), error: function(e,v){ console.log(v) $('html').removeClass('loading loadingModal'); toastr.info('Something went wrong! Please try again in a while'); }, success: function(d){ $('html').removeClass('loading loadingModal'); try{ if ($this.hasClass('closeOtherModals')){ $('.modalAjax').modal('hide'); } }catch(exc){ } openModalWithText(d,this.className,false); return false; id = 'modal' + modalCounter; $('html').removeClass('loading'); $('body').append(''); $('#'+id+'').modal({backdrop: 'static', keyboard: false}).modal('show'); $('html').addClass('modal-open'); } }); return false; } $(document).off('click','.viewCartMobileLink').on('click','.viewCartMobileLink',function(e){ $('.order-online-row .cartList').toggleClass('active'); }); $(document).off('click','.tabs-nav .openNavMenu, .tabs-app .openNavMenu').on('click','.tabs-nav .openNavMenu, .tabs-app .openNavMenu',function(e){ $('.nav-bg').toggleClass('isVisible'); $('nav.navbar').toggleClass('mobileVisible'); setTimeout(function(){ $('nav.navbar .navbar-collapse').toggleClass('isVisibleMobile'); }, 100); }); $(document).off('click','.closeNavMenu').on('click','.closeNavMenu',function(e){ $('nav.navbar .navbar-collapse').removeClass('isVisibleMobile'); setTimeout(function(){ $('.nav-bg').removeClass('isVisible'); $('nav.navbar').removeClass('mobileVisible'); }, 100); }); trackPage = function(){ try{ pingB3FirstTime(); }catch(ex){ } try{ //var rellax = new Rellax('.rellax', { // center:true //}); }catch(exc){ } setTimeout(function(){ try{ _paq.push(['setCustomUrl', window.location.href]); _paq.push(['setDocumentTitle', document.title]); _paq.push(['trackPageView']); }catch(ex){ } }, 300); } $(document).off('click','.tabs-nav .openBasket, .showBasket').on('click','.tabs-nav .openBasket, .showBasket',function(e){ $('.cartFixedAlways').toggleClass('visible'); if ($('.cartFixedAlways').hasClass('visible')){ $('.cartFixedAlways').addClass('visible'); $('.cartFixedAlways').before('
'); $('html').addClass('modal-open'); }else{ $('html').removeClass('modal-open'); $('.overlayWolf').remove(); } }); $(document).off('click','.tabs-nav .openAccount, ul .openAccount').on('click','.tabs-nav .openAccount, ul .openAccount',function(e){ e.preventDefault(); if (isLogin != true){ openModalWithLink('https://b3.my/api/store/modal.php?bootstrap=4&file=login&sessionGet='+readCookie('sessionId')); } }); $(document).off('click','.tabs-app .openAccount').on('click','.tabs-app .openAccount',function(e){ e.preventDefault(); if (isLogin != true){ wolfRegisterLoginModal(); }else{ openLink('/dashboard'); } }); var isGroupOrder; var isSandbox; $(document).off('click','.menuPageItem, .orderOnlineV2 .basketCartItems .foodName').on('click','.menuPageItem, .orderOnlineV2 .basketCartItems .foodName',function(e){ $this = $(this); modeForItem = ''; itemId = ''; product = $this.data('item'); if ($(this).hasClass('foodName')){ modeForItem = 'edit'; itemId = $this.data('id'); product = $this.data('product'); } console.log('ts'); if ($(e.target).hasClass('btnActionItem')){ return false; } if ($(e.target).hasClass('btnDuplicateProduct')){ return false; } if ($(e.target).hasClass('addNewProductButton')){ return false; } if ($(e.target).hasClass('btnImportModifiers')){ return false; } if ($(this).hasClass('isNotVisibleClass')){ return false; } try{ if (nowSelectingProducts == true){ return false; } }catch(exc){ } if (isGroupOrder == true && isLogin == false){ showLoginRegisterModal(); return false; } if (isGroupOrder){ try{ if (groupOrderOrderingFrom != nowOrderingFrom){ openModalWithText(modalOtherGroupCartDetails); return false; } }catch(exc){ } if (groupOrderCompleted == true){ $('.modalPromptCompletedGroupOrder').modal('show'); return false; } if (organisedCheckingOut == true){ app.toast.create({ position: 'center', text: 'Organiser is checking out! You cannot add more items!', closeTimeout: 2000, }).open(); return false; } } if ($this.hasClass('soldout')){ return false; } $('html').addClass('loading'); //itemPriceDiv = $(this).find('.item-price'); //itemPriceDiv.addClass('is-loading'); linkForModal = window.location.origin +'/wolfFood'; $('html').addClass('loadingModal'); if (isSandbox && window.location.hostname == 'app.wolf.ooo'){ dynamicSheetFood = app.sheet.create({ swipeToClose: true, closeByOutsideClick: true, swipeHandler: '.modalProductHeading', content: '
'+ ''+ '
'+ '
', // Events on: { close: function(){ $('body').css('position','relative').css('top','-0px'); $('.overlayWolf').trigger('click'); $('html').removeClass('modal-open'); $('html,body').scrollTop(scrolledBeforeModal); }, open: function (sheet) { scrolledBeforeModal = $('html').scrollTop(); //$('html').addClass('modal-open'); $('body').css('position','fixed').css('top','-'+scrolledBeforeModal+'px'); $('.mainContent').addClass('foodModalOpened'); $('.appHeader').addClass('isWhite'); setTimeout(function(){ $('html,body').scrollTop(scrolledBeforeModal); $('body').addClass('stickyHeader'); $('.appHeader').addClass('isWhite'); //$('html').addClass('modal-open'); }, 100); }, opened: function (sheet) { $('.appHeader').addClass('isWhite'); }, } }); dynamicSheetFood.open(); //$('.overlay-sidebar-location').after('
'); $.ajax({ url: linkForModal, data: ({'venueID':venueID,'cartId':itemId,'mode':modeForItem,'item':product,'session':readCookie('sessionId')}), type: 'post', context: ({'foodItem':$this}), timeout: 19500, error: function(){ toastr.info('Something went wrong. Please try again.'); $('html').removeClass('loading loadingModal'); //$this.trigger('click'); }, success: function(d){ $('.sheet-modal.location .sheet-modal-inner').html(d); $('html').removeClass('loading loadingModal'); $('.subproduct.modifierItem:first').trigger('click'); } }); return false; } if ($('#modalFood').length == 0){ $('body').append(''); } continueSilentUpdate = false; theTarget = $(e.target); //console.log(theTarget); openSubproduct = theTarget.data('subproduct'); //alert(openSubproduct); if ($this.data('modalhtml') != undefined && $this.data('modalhtml') != 'loading'){ $('#modalFood').html($this.data('modalhtml')).modal('show'); $('html').removeClass('loading'); if (theTarget.data('subproduct')){ //console.log($('.subproduct.modifierItem[data-item="'+openSubproduct+'"]')); setTimeout(function(){ $('.subproduct.modifierItem[data-item="'+openSubproduct+'"]').trigger('click'); }, 50); }else{ $('.subproduct.modifierItem:first').trigger('click'); } continueSilentUpdate = true; } if ($(this).data('venue') != 'undefined'){ venueID = $(this).data('venue'); } $.ajax({ url: linkForModal, data: ({'venueID':venueID,'cartId':itemId,'mode':modeForItem,'item':product,'session':readCookie('sessionId')}), type: 'post', context: ({'foodItem':$this}), timeout: 19500, error: function(){ toastr.info('Something went wrong. Please try again.'); $('html').removeClass('loading'); //$this.trigger('click'); }, success: function(d){ try{ _paq.push(['setCustomUrl', window.location.href +'/wolfFood']); _paq.push(['setDocumentTitle', 'Open Food: ' +$this.data('title')]); _paq.push(['trackPageView']); }catch(exc){ } if (continueSilentUpdate){ if (d.action != 'askfordelivery'){ this.foodItem.data('modalhtml',d); } }else{ if (d.action == 'askfordelivery'){ try{ thenOpenFood = d.thenOpenFood; }catch(exc){ } $('html').removeClass('loading'); //$('.setupMyLocation').trigger('click'); $('.bottomModal').html(d.html); $('body').addClass('overlay-enabled');$('.bottomModal').addClass('isVisible');$('.bottomModal').before('
'); //openModalWithLink('https://wolf.ooo/api/changeDeliverySeetings.php?sessionGet='+readCookie('sessionId'),{aboveIntercom:true}); }else{ if (d.showModal == false){ $('html').removeClass('loading'); refreshCart(); }else{ $('html').removeClass('loading'); $('#modalFood').html(d).modal('show'); $('.modalFoodLikeWolf').closest('#modalFood').addClass('modalFoodLikeWolfParent'); if (theTarget.data('subproduct')){ //console.log($('.subproduct.modifierItem[data-item="'+openSubproduct+'"]')); setTimeout(function(){ $('.subproduct.modifierItem[data-item="'+openSubproduct+'"]').trigger('click'); }, 50); }else{ $('.subproduct.modifierItem:first').trigger('click'); } } } } } }); }); $(document).off('click','.manageItem').on('click','.manageItem',function(e){ e.preventDefault(); if ($('.overlay-sidebar-edit').length == 0){ $('body').append('
'); } $('.overlay-sidebar-edit').removeClass('hiddenSidebar'); $('body').addClass('overlay-enabled'); id = $(this).closest('.menuPageItem').data('item'); $('.overlay-sidebar-edit').after('
'); $('.overlay-sidebar-edit').html('
'); if ($(this).data('id')){ id = $(this).data('id'); } try{ editingProduct.abort(); }catch(exc){ } editingProduct = $.ajax({ url: window.location.host+'/editItemAPI', type: 'post', cache: false, data: ({'id':id,'session':readCookie('sessionId')}), success: function(d){ $('.overlay-sidebar-edit').html(d.html); } }); }); $(document).off('change','.modifierItem').on('change','.modifierItem',function(){ try{ basePrice = parseFloat($('.basePrice').val()); }catch(exc){ basePrice = 0; } try{ //checkForError(); }catch(exc){ } if (isNaN(basePrice)){ basePrice = 0; } modifierItem = $(this); settings = $(this).closest('.modifierClass'); findInput = $(this).find('input'); hasSubModifiers = false; if (modifierItem.find('.subModifier').length > 0){ hasSubModifiers = true; } if (findInput.is(':checkbox')){ if (settings.data('max')){ if (settings.find('input:checked:not(.subModifierItem)').length >= settings.data('max')){ settings.find('input:not(:checked):not(.subModifierItem)').each(function(){ thisBox = $(this); if ($(this).attr('type') != 'radio'){ thisBox.addClass('disabled').prop('disabled',true); } }); settings.removeClass('requiredWarning'); }else{ settings.find('input:not(:checked)').removeClass('disabled').prop('disabled',false); } } } /* isSubmodifier = $(this).closest('.subModifier').length; settings.find('.subModifier').hide(); if (isSubmodifier){ thisSubModifier = $(this).closest('.subModifier'); settings.find('.subModifier').hide(); settings.find('.subModifier').not(thisSubModifier).find('input.b3Checkbox').prop('checked',false); } */ $('.modifierItem input').each(function(){ if ($(this).is(':checked')){ if (modifierItem.find('.subModifier').length > 0){ modifierItem.find('.subModifier').show(); } if (isNaN($(this).data('price'))){ }else{ basePrice = basePrice + parseFloat($(this).data('price')); } } }); $('.modifierItem input:not(.subModifierItem)').each(function(){ modifierItem = $(this).closest('.modifierItem'); if ($(this).is(':checked')){ modifierItem.find('.subModifier').show(); }else{ modifierItem.find('.subModifier').hide(); modifierItem.find('.subModifier').find('input.b3Checkbox').prop('checked',false); } }); quantity = parseFloat($('.quantityCounter').html()); if (quantity == ''){ quantity = parseFloat($('.quantityCounter').val()); } if (isNaN(quantity)){ quantity = parseFloat($('.quantityCounter').val()); } $('.btnAddToBasket').data('singleprice',basePrice.toFixed(2)).attr('data-singleprice',basePrice.toFixed(2)); $('.totalFoodPrice').html((quantity*basePrice).toFixed(2)); }); calculateFood = function(){ quantityVariable = $('.quantityVariableDropdown option:selected').val(); if (isNaN(quantityVariable)){ quantityVariable = 1; } singleprice = parseFloat($('.btnAddToBasket').data('singleprice')); //console.log(quantityVariable); //console.log(singleprice); //console.log(newNumber); $('.selectedQuantity').html(newNumber); $('.totalFoodPrice').html((quantityVariable*singleprice*newNumber).toFixed(2)); $('.quantityBox [name="quantity"]').val(newNumber); disableOthers(); } calculateFood2 = function(){ singleprice = parseFloat($('.btnAddToBasket').data('singleprice')); $('.selectedQuantity').html(newNumber); quantityVariable = $('.quantityVariableDropdown option:selected').val(); if (isNaN(quantityVariable)){ quantityVariable = 1; } quantityVariable = parseFloat(quantityVariable); if (typeof quantityVariable === 'undefined'){ quantityVariable = 1; } $('.totalFoodPrice').html((quantityVariable*singleprice*newNumber).toFixed(2)); $('.quantityBox [name="quantity"]').val(newNumber); //disableOthers(); //hasError = checkForError(); } checkForError = function(){ hasError = false; $('.modifierClass h3').removeClass('animated shake'); $('.modifierClass').removeClass('requiredWarning'); $('.modifierClass').each(function(){ minimum = $(this).data('min'); $this = $(this); selected = $(this).find('input:checked').length; if (minimum != ''){ if (selected < minimum){ hasError = true; $this.find('h3').animateCss('headShake'); $(this).addClass('requiredWarning'); } } }); return hasError; } performLoginActions = function(d){ try{ if (d.newSessionID){ createCookie('sessionId',d.newSessionID,1000); } }catch(exc){ } // $('.orderTabContent').remove(); //openLink(window.location.pathname+window.location.search); //$('html').removeClass('loading'); setTimeout(function(){ $('.modalAjax').modal('hide'); }, 400); openLink(window.location.pathname); if (window.location.search.includes('&r=')){ reDirectTo = window.location.search.split('r=')[1]; $.ajax({ method: 'post', cache: false, url: 'https://wolf.ooo/api/joinGroupOrder.php', data: ({'url':reDirectTo,'session':readCookie('sessionId')}), success: function(d){ openLink(window.location.pathname); } }); return false; } } var searchedValue; var jumpTo; var scrollingInMenu = scrollingInMenu2 = 0; getMyAddresses = function(){ try{ $.ajax({ url: "/loginMethodsAPI", type: 'post', cache: false, data: ({'action':'getMyAddresses','sessionId':readCookie('sessionId'),'currentPage':window.location.pathname}), success: function(d){ if (d.size == 0){ $('.myAddressesPlaceholder').hide(); }else{ $('.suggestedPlaceholder').hide(); $('.myAddressesPlaceholder').html(d.html).show(); } } }); }catch(exc){ } } $(function(){ try{ trackPage(); }catch(exc){ } $(document).keydown(function(e){ try{ if (e.keyCode == 27){ if ($('html').hasClass('searching')){ $('.searchResults.inline').hide(); $('html').removeClass('searching'); return false; } if ($('.searchView').is(':visible')){ $('.closeSearchFuction').trigger('click'); return false; } $('.modal:last').modal('hide'); if ($('#modalFood').is(':visible')){ $('#modalFood').modal('hide'); } } }catch(exc){ } }); $(document).off('click','.closeFoodModalRight').on('click','.closeFoodModalRight',function(){ $(this).closest('.modal').modal('hide'); }); $.expr[':'].wolfcontains = $.expr.createPseudo(function(text) { return function(e) { return $(e).text().toUpperCase().indexOf(text.toUpperCase()) >= 0; }; }); $(document).off('click','.openMobileCartWolf').on('click','.openMobileCartWolf',function(){ $('.CartColMd').addClass('isOpen'); $('html').addClass('cartIsOpen'); }); $(document).off('click','.openModalWithLink').on('click','.openModalWithLink',function(){ href = $(this).attr('href'); openModalWithLink(href+'&sessionGet='+readCookie('sessionId')); return false; }); $(document).off('click','.selectManual').on('click','.selectManual',function(){ openModalWithLink('https://wolf.ooo/api/addNewAddressBeta.php?sessionGet='+readCookie('sessionId')); return false; }); $(document).off('click','.changeLanguageAjax').on('click','.changeLanguageAjax',function(e){ e.preventDefault(); language = $(this).data('lang'); $.ajax({ url: window.location.host+'/editItemAPI', data: ({'session':readCookie('sessionId'),'action':'changeLanguage','language':language}), type: 'post', success: function (){ openLink(window.location.pathname); } }); return false; }); $(document).off('click','.deliveryDateTime').on('click','.deliveryDateTime',function(e){ if (window.location.pathname.includes('/checkout')){ if (isLogin){ openModalWithLink('https://wolf.ooo/api/modal/changeDeliveryTime?sessionGet='+readCookie('sessionId')+'&set='+$(this).data('set')); }else{ wolfRegisterLoginModal(); } }else{ openModalWithLink('https://wolf.ooo/api/modal/changeDeliveryTime?sessionGet='+readCookie('sessionId')+'&set='+$(this).data('set')); } //openModalWithText(); }); $(document).on('click','.scrollMenuLeft',function(){ scrollingInMenu2 = $('.topSearchCategories .menuUL').scrollLeft() - $('.topSearchCategories .menuUL').width(); console.log(scrollingInMenu2); $('.topSearchCategories .menuUL').animate( { scrollLeft: scrollingInMenu2 }, 200); }); $(document).on('click','.scrollMenuRight',function(){ maximumToGo = -($('.menuCategories').width()-$('.catList').width() + 40); scrollingInMenu = scrollingInMenu - ($('.catContainer').width() - 50); if (maximumToGo > scrollingInMenu){ scrollingInMenu = maximumToGo; } //$('.menuCategories').css('transform','translateX('+scrollingInMenu+'px)'); maximumToGo = -($('.topSearchCategories .menuUL').width()-$('.menuScrolling').width() + 40); console.log(scrollingInMenu2); scrollingInMenu2 = scrollingInMenu2 - ($('.menuScrolling').width() - 200); if (maximumToGo > scrollingInMenu2){ scrollingInMenu2 = maximumToGo; } scrollingInMenu2 = $('.topSearchCategories .menuUL').scrollLeft() + $('.topSearchCategories .menuUL').width(); $('.topSearchCategories .menuUL').animate( { scrollLeft: '+='+scrollingInMenu2 }, 100); }); $(document).off('click','.orderIsDelivery').on('click','.orderIsDelivery', function(){ $('.selectOrderMode').closest('.modal').modal('hide'); openModalWithLink('/locationMapViewAPI?&sessionGet='+readCookie('sessionId')); }); $(document).off('click','.setLocationFromDropdown').on('click','.setLocationFromDropdown',function(e){ e.preventDefault(); $this = $(this); coordinates = $(this).data('coordinates'); if (coordinates == 'retriveThem'){ $.ajax({ url: "/loginMethodsAPI", type: 'post', data: ({'action':'getPlaceCoordinates','placeID':$this.data('placeid')}), success: function(d){ openModalWithLink('https://wolf.ooo/api/addNewAddressBeta.php?coordinates='+d.coordinates+'&sessionGet='+readCookie('sessionId')); return false; } }); return false; } openModalWithLink('https://wolf.ooo/api/addNewAddressBeta.php?coordinates='+coordinates+'&sessionGet='+readCookie('sessionId')); }); $(document).off('keyup focus','.locationInSidebarInput, .locationSearch').on('keyup focus','.locationInSidebarInput, .locationSearch',function(){ $this = $(this); try{ clearTimeout(searchLocationRequest); }catch(exc){ } searchLocationRequest = setTimeout(function(){ val = $.trim($this.val()); $locationResults = $this.closest('.formLocation').find('.locationResults'); if (val == ''){ $locationResults.hide(); $('.gpsAndRecent').show(); $('.loadingLocationInModal').hide(); searchedValue = ''; try{ searchLocationAutocomplete.abort(); }catch(exc){ } return false; } if (searchedValue == val){ return false; } //console.log($locationResults); try{ searchLocationAutocomplete.abort(); }catch(exc){ } $('.loadingLocationInModal').show(); $('.gpsAndRecent').hide(); $locationResults.hide(); appendToDiv = $locationResults.find('ul'); searchLocationAutocomplete = $.ajax({ url: 'https://wolf.ooo/api/v1/locations?country=1&mode=homepage&limit=30&session='+readCookie('sessionId')+'&query='+val+'&playerId='+readCookie('playerId'), context: ({'searched':val}), type: 'post', success: function(d){ appendToDiv.html(''); searchedValue = this.searched; data = d.data; if (data.length == 0){ appendToDiv.append('
No results
'); } for (index = 0; index < data.length; ++index) { locationRow = data[index]; suggestionTitle = ''+data[index].title+ ''; locationID = locationRow.objectID; if (locationRow.postCode != '' && locationRow.postCode != 'null'){ suggestionTitle = ''+suggestionTitle + '
'; if (locationRow.description != ''){ suggestionTitle = suggestionTitle+ locationRow.description; if (locationRow.postCode != 'null' && locationRow.postCode != '' && locationRow.postCode != undefined){ suggestionTitle = suggestionTitle + ' - ' + locationRow.postCode; } }else{ suggestionTitle = suggestionTitle+locationRow.postCode; } } //console.log(appendToDiv); titleForAutocomplete = suggestionTitle.replace('
', ', '); titleForAutocomplete = (new DOMParser).parseFromString(titleForAutocomplete, "text/html").documentElement.textContent; additionlAttr = ''; if (data[index].suggestion == 'google'){ additionlAttr = 'data-placeid="'+data[index].place_id+'"'; } appendToDiv.append('
  • '+suggestionTitle+'
  • '); } $('.loadingLocationInModal').hide(); $locationResults.show(); $(window).trigger('resize'); if (data.length > 0){ $('.gpsAndRecent').hide(); }else{ $('.gpsAndRecent').show(); } } }); }, 400); }); $(document).on('click','.findCurrentLocation', function (e) { $('.findCurrentLocation').addClass('isFinding'); navigator.geolocation.getCurrentPosition(function(position){ selectedAddressFromGoogle = ''; try{ map.setCenter(new google.maps.LatLng( parseFloat(position.coords.latitude), parseFloat(position.coords.longitude))); $('.findCurrentLocation').removeClass('isFinding'); google.maps.event.trigger(map, 'dragend', {}); }catch(exc){ mapBox.setCenter( {lng: position.coords.longitude, lat: position.coords.latitude}); mapBox.setZoom(15); $('.findCurrentLocation').removeClass('isFinding'); } },function(error) { //console.log(error); $('.selectedLocation').trigger('click'); $('.appNavigation a:first').trigger('click'); }, { enableHighAccuracy: true,maximumAge:0, timeout: 20e3}); }); $(document).off('click','.haveACouponCode').on('click','.haveACouponCode',function(){ openModalWithLink('https://wolf.ooo/api/modal/couponCode?sessionGet='+readCookie('sessionId')); }); $(document).on('click','.changeQuantityMinus',function(){ if (typeof editBasketItem == 'undefined'){ editBasketItem = false; } currentQuantity = $('.quantityCounter').data('val'); if ($('.quantityCounter').is(':input')){ currentQuantity = parseInt($('.quantityCounter').val()); } newNumber = currentQuantity - 1 if (editBasketItem == true){ if (newNumber <= 0) newNumber = 0; }else{ if (newNumber <= 1) newNumber = 1; } $('.quantityCounter').data('val',newNumber); $('.quantityCounter').html(newNumber); if ($('.quantityCounter').is(':input')){ $('.quantityCounter').val(newNumber); } disableOthers(); calculateFood2(); }); $(document).on('click','.changeQuantityPlus',function(){ limit = $(this).closest('.quantityBox').data('limit'); if (limit == ''){ limit = 999; } currentQuantity = $('.quantityCounter').data('val'); if ($('.quantityCounter').is(':input')){ currentQuantity = parseInt($('.quantityCounter').val()); } newNumber = currentQuantity + 1 if (newNumber > limit){ newNumber = limit; } $('.quantityCounter').data('val',newNumber); $('.quantityCounter').html(newNumber); if ($('.quantityCounter').is(':input')){ $('.quantityCounter').val(newNumber); } disableOthers(); calculateFood2(); }); $(document).off('click','.myPreviousAddress').on('click','.myPreviousAddress',function(){ deliveryToPreviousAddress = $(this).data('id'); if ($(this).data('address') != '' && $(this).data('address') != 'undefined'){ deliveryToPreviousAddress = $(this).data('address'); } $('html').addClass('loading'); $.ajax({ url: 'https://api.b3eats.com/getCart', type: 'post', cache: false, data: ({'method':'delivery','action':'deliveryToPreviousAddress','addressId':deliveryToPreviousAddress,'session':readCookie('sessionId')}), success: function(d){ try{ $('.formLocation').closest('.modal').modal('hide'); }catch(exc){ } try{ $('.selectOrderMode').closest('.modal').modal('hide'); }catch(exc){ } changeMethod('delivery'); openLink(window.location.pathname); } }); }); $(document).off('click','.selectPreviousAddressButton').on('click','.selectPreviousAddressButton',function(){ deliveryToPreviousAddress = $(this).data('id'); $('html').addClass('loading'); $.ajax({ url: 'https://api.b3eats.com/getCart', type: 'post', cache: false, data: ({'method':'delivery','action':'deliveryToPreviousAddress','addressId':deliveryToPreviousAddress,'session':readCookie('sessionId')}), success: function(d){ loadMenu(); } }); }); $(document).off('click','.selectPreviousAddressWidget').on('click','.selectPreviousAddressWidget',function(){ deliveryToPreviousAddress = $(this).data('id'); $('html').addClass('loading'); $.ajax({ url: 'https://api.b3eats.com/getCart', type: 'post', cache: false, data: ({'method':'delivery','action':'deliveryToPreviousAddress','addressId':deliveryToPreviousAddress,'session':readCookie('sessionId')}), success: function(d){ changeMethod('delivery'); openLink('/online-order'); } }); }); $(document).off('click','.btnSetPickup').on('click','.btnSetPickup',function(){ id = $(this).data('id'); $('html').addClass('loading'); $.ajax({ url: 'https://api.b3eats.com/getCart', type: 'post', cache: false, data: ({'action':'changeMethod','method':'takeaway','restaurantToSendOrder':id,'session':readCookie('sessionId')}), success: function(d){ openLink('/online-order'); } }); }); $(document).off('submit','.formPostCodeHomePage').on('submit','.formPostCodeHomePage',function(e){ console.log(e); $('.btnSearchPostCodeWidget').trigger('click'); return false; }); $('.btnSearchPostCodeWidget').click(function(e){ postCode = $.trim($('.postcodeHomepage').val()); if (postCode == ''){ $('.postcodeHomepage').addClass('error'); return false; } $('.postcodeHomepage').removeClass('error'); $('.btnSearchPostCode').addClass('is-loading'); setPostCodeAjax = $.ajax({ url: window.location.origin+'/getCartAPI', type: 'post', data: ({'postCode':postCode,'savePostCode':true,'session':readCookie('sessionId')}), cache: false, success: function(d){ if (d.deliveryInArea == true){ openLink('/online-order'); }else{ $('.cannotDeliver').slideDown(); $('.btnSearchPostCode').removeClass('is-loading'); } } }); }); $(document).off('click','.logoutBtnRetail, .logoutBtnDashboard').on('click','.logoutBtnRetail, .logoutBtnDashboard',function(e){ e.preventDefault(); $('html').addClass('loading'); $.ajax({ url: 'https://b3.my/api/store/logout.php', data: ({'sessionId':readCookie('sessionId'),'action':'logout'}), type:'post', success: function(d){ openLink(window.location.pathname+window.location.search); } }); }); $(document).off('click','footer .custom__item-inner h4').on('click','footer .custom__item-inner h4',function(){ $(this).parent().find('.menu').toggleClass('visible'); }); if (window.location.pathname == "/password/reset" || window.location.search.includes('resetPassword')){ openModalWithLink('https://api.b3eats.com/modal/newpassword?bootstrap=4&sessionGet='+readCookie('sessionId')+'&'+window.location.search.substring(1)); openLink('/'); return false; } try{ refreshCartRetail(); }catch(exc){ } $(document).off('click','.formSearch i').on('click','.formSearch i',function(e){ $('.formSearch').trigger('submit'); }); $(document).on('click','.btnAddToBasketB4',function(e){ e.preventDefault(); $this = $(this); hasError = checkForError(); linkForAddFood = 'https://b3.my/api/store/addToCart.php'; currentLi = $(this).closest('li'); form = $(this).closest('form').serialize(); form = form + '&session='+readCookie('sessionId'); if (!hasError){ amount = $(this).data('value'); $(this).addClass('is-loading'); //$('.cartList').addClass('
    '); try{ fbq('track', 'AddToCart ', {currency: "EUR", value: amount}); }catch(exc){ } $.ajax({ url: linkForAddFood, data: form, timeout: 10000, error: function(){ $this.trigger('click'); }, type: 'post', success: function(d){ if (d.totalBasket == 0){ $('.basketTotalNumber').hide(); }else{ $('.basketTotalNumber').show().html(d.totalBasket); } toastr.success('Added to cart', '', { timeOut: 1000,showDuration: 150,hideDuration: 150,"positionClass": "toast-top-center" }); $('.btnAddToBasketB4').removeClass('is-loading'); //$this.replaceWith('Go to Basket'); //currentLi.find('.cart-button button').remove(); pingB3FirstTime(); try{ refreshCartRetail(); }catch(exc){ } try{ history.replaceState("", document.title, window.location.pathname+window.location.search); }catch(exc){ } } }); } }); $(document).off('click','.eshopElements .signin, .signInStore').on('click','.eshopElements .signin, .signInStore',function(e){ e.preventDefault(); openModalWithLink('https://b3.my/api/store/modal.php?bootstrap=4&file=login&sessionGet='+readCookie('sessionId')); }); $(document).off('click','.b3shop .createAccount').on('click','.b3shop .createAccount',function(e){ e.preventDefault(); $('.modalAjax').modal('hide'); openModalWithLink('https://b3.my/api/store/modal.php?bootstrap=4&file=register&sessionGet='+readCookie('sessionId')); }); $(document).off('submit','.formSearch').on('submit','.formSearch',function(e){ findParent = $(this).closest('div').find('.searchTerm'); //console.log(findParent); currentPage = 1; e.preventDefault(); openLink('/search/?q='+findParent.val()+"&"); $('.searchResults').hide(); $('html').removeClass('searching'); return false; }); $.fn.serializeAny = function() { var ret = []; $.each( $(this).find(':input'), function() { if ($(this).is(":radio")){ if ($(this).is(":checked")){ ret.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( $(this).val() ) ); }else{ //ret.push( encodeURIComponent(this.name) + "=0"); } }else{ if ($(this).is(':checkbox')){ if ($(this).is(":checked")){ ret.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( $(this).val() ) ); }else{ ret.push( encodeURIComponent(this.name) + "=0"); } }else{ ret.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( $(this).val() ) ); } } }); return ret.join("&").replace(/%20/g, "+"); } $(document).on('click', function (e) { target = $(e.target); if (target.closest('form.search').length == 0){ $('.searchResults.inline').hide(); $('html').removeClass('searching'); } }); $('body').on('click', function (e) { target = $(e.target); //console.log(target.closest('form.search')); if ($(e.target).hasClass('overlayWolf')){ $('html').removeClass('modal-open'); $('.cartFixedAlways').removeClass('visible'); $('.cardAbsoluteDetails').addClass('hidden'); $('.modalDeliveryTime').removeClass('isVisible'); $('.overlay-sidebar-location').addClass('hiddenSidebar'); $('.overlay-sidebar-edit').addClass('hiddenSidebar'); $('.bottomModal').removeClass('isVisible'); $('.overlay-sidebar-filters').addClass('hiddenSidebar'); $('.overlay-sidebar-login').addClass('hiddenSidebar'); $('.overlayWolf').remove(); $('body').removeClass('overlay-enabled'); } }); $.expr[':'].icontains = $.expr.createPseudo(function(text) { return function(e) { return $(e).text().toUpperCase().indexOf(text.toUpperCase()) >= 0; }; }); $.fn.extend({ animateCss: function (animationName) { var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; this.addClass('animated ' + animationName).one(animationEnd, function() { $(this).removeClass('animated ' + animationName); }); } }); var $docEl = $('html, body'); $wrap = $('.content'); $.lockBody = function() { if(window.pageYOffset) { scrollTop = window.pageYOffset; $wrap.css({ top: - (scrollTop) }); } $docEl.css({ height: "100%", overflow: "hidden" }); } $.unlockBody = function() { $docEl.css({ height: "", overflow: "" }); $wrap.css({ top: '' }); window.scrollTo(0, scrollTop); window.setTimeout(function () { scrollTop = null; }, 0); } $(document).on("hidden.bs.modal",".modalAjax",function () { $(this).remove(); }); $(document).on("click",".view-basket",function () { $('.order-online-row .cartList').toggleClass('active'); }); $(document).on('click','.counterModifier .minusItem',function(e){ e.preventDefault(); closestCounterModifier = $(this).closest('.counterModifier'); inputNext =closestCounterModifier.find('.inputModifierQuantity'); currentModifierQuantity = parseFloat(inputNext.val()); currentModifierQuantity = currentModifierQuantity - 1; checkboxToduplicate = closestCounterModifier.closest('.modifierItem').find('.b3Checkbox:first'); findCheckbox = closestCounterModifier.closest('.modifierItem').find('.b3Checkbox:first').clone(); closestCounterModifier.find('.otherModifiers').html(''); if (currentModifierQuantity > 1){ for (i = 1; i < currentModifierQuantity; i++) { closestCounterModifier.find('.otherModifiers').append(checkboxToduplicate.clone()); } } if (currentModifierQuantity == 0){ closestCounterModifier.closest('.modifierItem').find('.b3Checkbox').prop('checked',false); disableOthers(); return false; } disableOthers(); inputNext.val(currentModifierQuantity); }); $(document).on('click','.counterModifier .plusItem',function(e){ e.preventDefault(); closestModifierClass = $(this).closest('.modifierClass'); closestCounterModifier = $(this).closest('.counterModifier'); inputNext = closestCounterModifier.find('.inputModifierQuantity'); findCheckbox = closestCounterModifier.closest('.modifierItem').find('.b3Checkbox:first').clone(); if (closestModifierClass.data('max') != ''){ if (closestModifierClass.data('max') == closestModifierClass.find('input:checked').length){ disableOthers(); return false; } } closestCounterModifier.find('.otherModifiers').append(findCheckbox); disableOthers(); if (closestModifierClass.data('max') != ''){ if (closestModifierClass.data('max') < closestModifierClass.find('input:checked').length){ return false; } } currentModifierQuantity = parseFloat(inputNext.val()); currentModifierQuantity = currentModifierQuantity + 1; inputNext.val(currentModifierQuantity); }); $(document).off('click','.closeOtherModals').on('click','.closeOtherModals',function(e){ $('.modalAjax').modal('hide'); }); $(document).off('click','.closeThisModal').on('click','.closeThisModal',function(){ $(this).closest('.modal').modal('hide'); }); $(document).off('click','.closeThisSidebar').on('click','.closeThisSidebar',function(e){ if ($('.overlay-sidebar-edit').hasClass('hiddenSidebar')){ }else{ $('.overlayWolf').trigger('click'); } $('.overlay-sidebar-edit').removeClass('hiddenSidebar'); }); $(document).on('click','.ajaxModal',function(e){ e.preventDefault(); $this = $(this); modalCounter++; $('html').addClass('loading'); link = $this.attr('href'); if (link.indexOf("?") !== -1){ link = link+'&bootstrap=4'; }else{ link = link+'?bootstrap=4'; } $.ajax({ url: link, data: ({'item':$this.data('item'),'session':readCookie('sessionId')}), type: 'post', success: function(d){ if ($this.hasClass('closeOtherModals')){ $('.modalAjax').modal('hide'); } id = 'modal' + modalCounter; $('html').removeClass('loading'); $('body').append(''); $('#'+id+'').modal('show'); $('body').addClass('modal-open'); } }); return false; }); $(document).on('click','.plusQuantity',function(){ currentQuantity = $('.quantityCounter').data('val'); newNumber = currentQuantity + 1 $('.quantityCounter').data('val',newNumber); $('.quantityCounter').html(newNumber); calculateFood(); }); $(document).on('click','.minusQuantity',function(){ currentQuantity = $('.quantityCounter').data('val'); newNumber = currentQuantity - 1 if (newNumber <= 1) newNumber = 1; $('.quantityCounter').data('val',newNumber); $('.quantityCounter').html(newNumber); calculateFood(); }); pingB3FirstTime = function(callback){ dataForPing = ({ 'sessionId' : readCookie('sessionId'), 'domain' : window.location.host, }); dataForPing = jQuery.extend(dataForPing, forPing); $.ajax({ url: 'https://api.b3eats.com/ping', data: dataForPing, cache: false, timeout: 10000, error: function(d){ //pingB3Eats(); }, type: 'post', success: function(d){ try{ if (d.isLogin == true){ isLogin = true; } }catch(exc){ } isBot = d.isBot; if (d.restaurantfacebookId){ createCookie('restaurantfacebookId',d.restaurantfacebookId,365); } if (d.sessionId){ console.log('Cookie: '+d.sessionId); createCookie('sessionId',d.sessionId,365); } } }); /* var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://admin.b3.my?check', true); xhr.withCredentials = true; xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE) { //console.log(xhr.responseText); } } xhr.send(null); */ } pingB3FirstTime(); $(document).off('click','.cardItems li').on('click','.cardItems li',function(e){ console.log('edit item'); $this = $(this); product = $this.data('product'); itemId = $this.data('id'); if (typeof product == 'undefined'){ return false; } $('html').addClass('loading'); if ($('#modalFood').length == 0){ $('body').append(''); } theTarget = $(e.target); openSubproduct = theTarget.data('subproduct'); $.ajax({ url: 'https://api.b3eats.com/food', data: ({'item':product,'cartId':itemId,'mode':'edit','session':readCookie('sessionId')}), type: 'post', timeout: 9500, error: function(){ $('html').removeClass('loading'); //$this.trigger('click'); }, success: function(d){ if (d.action == 'askfordelivery'){ thenOpenFood = d.thenOpenFood; openModalWithLink('https://api.b3eats.com/modal/changeMethodPopup?bootstrap=4&itemId='+thenOpenFood+'&sessionGet='+readCookie('sessionId')); }else{ if (d.showModal == false){ $('html').removeClass('loading'); refreshCart(); }else{ $('html').removeClass('loading'); $('#modalFood').html(d).modal('show'); $('body').addClass('modal-open'); } } } }); }); $(document).off('click','.menuItems li').on('click','.menuItems li',function(e){ $this = $(this); if ($this.hasClass('soldout')){ return false; } modalClass = $('.order-online-row').data('product'); console.log(modalClass); if (modalClass !== undefined){ $('body').addClass('product--'+modalClass); } $('html').addClass('loading'); //itemPriceDiv = $(this).find('.item-price'); //itemPriceDiv.addClass('is-loading'); linkForModal = 'https://api.b3eats.com/food'; if ($('#modalFood').length == 0){ $('body').append(''); } theTarget = $(e.target); openSubproduct = theTarget.data('subproduct'); $.ajax({ url: linkForModal, data: ({'item':$this.data('item'),'session':readCookie('sessionId')}), type: 'post', timeout: 9500, error: function(){ $('html').removeClass('loading'); //$this.trigger('click'); }, success: function(d){ if (d.action == 'askfordelivery'){ thenOpenFood = d.thenOpenFood; openModalWithLink('https://api.b3eats.com/modal/changeMethodPopup?bootstrap=4&itemId='+thenOpenFood+'&sessionGet='+readCookie('sessionId')); }else{ if (d.showModal == false){ $('html').removeClass('loading'); refreshCart(); }else{ $('html').removeClass('loading'); $('#modalFood').html(d).modal('show'); $('body').addClass('modal-open'); if (theTarget.data('subproduct')){ //console.log($('.subproduct.modifierItem[data-item="'+openSubproduct+'"]')); setTimeout(function(){ $('.subproduct.modifierItem[data-item="'+openSubproduct+'"]').trigger('click'); }, 50); }else{ $('.modalFood:last .subproduct.modifierItem:first').trigger('click'); } } } } }); }); $(document).off('click','.toggleSidebarMenu').on('click','.toggleSidebarMenu',function(e){ e.preventDefault(); $('.sidebarMenu').toggleClass('isOpen'); $('.mainContent').toggleClass('sideBarOpen'); }); $(document).off('click','.closeMenuSider').on('click','.closeMenuSider',function(e){ e.preventDefault(); $('.sidebarMenu').removeClass('isOpen'); $('.mainContent').removeClass('sideBarOpen'); }); $(document).off('click','.mainContent.sideBarOpen').on('click','.mainContent.sideBarOpen',function(e){ e.preventDefault(); target = $(e.target); if (target.hasClass('mainContent')){ $('.toggleSidebarMenu').trigger('click'); } }); $(document).off('change','.menuTabs').on('change','.menuTabs',function(){ selected = $(this).find('option:selected'); //$('.menuTabs li').removeClass('active'); //$(this).parent().addClass('active'); menuToShow = selected.data('menu'); var elements = document.querySelectorAll('.catList .menuCategories > li'); Array.prototype.forEach.call(elements, function(el, i){ el.style.display = 'none'; }); Array.prototype.forEach.call(document.querySelectorAll('.catFoodContainer'), function(el, i){ el.style.display = 'none'; }); $('.catList .menuCategories > li').each(function(){ thisMenu = $(this); if ($.inArray(""+$(this).data('id'), menuToShow) > -1){ thisMenu.show(); $('.catFoodContainer'+$(this).data('id')).show(); } }); $('.menuCategories [id="popular"], .menuCategories [id="fasting"]').show(); $('.catFoodContainerfasting, .catFoodContainerpopular').show(); setTimeout(function(){ try{ createSubmenus(); }catch(exc){ } }, 10); }); $(document).off('click','.termsModal').on('click','.termsModal',function(e){ $this = $(this); e.preventDefault(); openModalWithLink('https://api.b3eats.com/modal/terms?type='+$this.data('type')+'&closeButton=true&session='+readCookie('sessionId')+'&bootstrap=4'); return false; }); $(document).off('click','.b3-section, header').on('click','.b3-section, header',function(e){ //console.log(window.top.location.hostname); var parentURL = (window.location != window.parent.location) ? document.referrer : document.location.href; if (window.self !== window.top){ if($(e.target).hasClass('ajaxLink')){ return false; } //$('.b3-section').removeClass('active'); //$(this).addClass('active'); sendToParent = {message:'changeSectionFromIframe','link':window.location.href,'id':$(this).data('id')}; //console.log(sendToParent); parent.postMessage(sendToParent,parentURL); return false; if ($(this).data('id') !== undefined && parent.origin != self.origin){ try{ parent.postMessage(sendToParent,parentURL); }catch(exc){ } } return false; } }); hasHistory = false; $(document).on('click','nav .ajaxLink',function(e){ //currentPage = 1; }); //declare custom onbeforeprint method const customOnBeforePrint = () => { const smoothScroll = (h) => { let i = h || 0; if (i < 200) { setTimeout(() => { window.scrollTo(window.scrollY, window.scrollY + i); smoothScroll(i + 10); }, 40); } }; let height = document.body.scrollHeight; let newHeight; while (true) { smoothScroll(100); if (newHeight === height) break; height = newHeight; } try{ $('.itemImgLazy').each(function (k,v) { element = $(v); img = element.data('printimg'); // $('.loadingSpin').remove(); // console.log(img); element.html(''); }); }catch(exc){ } }; //override the onbeforeprint method window.onbeforeprint = customOnBeforePrint; $(document).off('click','.ajaxLink').on('click','.ajaxLink',function(e){ if ($(this).hasClass('openAccount')){ return false; } if ($('.categoryProductsListBox').length > 0){ scrolledPositionOnProducts = from_top; } hasHistory = true; href = $(this).attr('href'); href = $.trim(href); inNewTab = false; if ($(this).attr('target') == '_blank'){ inNewTab = true; } if ($(this).hasClass('checkForHistory')){ if (hasHistory == true){ history.back(); return false; } } if (typeof href == 'undefined'){ href = ''; } //scrolledFromTop = $(document).scrollTop(); // $('.cartFixedAlways').removeClass('visible'); //console.log($(this).attr('target')); if(href.includes('https://') || href.includes('javascript:') || href.includes('http://') || inNewTab){ e.stopPropagation(); if ($(this).attr('target') == '_blank'){ }else{ window.location = href; } }else{ if (!e) e = window.event; target = $.trim($(this).attr('target')); if (!e.metaKey && target != '_blank') { e.preventDefault(); fullUrl = 'https://builder.b3.my'+href+'?ajax=true'; fullUrl = href+'?ajax=true'; try{ if (href.includes('?')){ fullUrl = href+'&ajax=true'; }else{ fullUrl = href+'?ajax=true'; } }catch(exc){ fullUrl = href+'?ajax=true'; } if (true){ if (window.location.origin.indexOf('b3.my') == '-1'){ if (href.substr(0,1) != '/'){ href = '/'+href; } try{ if (href.indexOf("?") !== -1){ fullUrl = '/request'+href+'&ajax=true'; }else{ fullUrl = '/request'+href+'?ajax=true'; } }catch(exc){ fullUrl = '/request'+href+'?ajax=true'; } } } //console.log((window.location.origin.indexOf('b3.my') != '-1')); $('.mainContent').addClass('loading'); $('.sidebarMenu').removeClass('isOpen'); $('.mainContent').removeClass('sideBarOpen'); $('html').addClass('loading'); $('.basket-overview-panel').remove(); if ($(this).hasClass('closeMenu') == true){ $('.navbar-nav li').removeClass('active'); } loadingFromBack = false; //Hidden iframe to show loading indicator on Browser //$('.hiddenIframeLoading').attr('src',fullUrl); //Get the current link via JS link = window.location.pathname; //Remove all active classes from links $('html').removeClass('modal-open'); //Add active class to active links if ($(this).hasClass('setActiveParent')){ $(this).closest('ul').closest('li').addClass('active'); }else{ $(this).addClass('active'); $(this).parent().addClass('active'); } //Remove Parallax if exists if ($('.parallax-mirror').length > 0){ $('.parallax-mirror').remove(); } if ($(this).hasClass('closeMenu') == true && $(".navbar-collapse").hasClass("collapse in")) { $(".navbar-toggle").click(); } history.pushState({}, null, href); sendToParent = {message:'changeTabFromIframe','link':window.location.href,'id':$(this).data('id')}; try{ if (parent.location.host == 'b3.my'){ try{ parent.postMessage(sendToParent,'https://b3.my'); }catch(exc){ } } }catch(exc){ } /* try{ if ($(this).data('id') !== undefined && parent.origin != self.origin){ sendToParent = {message:'changeTabFromIframe','link':window.location.href,'id':$(this).data('id')}; try{ parent.postMessage(sendToParent,'https://b3.my'); }catch(exc){ } } }catch(exc){ console.log(exc); } */ $this = $(this); console.log(); data = $this.data('data'); console.log(data); //Request page via ajax request if ($this.data('pushorreplace') != 'replace'){ pageHistory.push(window.location.pathname+window.location.search); currentHistoryPage = (pageHistory.length - 1); } $('.overlayWolf').remove(); try{ $('.searchResults.inline').hide(); $('html').removeClass('searching'); }catch(exc){ } if ($this.hasClass('subContent')){ //scrolledFromTop } $.ajax({ url: fullUrl, type: 'get', cache: false, data: ({'ajax':true,'session':readCookie('sessionId'),'data': data}), success: function(d){ lastQuickSearchV = ''; if ($this.hasClass('noScroll')){ }else{ if ($this.hasClass('subContent')){ $("html, body").animate({ scrollTop: 0 }, 0); }else{ $("html, body").animate({ scrollTop: 0 }, 0); } } if ($this.hasClass('removeActive')){ $('.active').removeClass('active'); } //Ajax finished, remove loading class $('.mainContent').removeClass('loading'); window.currentLink = fullUrl; $('.mobileMenuPopover').remove(); //Show loading pace bottom right $('.pace').removeClass('pace-active'); console.log('done .ajaxLink'); //Show data to the website //console.log(d); $('html').removeClass('loading'); if (typeof d == 'object'){ $('body').attr('class', ''); $('body').addClass('bodyAjax'); try{ if (d.bodyClass){ $('body').addClass(d.bodyClass); } }catch(exc){ } try{ document.currentPage.copyrights = $.trim($('.copyrightsAjax')[0].innerHTML); }catch(exc){ } //If copyright section is differet from current version, overwrite it if (d.copyrights){ $('.copyrightsAjax').html(d.copyrights); } if (d.header){ $('.headerAjax').html(d.header); } if (d.afterWebsite){ $('.afterWebsite').html(d.afterWebsite); } mainContentLoaded = d.body; //Add main content $('.mainContent').html(d.body); //change page title meta tag if (d.pageTitle){ document.title = ""+d.pageTitle; } //change page description meta tag if (d.pageDesc){ $("meta[property='og:description'], meta[name=description]").attr('content', d.pageDesc); } //Refresh addthis try{ addthis.layers.refresh(); }catch(exc){ } $('html').removeClass('loading'); //b3Lazy(); }else{ //If response is plain HTML, add it to main DIV $('.mainContent').html(d); } try{ //alert(scrolledFromTop); if (scrolledFromTop > 0){ $("html, body").animate({ scrollTop: scrolledFromTop }, 0); scrolledFromTop = ''; } }catch(exc){ } if ($('.categoryProductsListBox').length > 0){ $("html, body").animate({ scrollTop: scrolledPositionOnProducts }, 0); } try{ if (previousScrolledFromBuilder > 0){ $("html, body").animate({ scrollTop: scrolledPositionOnProducts }, 0); } }catch(exc){ } try{ trackPage(); }catch(exc){ } $('html').removeClass('loading'); /* if (isShop){ try{ refreshCartRetail(); }catch(exc){ } } */ try{ if (window.location.pathname.includes('checkout') == false){ refreshCartRetail(); } }catch(exc){ } try{ fbq('track', 'viewContent') ; }catch(exc){ } try{ ttq.track('viewContent',{ description: description, content_id: form.find('[name="item"]').val(), quantity: form.find('input.quantity').val(), price: basePrice, value: basePrice, currency: 'EUR' }); }catch(exc){ } try{ setupSwiper(); }catch(exc){ //console.log(exc); } try{ $('.vertical-counter, .counter, .progress-bar, .pie-chart-style-01, .attractive-hover, .splitting-animation, .section-dark, footer, [data-anime], [data-fancy-text]').each(function() { $(this).appear().trigger('resize'); }); const $dataAnimeElements = $('[data-anime]:not(.swiper [data-anime])'); $dataAnimeElements.each(function() { const $self = $(this); const animeOptions = $self.data('anime'); if (animeOptions && getWindowWidth() > animeBreakPoint) { try { console.log(animeOptions); const effect = animeOptions.effect && animeOptions.effect.toLowerCase(); console.log($self); $self.on('appear', function() { if (!$self.hasClass('appear')) { $self.addClass('appear'); if (effect === 'slide') { slideAnimation(this, animeOptions); } else { animeAnimation(this, animeOptions); } } if ($self.hasClass('grid')) { $self.find('.grid-sizer').removeAttr('style'); } }); } catch (error) { console.error('Error parsing anime options:', error); } } else { $self.removeAttr('data-anime'); $("body").addClass("no-animation"); } }); }catch(exc){ } return false; /* $("body").filter(function () { var html = $(this).html(); var emailPattern = /[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/g; var matched_str = $(this).html().match(emailPattern); if ( matched_str ) { var text = $(this).html(); $.each(matched_str, function (index, value) { text = text.replace(value,""+value+""); }); $(this).html(text); return $(this) } }); */ /* $('[data-alias]').each(function(){ $(this).addClass('ajaxLink'); }); */ //Load lazyload to isntances createSubPagesLinks(); $(window).trigger('resize'); } }); } } }); $(document).off('click','.foodCatTitleParent').on('click','.foodCatTitleParent', function(){ $(this).closest('li').toggleClass('closed'); try{ $('.lazyImagesFoods').lazy({ effect: "fadeIn", afterLoad: function(element) { element.find('.loadingSpin').addClass('hidden'); element.removeClass('loading'); }, effectTime: 400, threshold: 0 }); }catch(exc){ } }); $(window).resize(function(){ widthOfHeaders = $('.catFoodContainer:first').width(); heightOfHeaders = $('.foodCatTitleParent:first').height(); widthOfMenuLeft = $('.catContainer').width(); widthOfSearch = $('.foodContent').outerWidth(); if ($('.topSearchCategories').length > 0){ widthOfMenuLeft = $('.catContainer').width(); $('.topSearchCategories').css('width',widthOfMenuLeft - 30); } $('.foodCatTitleParent, .foodCatTitle').css('width',widthOfHeaders); //$('.foodCatTitleParent, .foodCatTitle').css('height',heightOfHeaders); if ($('.pageContent').hasClass('topMenu')){ $('.catList').css('width',$('.catContainer').width()); }else{ $('.catList').css('width',widthOfMenuLeft); } $('.searchItems').css('width',widthOfSearch); $('.veganVegetarianBox').css('width',widthOfSearch); if ($(window).width() > 991){ $('.cart').css('width',$('.cartPage').width()); $('.CartColMd').removeClass('isOpen'); $('html').removeClass('cartIsOpen'); } }); $(document).on('click','.cardItems .minusItem',function(e){ e.preventDefault(); $this = $(this); $('.basketList').append('
    '); $.ajax({ url: 'https://api.b3eats.com/food', data: ({'id':$this.data('id'),'item':$this.data('item'),'action':'minusItem','session':readCookie('sessionId')}), type: 'post', success: function(d){ try{ refreshCart(); }catch(exc){ } try{ refreshCartRetail(); }catch(exc){ } } }); return false; }); $(document).on('click','.cardItems .removeFromCart',function(e){ e.preventDefault(); $('.basketList').append('
    '); $this = $(this); $.ajax({ url: 'https://api.b3eats.com/food', data: ({'id':$this.data('id'),'item':$this.data('item'),'action':'removeFood','session':readCookie('sessionId')}), type: 'post', success: function(d){ try{ refreshCart(); }catch(exc){ } try{ refreshCartRetail(); }catch(exc){ } $('html').removeClass('loading'); } }); return false; }); $(document).on('click','.cardItems .plusItem',function(e){ e.preventDefault(); $('.basketList').append('
    '); $this = $(this); $.ajax({ url: 'https://api.b3eats.com/food', data: ({'id':$this.data('id'),'item':$this.data('item'),'action':'plusItem','session':readCookie('sessionId')}), type: 'post', success: function(d){ try{ refreshCart(); }catch(exc){ } try{ refreshCartRetail(); }catch(exc){ } $('html').removeClass('loading'); } }); return false; }); $(document).off('click','.changeMethodLink').on('click','.changeMethodLink',function(){ openModalWithLink('https://api.b3eats.com/modal/changeMethodPopup?bootstrap=4&sessionGet='+readCookie('sessionId')); }); $(document).off('click','.deleteItemFromCart').on('click','.deleteItemFromCart',function(e){ e.preventDefault(); $this = $(this); $this.closest('li').find('.counter-control-vertical').remove(); $this.closest('li').slideUp(); $('.basketList .loading__indicator').remove(); linkForDelete = 'https://api.b3eats.com/food'; removeItemAjax = $.ajax({ url: linkForDelete, timeout: 5000, error: function(){ $this.trigger('click'); }, data: ({'id':$this.data('id'),'item':$this.data('item'),'action':'removeFood','session':readCookie('sessionId')}), type: 'post', success: function(d){ refreshCart(); } }); return false; }); var jumpTo; $(document).off('click','.jumpTo').on('click','.jumpTo',function(){ element = '.catFoodContainer'+$(this).data('to'); jumpTo = $($(this).data('to')+'.catFoodContainer'); console.log($(this).data('i')); if ($(this).data('i') != undefined){ jumpTo = $('.ca[data-id="'+$(this).data('i')+'"]'); } //console.log(jumpTo); positionToJump = jumpTo.offset().top; if ($('.pageContent').hasClass('topMenu')){ positionToScroll = jumpTo.offset().top - 75; }else{ positionToScroll = jumpTo.offset().top - 60 } //$('html, body').scrollTop(positionToScroll); //return false; $('html, body').animate({ scrollTop: positionToScroll }, 500); }); $(document).off('click','.product--details .plusItemQuantity').on('click','.product--details .plusItemQuantity',function(e){ maximumQty = parseInt($('.product--details input.quantity').data('max')) currentQuantity = parseInt($('.product--details input.quantity').val()); currentQuantity = currentQuantity + 1; if (currentQuantity > maximumQty){ currentQuantity = maximumQty; try{ showSuccessMessage({ message: 'Maximum availability is ' +maximumQty +' items', icon: 'fa fa-warning', timeout: 2000 }); }catch(exc){ } } $('.product--details input.quantity').val(currentQuantity); }); $(document).off('click','.product--details .minusItemQuantity').on('click','.product--details .minusItemQuantity',function(e){ currentQuantity = parseInt($('.product--details input.quantity').val()); currentQuantity = currentQuantity - 1; if (currentQuantity <= 1){ currentQuantity = 1; } $('.product--details input.quantity').val(currentQuantity); }); $(document).off('click','.forgotBtB4').on('click','.forgotBtB4',function(e){ e.preventDefault(); $('.modalAjax').modal('hide'); openModalWithLink('https://b3.my/api/store/modal.php?bootstrap=4&file=forgot&sessionGet='+readCookie('sessionId')); }); $(document).off('click','.addItemToFav').on('click','.addItemToFav',function(){ $this = $(this); if (isLogin != true){ openModalWithLink('https://b3.my/api/store/modal.php?bootstrap=4&file=login&sessionGet='+readCookie('sessionId')); }else{ item = $(this).data('id'); $.ajax({ url: 'https://b3.my/api/store/addToFav.php', data: ({'item':item,'session':readCookie('sessionId')}), type: 'post', success: function(d){ if (window.location.pathname.includes('wishlist')){ openLink(window.location.pathname,'replace'); } if (d.added){ $this.addClass('added'); }else{ $this.removeClass('added'); } } }); } }); $(document).off('click','.checkCheckout').on('click','.checkCheckout',function(e){ e.preventDefault(); if (meetDeliveryMinimum){ $(this).addClass('is-loading'); linkForCheckout = '/checkout?'+moment().unix(); $('#loader-content').fadeIn(); url = linkForCheckout; var new_form; new_form = document.createElement('form'); new_form.method = 'POST'; new_form.action = url; document.body.appendChild(new_form); new_form.submit(); }else{ openModalWithLink('https://api.b3eats.com/modal/checkout?link=/checkout&bootstrap=4&sessionGet='+readCookie('sessionId')); } return false; }); $(window).scroll(function(){ from_top = $(window).scrollTop(); headerHeight = $('.b3eats.header').height() + 9; stopOn = $(document).height() - 100 - $('.copyrightsAjax').height() -$('.cartList .basket').height(); if ($(window).width() > 768){ if ($('.restThreeColumns .pageContent.thumb.pizza.victus #CartColMd').length > 0){ $('#CartColMd').css('top',headerHeight-from_top); } }else{ $('#CartColMd').css('top',''); } try{ limitToFixedLeftMenu = $('.catContainer').offset().top - 15; try{ extraSpace = 0; if ($(document).width() <= 991){ extraSpace = -40; } fromTopFixedMenu = $('.categoriesProducts').offset().top + extraSpace - $('.topSearchCategories').height() - 15; }catch(exc){ fromTopFixedMenu = 50; } if (from_top > fromTopFixedMenu){ $('.catList').css('width',$('.catContainer').width()); $('.catList').addClass('fixed'); $('body').addClass('menuRestaurantIsFixed'); //$('.searchItems').addClass('visibleFixed'); }else{ //$('.searchItems').removeClass('visibleFixed'); $('.catList').removeClass('fixed'); $('body').removeClass('menuRestaurantIsFixed'); } }catch(exc){ } /* try{ $('.itemImgLazy').lazy({ effect: "fadeIn", afterLoad: function(element) { element.find('.loadingSpin').addClass('hidden'); element.removeClass('loading'); }, effectTime: 400, threshold: 0 }); }catch(exc){ } */ if (from_top > 30){ $('html').addClass('fromTop50'); }else{ $('html').removeClass('fromTop50'); } if (from_top > 51){ $('html').addClass('fromTop51'); }else{ $('html').removeClass('fromTop51'); } if (from_top > 71){ $('html').addClass('fromTop70'); }else{ $('html').removeClass('fromTop70'); } if (from_top > 81){ $('html').addClass('fromTop80'); }else{ $('html').removeClass('fromTop80'); } if (from_top > 100){ $('html').addClass('fromTop100'); }else{ $('html').removeClass('fromTop100'); } if ($(window).width() > 767){ try{ if (from_top > $('.catContainer').offset().top){ $('.catList').addClass('fixed'); $('.searchItems, .veganVegetarianBox').addClass('visibleFixed'); }else{ $('.searchItems, .veganVegetarianBox').removeClass('visibleFixed'); $('.catList').removeClass('fixed'); } }catch(exc){ } try{ if (from_top > $('.CartColMd').offset().top){ $('.cartList').addClass('fixed'); $('body').addClass('cartIsFixed'); }else{ $('body').removeClass('cartIsFixed'); $('.cartList').removeClass('fixed'); } }catch(exc){ } }else{ try{ if (from_top > $('.boxFoodCollection').offset().top){ $('.searchItems, .veganVegetarianBox').addClass('visibleFixed'); }else{ $('.searchItems, .veganVegetarianBox').removeClass('visibleFixed'); } }catch(exc){ } } /* if (from_top >= stopOn){ $('.cartList').addClass('absolute').css('top',stopOn - 205); $('.catList').addClass('absolute').css('top',stopOn - 205); }else{ $('.catList').removeClass('absolute').css('top',''); $('.cartList').removeClass('absolute').css('top',''); } */ }); $(window).trigger('scroll'); $(window).trigger('resize'); }); var stripe; var card; $(document).off('click','.loginBtn:not(.loginBtnWolf), .openWolfRegisterLoginModal').on('click','.loginBtn:not(.loginBtnWolf), .openWolfRegisterLoginModal',function(e){ e.preventDefault(); $('.modalAjax').modal('hide'); openModalWithLink('https://api.b3eats.com/modal/login?bootstrap=4&1&sessionGet='+readCookie('sessionId')); return false; }); wolfRegisterLoginModal = function(){ $('.modalAjax').modal('hide'); $('.closeNavMenu').trigger('click'); openModalWithLink('https://wolf.ooo/templates/wolf/pages/login/loginView.php?session='+readCookie('sessionId')); //openModalWithLink('https://api.b3eats.com/modal/login?bootstrap=4&1&sessionGet='+readCookie('sessionId')); } $(document).off('click','.registerBtn:not(.loginBtnWolf)').on('click','.registerBtn:not(.loginBtnWolf)',function(e){ e.preventDefault(); $('.modalAjax').modal('hide'); openModalWithLink('https://api.b3eats.com/modal/register?bootstrap=4&sessionGet='+readCookie('sessionId')); return false; }); $(document).off('click','.createAccount, .loginBtnWolf').on('click','.createAccount, .loginBtnWolf',function(e){ e.preventDefault(); $('.btnConfirmOrder').prop('disabled',true); $('.overlay-sidebar-login').removeClass('hiddenSidebar'); $('.overlay-sidebar-login .loginOptions').show(); $('body').addClass('overlay-enabled'); $('.overlay-sidebar-login').after('
    '); }); $(document).off('click','.continueWithEmail').on('click','.continueWithEmail',function(e){ $('.loginOptions').hide(); $('.emailFormLogin').show(); e.preventDefault(); }); function stripePaymentForm(apiKey){ stripe = Stripe(apiKey); // Create an instance of Elements var elements = stripe.elements(); // Custom styling can be passed to options when creating an Element. // (Note that this demo uses a wider set of styles than the guide below.) var style = { hidePostalCode: true, base: { color: '#32325d', lineHeight: '24px', fontFamily: '"Helvetica Neue", Helvetica, sans-serif', fontSmoothing: 'antialiased', fontSize: '16px', '::placeholder': { color: '#aab7c4' } }, invalid: { color: '#fa755a', iconColor: '#fa755a' } }; // Create an instance of the card Element card = elements.create('card', {hidePostalCode: true,style: style}); // Add an instance of the card Element into the `card-element`
    card.mount('#card-element'); // Handle real-time validation errors from the card Element. card.addEventListener('change', function(event) { var displayError = document.getElementById('card-errors'); if (event.error) { displayError.textContent = event.error.message; $('#card-errors').show(); } else { $('#card-errors').hide(); } }); } stripeTokenHandler = function(token){ $('.formCheckout').append(''); try{ latLong = mapCyprus.getCenter().lat+","+mapCyprus.getCenter().lng; }catch(exc){ latLong = '0'; } $.ajax({ url: 'https://api.b3eats.com/checkIfDeliver', type: 'post', data: $('.formCheckout').serialize()+'&session='+readCookie('sessionId'), success: function(d){ if (d.deliverInYourArea){ twoStepConfirmation(); $('.formCheckout').append(''); //$('#loader-content').fadeIn().append(''); //$('.formCheckout')[0].submit(); }else{ openModalWithLink('https://api.b3eats.com/modal/notDelivered?bootstrap=4'); $('.btnConfirmOrder').prop('disabled',false); $('#loader-content').fadeOut(); } } }); } createSubPagesLinks = function(){ urlParts = window.location.pathname.split('/'); $('[data-alias]').each(function(){ if ($(this).hasClass('rev_slider_wrapper')){ return true; } $(this).addClass('ajaxLink'); createURL = '/blog/'+$(this).data('alias')+'/'+urlParts[3]; $(this).attr('href',createURL); }); } var isShop; var lastQuickSearchV ; lastQuickSearchV = ''; $(function(){ $(document).off('click','.viewMode .viewModeButton').on('click','.viewMode .viewModeButton',function(){ howMany = $(this).data('v'); if ($(this).hasClass('active')){ $(this).removeClass('active'); $('.afterWebsite').html(''); return false; } $('.viewMode .viewModeButton').removeClass('active'); $(this).addClass('active'); if (howMany == 2){ $('.afterWebsite').html(''); } if (howMany == 3){ $('.afterWebsite').html(''); } if (howMany == 4){ $('.afterWebsite').html(''); } if (howMany == 5){ $('.afterWebsite').html(''); } createCookie('howManyViewProducts',howMany,365); }); $(document).off('click','.removePromoCode').on('click','.removePromoCode',function(){ $('html').addClass('loading'); removeCouponCode = $.ajax({ url: window.location.origin+ '/wolfValidateCoupon?session='+readCookie('sessionId'), data: ({'coupon':'','session':readCookie('sessionId')}), cache: false, type: 'post', success: function(d){ if (window.location.pathname.includes('/order')){ refreshCart(); $('html').removeClass('loading'); }else{ try{ refreshCheckout(); }catch(exc){ } } } }); }); $(document).off('focus','.searchTerm').on('focus','.searchTerm',function(e){ try{ if (typeof e.type == 'undefined'){ return false; } }catch(exc){ } v = $(this).val(); if (v != ''){ if ($('.searchResults').length == 0){ lastQuickSearchV = ''; $('.searchTerm').trigger('keyup'); }else{ $('.searchResults').show(); $('html').addClass('searching'); } } }); $(document).off('keyup','.searchTerm').on('keyup','.searchTerm',function(e){ closestForm = $(this).closest('form'); beforeForm = closestForm.before(); //console.log(beforeForm); //console.log(e.keyCode); if (e.keyCode == 27 || e.keyCode == 13){ return false; } v = $.trim($(this).val()); if (v == lastQuickSearchV){ return false; } if ($('.overlaySearch').length == 0){ $('.mainContent').before('
    ') } hasResult = closestForm.find('.searchResults'); try{ ajaxSearch.abort(); }catch(exc){ } if (v == ''){ $('.searchResults').hide(); $('html').removeClass('searching'); return false; } //console.log(closestForm); if (hasResult.length == 0 && closestForm.find('.searchResults').length == 0){ closestForm.append('
    '); } $('.searchResults.inline').html('
    Searching
    ').show(); $('html').addClass('searching'); try{ clearTimeout(ajaxSearchTimeout); }catch(exc){ } ajaxSearchTimeout = setTimeout(function(){ ajaxSearch = $.ajax({ context: this, timeout: 10000, type: 'post', context: ({'val':v}), data: ({'s':v,'session':readCookie('sessionId')}), url: 'https://b3.my/api/store/search.php?sessionGet='+readCookie('sessionId'), success: function(d){ lastQuickSearchV = this.val; //console.log(d); $('html').addClass('searching'); $('.searchResults.inline').html(d.html).show(); } }); },400); }); $(document).off('click','.editThisAddress').on('click','.editThisAddress',function(e){ id = $(this).data('id'); openModalWithLink('https://wolf.ooo/api/addNewAddressBeta.php?mode=edit&id='+id+'&sessionGet='+readCookie('sessionId')); try{ dynamicSheet.close(); }catch(exc){ ///alert(exc); } return false; }); $(document).off('click','.deleteAddress').on('click','.deleteAddress',function(e){ $this = $(this); Swal.fire({ text: 'Delete this address?', icon: 'alert', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Delete' }).then((result) => { if (result.value) { $.ajax({ url: 'https://wolf.ooo/templates/wolf/pages/users/addresses.php', type: 'post', data: ({'id':$this.data('id'),'action':'deleteAddress','session':readCookie('sessionId')}), success: function(d){ try{ $.toast({ heading: 'Address Deleted!', position: 'bottom-center', stack: false }); }catch(exc){ } getMyAddresses(); try{ if (dynamicSheet.opened){ }else{ openLink(window.location.pathname+window.location.search); } }catch(exc){ } } }); } }); return false; }); $(document).off('click','.getGPSCoordinates').on('click','.getGPSCoordinates',function(){ continueGeolocation = true; try{ navigator.permissions.query({ name: 'geolocation' }).then(function(status){ if (status.state == 'denied'){ $('.alertDeniedLocation').show(); continueGeolocation = false; return false; } }); }catch(exc){ } if (continueGeolocation){ $('.loadingLocationInModal').show(); $('.alertDeniedLocation, .getGPSCoordinates').hide(); askForGeolocation(function(){ console.log(position); createCookie('currentCoordinates',readCookie('currentCoordinatesReal'),365); createCookie('lastActionLocation','gps',365); usingCurrentLocation = true; coordinates = readCookie('currentCoordinates').split(','); //$('body').append($('#modalConfirmYourAddress')); //$('#modalConfirmYourAddress').modal('show'); var myLatLng = {lat: parseFloat(coordinates[0]), lng: parseFloat(coordinates[1])}; $('.loadingLocationInModal').hide(); $('.getGPSCoordinates').show(); $('.selectManual').trigger('click'); }); } }); $(document).off('click','.skipRegister, .continueAsGuest').on('click','.skipRegister, .continueAsGuest',function(e){ e.preventDefault(); $('.modalAjax.loginView').modal('hide'); }); $(document).off('click','.openCountrySelector').on('click','.openCountrySelector',function(){ //console.log($('.countrySelector')); $('html').addClass('modal-open'); $('.countrySelector').addClass('isOpen'); $('.selectThisCountry img').lazy(); }); $(document).off('click','.closeCountryList').on('click','.closeCountryList',function(){ $('.countrySelector').removeClass('isOpen'); $('html').removeClass('modal-open'); }); $(document).off('click','.selectThisCountry').on('click','.selectThisCountry',function(){ $this = $(this); $('.countrySelector').removeClass('isOpen'); $('.selectedCountryCode').html(' ' + ''+$this.data('html')+' '); }); $(document).off('keyup','.searchForCountry').on('keyup','.searchForCountry',function(){ $this = $(this); value = $.trim($(this).val()); $('.countryList li').hide(); if (value == ''){ $('.countryList li').show(); } $('.lazyFlag').lazy(); $('.countryList li:wolfcontains("'+value+'")').show(); }); isShop = false; if ($('.eshopElements').length > 0){ isShop = true; } if (isShop){ $('html').addClass('b3shop'); } createSubPagesLinks(); })