1var timer;function handleImageError(e,t){console.log("Image with reference ${imageReference} failed to load."),fetch("/app/elements/remove-image-entry.php",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageRef:t})}).then(e=>e.json()).then(e=>console.log(e)).catch(e=>console.error("Error:",e))}function numberWithCommas(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}jQuery(document).ready(function(e){"use strict";function t(){u.parent().removeClass("expanded")}var i,a,n,s,o=".site-search";(function(){if("number"==typeof window.innerWidth)return window.innerWidth>document.documentElement.clientWidth;var e,t,i=document.documentElement||document.body;void 0!==i.currentStyle&&(t=i.currentStyle.overflow),t=t||window.getComputedStyle(i,"").overflow,void 0!==i.currentStyle&&(e=i.currentStyle.overflowY),e=e||window.getComputedStyle(i,"").overflowY;var a=i.scrollHeight>i.clientHeight,n=/^(visible|auto)$/.test(t)||/^(visible|auto)$/.test(e),s="scroll"===t||"scroll"===e;return a&&n||s})()&&e("body").addClass("hasScrollbar"),e('a[href="#"]').on("click",function(e){e.preventDefault()}),i=e("body"),a=e(".navbar-sticky"),n=e(".topbar").outerHeight(),s=a.outerHeight(),a.length&&e(window).on("scroll",function(){e(this).scrollTop()>n?(a.addClass("navbar-stuck"),a.hasClass("navbar-ghost")||i.css("padding-top",s)):(a.removeClass("navbar-stuck"),i.css("padding-top",0))}),e(".toolbar .tools .search").on("click",function(){e(o).addClass("search-visible"),setTimeout(function(){e(o+" > input").focus(),window.scrollTo(0,0)},200)}),e(".close-search").on("click",function(){e(o).removeClass("search-visible")}),e(".clear-search").on("click",function(){e(o+" > input").val(""),setTimeout(function(){e(o+" > input").focus()},200)}),e(".lang-currency-switcher").on("click",function(){e(this).parent().addClass("show"),e(this).parent().find(".dropdown-menu").addClass("show")}),e(document).on("click",function(t){e(t.target).closest(".lang-currency-switcher-wrap").length||(e(".lang-currency-switcher-wrap").removeClass("show"),e(".lang-currency-switcher-wrap .dropdown-menu").removeClass("show"))}),e('[data-toggle="offcanvas"]').on("click",function t(i){var a=e("body"),n=e(i.target).attr("href");e(n).addClass("active"),console.log(n),a.css("overflow","hidden"),a.addClass("offcanvas-open"),i.preventDefault()}),e(".site-backdrop").on("click",function t(){var i=e("body");i.removeClass("offcanvas-open"),setTimeout(function(){i.css("overflow","visible"),e(".offcanvas-container").removeClass("active")},0)});var r=e(".offcanvas-menu .menu").height();e(".offcanvas-menu .offcanvas-submenu").each(function(){e(this).prepend('<li class="back-btn"><a href="#">Back</a></li>')});var d=e(".has-children .sub-menu-toggle");e(".offcanvas-menu .offcanvas-submenu .back-btn").on("click",function(t){var i=e(this).parent(),a=e(this).parent().parent().siblings().parent(),n=e(this).parents(".menu");i.removeClass("in-view"),a.removeClass("off-view"),"menu"===a.attr("class")?n.css("height",r):n.css("height",a.height()),t.preventDefault()}),d.on("click",function(t){var i=e(this).parent().parent().parent(),a=e(this).parents(".menu");return i.addClass("off-view"),e(this).parent().parent().find("> .offcanvas-submenu").addClass("in-view"),a.css("height",e(this).parent().parent().find("> .offcanvas-submenu").height()),t.preventDefault(),!1});var l=e(".scroll-to-top-btn");if(l.length>0&&(e(window).on("scroll",function(){e(this).scrollTop()>600?l.addClass("visible"):l.removeClass("visible")}),l.on("click",function(t){t.preventDefault(),e("html").velocity("scroll",{offset:0,duration:1200,easing:"easeOutExpo",mobileHA:!1})})),e(document).on("click",".scroll-to",function(t){var i=e(this).attr("href");if("#"===i)return!1;var a=e(i);if(a.length>0){var n=a.data("offset-top")||70;e("html").velocity("scroll",{offset:e(this.hash).offset().top-n,duration:1e3,easing:"easeOutExpo",mobileHA:!1})}t.preventDefault()}),function(t){t.each(function(){var t=e(this),i=t.data("filter-list"),a=t.find("input[type=text]"),n=t.find("input[type=radio]"),s=e(i).find(".list-group-item");a.keyup(function(){var t=a.val();s.each(function(){0==e(this).text().toLowerCase().indexOf(t.toLowerCase())?e(this).show():e(this).hide()})}),n.on("click",function(t){var i=e(this).val();"all"!==i?(s.hide(),e("[data-filter-item="+i+"]").show()):s.show()})})}(e("[data-filter-list]")),function(t,i){t.each(function(){var t=e(this),i=e(this).data("date-time");t.downCount({date:i,offset:10})})}(e(".countdown")),e("[data-toast]").on("click",function(){var t=e(this),i=t.data("toast-type"),a=t.data("toast-icon"),n=t.data("toast-position"),s=t.data("toast-title"),o=t.data("toast-message"),r="";switch(n){case"topRight":default:r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"topRight",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInLeft",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};break;case"bottomRight":r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"bottomRight",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInLeft",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};break;case"topLeft":r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"topLeft",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInRight",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};break;case"bottomLeft":r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"bottomLeft",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInRight",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};break;case"topCenter":r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"topCenter",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInDown",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};break;case"bottomCenter":r={class:"iziToast-"+i,title:s||"Title",message:o||"toast message",animateInside:!1,position:"bottomCenter",progressBar:!1,icon:a,timeout:3200,transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"}}iziToast.show(r)}),e(".btn-wishlist").on("click",function(){var t=e(this).data("iteration")||1,i={title:"Product",animateInside:!1,position:"topRight",progressBar:!1,timeout:3200,transitionIn:"fadeInLeft",transitionOut:"fadeOut",transitionInMobile:"fadeIn",transitionOutMobile:"fadeOut"};switch(t){case 1:e(this).addClass("active"),i.class="iziToast-info",i.message="added to your wishlist!",i.icon="icon-bell";break;case 2:e(this).removeClass("active"),i.class="iziToast-danger",i.message="removed from your wishlist!",i.icon="icon-ban"}iziToast.show(i),++t>2&&(t=1),e(this).data("iteration",t)}),e(".isotope-grid").length)var c=e(".isotope-grid").imagesLoaded(function(){c.isotope({itemSelector:".grid-item",transitionDuration:"0.7s",masonry:{columnWidth:".grid-sizer",gutter:".gutter-sizer"}})});if(e(".filter-grid").length>0){var p=e(".filter-grid");e(".nav-pills").on("click","a",function(t){t.preventDefault(),e(".nav-pills a").removeClass("active"),e(this).addClass("active");var i=e(this).attr("data-filter");p.isotope({filter:i})})}var u=e(".widget-categories .has-children > a");u.on("click",function(i){e(i.target).parent().is(".expanded")?t():(t(),e(this).parent().addClass("expanded"))}),e('[data-toggle="tooltip"]').tooltip(),e('[data-toggle="popover"]').popover();var h=document.querySelector(".ui-range-slider");if(null!=h){var f=parseInt(h.parentNode.getAttribute("data-start-min"),10),g=parseInt(h.parentNode.getAttribute("data-start-max"),10),m=parseInt(h.parentNode.getAttribute("data-min"),10),v=parseInt(h.parentNode.getAttribute("data-max"),10),b=parseInt(h.parentNode.getAttribute("data-step"),10),w=document.querySelector(".ui-range-value-min span"),y=document.querySelector(".ui-range-value-max span"),x=document.querySelector(".ui-range-value-min input"),k=document.querySelector(".ui-range-value-max input");noUiSlider.create(h,{start:[f,g],connect:!0,step:b,range:{min:m,max:v}}),h.noUiSlider.on("update",function(e,t){var i=e[t];t?(y.innerHTML=Math.round(i),k.value=Math.round(i)):(w.innerHTML=Math.round(i),x.value=Math.round(i))})}var _=e(".interactive-credit-card");_.length&&_.card({form:".interactive-credit-card",container:".card-wrapper"}),e(".gallery-wrapper").length&&function(t){for(var i=function(t){for(var i,a,n,s,o=e(t).find(".gallery-item:not(.isotope-hidden)").get(),r=o.length,d=[],l=0;l<r;l++)1===(i=o[l]).nodeType&&("video"==e(a=i.children[0]).data("type")?s={html:e(a).data("video")}:(n=a.getAttribute("data-size").split("x"),s={src:a.getAttribute("href"),w:parseInt(n[0],10),h:parseInt(n[1],10)}),i.children.length>1&&(s.title=e(i).find(".caption").html()),a.children.length>0&&(s.msrc=a.children[0].getAttribute("src")),s.el=i,d.push(s));return d},a=function(t){(t=t||window.event).preventDefault?t.preventDefault():t.returnValue=!1;var i=function e(t,i){return t&&(i(t)?t:e(t.parentNode,i))}(t.target||t.srcElement,function(e){var t;return(" "+(t=e).className+" ").indexOf(" gallery-item ")>-1});if(i){for(var a,s=i.closest(".gallery-wrapper"),o=e(i.closest(".gallery-wrapper")).find(".gallery-item:not(.isotope-hidden)").get(),r=o.length,d=0,l=0;l<r;l++)if(1===o[l].nodeType){if(o[l]===i){a=d;break}d++}return a>=0&&n(a,s),!1}},n=function(t,a,n,s){var o,r,d,l=document.querySelectorAll(".pswp")[0];if(d=i(a),r={closeOnScroll:!1,galleryUID:a.getAttribute("data-pswp-uid"),getThumbBoundsFn:function(t){var i=d[t].el.getElementsByTagName("img")[0];if(e(i).length>0){var a=window.pageYOffset||document.documentElement.scrollTop,n=i.getBoundingClientRect();return{x:n.left,y:n.top+a,w:n.width}}}},s){if(r.galleryPIDs){for(var c=0;c<d.length;c++)if(d[c].pid==t){r.index=c;break}}else r.index=parseInt(t,10)-1}else r.index=parseInt(t,10);isNaN(r.index)||(n&&(r.showAnimationDuration=0),(o=new PhotoSwipe(l,PhotoSwipeUI_Default,d,r)).init(),o.listen("beforeChange",function(){var t=e(o.currItem.container);e(".pswp__video").removeClass("active"),t.find(".pswp__video").addClass("active"),e(".pswp__video").each(function(){e(this).hasClass("active")||e(this).attr("src",e(this).attr("src"))})}),o.listen("close",function(){e(".pswp__video").each(function(){e(this).attr("src",e(this).attr("src"))})}))},s=document.querySelectorAll(t),o=0,r=s.length;o<r;o++)s[o].setAttribute("data-pswp-uid",o+1),s[o].onclick=a;var d=function(){var e=window.location.hash.substring(1),t={};if(e.length<5)return t;for(var i=e.split("&"),a=0;a<i.length;
1a++)if(i[a]){var n=i[a].split("=");n.length<2||(t[n[0]]=n[1])}return t.gid&&(t.gid=parseInt(t.gid,10)),t}();d.pid&&d.gid&&n(d.pid,s[d.gid-1],!0,!0)}(".gallery-wrapper");var C=e(".product-carousel");C.length&&C.owlCarousel({items:1,loop:!1,dots:!1,URLhashListener:!0,startPosition:"URLHash",onTranslate:function t(i){var a=i.item.index,n=e(".owl-item").eq(a).find("[data-hash]").attr("data-hash");e(".product-thumbnails li").removeClass("active"),e('[href="#'+n+'"]').parent().addClass("active"),e(".gallery-wrapper .gallery-item").removeClass("active"),e('[data-hash="'+n+'"]').parent().addClass("active")}});var I=e(".google-map");I.length&&I.each(function(){var t=e(this).data("height"),i=e(this).data("address"),a=e(this).data("zoom"),n=e(this).data("disable-controls"),s=e(this).data("scrollwheel"),o=e(this).data("marker"),r=e(this).data("marker-title"),d=e(this).data("styles");e(this).height(t),e(this).gmap3({marker:{address:i,data:r,options:{icon:o},events:{mouseover:function(t,i,a){var n=e(this).gmap3("get"),s=e(this).gmap3({get:{name:"infowindow"}});s?(s.open(n,t),s.setContent(a.data)):e(this).gmap3({infowindow:{anchor:t,options:{content:a.data}}})},mouseout:function(){var t=e(this).gmap3({get:{name:"infowindow"}});t&&t.close()}}},map:{options:{zoom:a,disableDefaultUI:n,scrollwheel:s,styles:d}}})})}),function(e){e.fn.ddslick=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exists."):t.init.apply(this,arguments)};var t={},i={data:[],keepJSONItemsOnTop:!1,width:"100%",height:null,background:"#eee",selectText:"",defaultSelectedIndex:null,truncateDescription:!0,imagePosition:"left",showSelectedHTML:!0,clickOffToClose:!0,embedCSS:!0,onSelected:function(){}};function a(e,t){var i,a,n,o,r=e.data("ddslick"),d=e.find(".dd-selected"),l=d.siblings(".dd-selected-value"),c=(e.find(".dd-options"),d.siblings(".dd-pointer"),e.find(".dd-option").eq(t)),p=c.closest("li"),u=r.settings,h=r.settings.data[t];e.find(".dd-option").removeClass("dd-option-selected"),c.addClass("dd-option-selected"),r.selectedIndex=t,r.selectedItem=p,r.selectedData=h,u.showSelectedHTML?d.html((h.imageSrc?'<img class="dd-selected-image'+("right"==u.imagePosition?" dd-image-right":"")+'" src="'+h.imageSrc+'" />':"")+(h.text?'<label class="dd-selected-text">'+h.text+"</label>":"")+(h.description?'<small class="dd-selected-description dd-desc'+(u.truncateDescription?" dd-selected-description-truncated":"")+'" >'+h.description+"</small>":"")):d.html(h.text),l.val(h.value),r.original.val(h.value),e.data("ddslick",r),s(e),a=(i=e).find(".dd-select").css("height"),n=i.find(".dd-selected-description"),o=i.find(".dd-selected-image"),n.length<=0&&o.length>0&&i.find(".dd-selected-text").css("lineHeight",a),"function"==typeof u.onSelected&&u.onSelected.call(this,r)}function n(t){var i=t.find(".dd-select"),a=i.siblings(".dd-options"),n=i.find(".dd-pointer"),s=a.is(":visible");e(".dd-click-off-close").not(a).slideUp(50),e(".dd-pointer").removeClass("dd-pointer-up"),s?(a.slideUp("fast"),n.removeClass("dd-pointer-up")):(a.slideDown("fast"),n.addClass("dd-pointer-up")),function t(i){i.find(".dd-option").each(function(){var t=e(this),a=t.css("height"),n=t.find(".dd-option-description"),s=i.find(".dd-option-image");n.length<=0&&s.length>0&&t.find(".dd-option-text").css("lineHeight",a)})}(t)}function s(e){e.find(".dd-options").slideUp(50),e.find(".dd-pointer").removeClass("dd-pointer-up").removeClass("dd-pointer-up")}t.init=function(t){var t=e.extend({},i,t);return e("#css-ddslick").length<=0&&t.embedCSS&&e('<style id="css-ddslick" type="text/css">.dd-select{ border-radius:2px; border:solid 1px #ccc; position:relative; cursor:pointer;}.dd-desc { color:#aaa; display:block; overflow: hidden; font-weight:normal; line-height: 1.4em; }.dd-selected{ overflow:hidden; display:block; padding:10px; font-weight:bold;}.dd-pointer{ width:0; height:0; position:absolute; right:10px; top:50%; margin-top:-3px;}.dd-pointer-down{ border:solid 5px transparent; border-top:solid 5px #000; }.dd-pointer-up{border:solid 5px transparent !important; border-bottom:solid 5px #000 !important; margin-top:-8px;}.dd-options{ border:solid 1px #ccc; border-top:none; list-style:none; box-shadow:0px 1px 5px #ddd; display:none; position:absolute; z-index:2000; margin:0; padding:0;background:#fff; overflow:scroll;max-height: 442px;}.dd-option{ padding:10px; display:block; border-bottom:solid 1px #ddd; overflow:hidden; text-decoration:none; color:#333; cursor:pointer;-webkit-transition: all 0.25s ease-in-out; -moz-transition: all 0.25s ease-in-out;-o-transition: all 0.25s ease-in-out;-ms-transition: all 0.25s ease-in-out; }.dd-options > li:last-child > .dd-option{ border-bottom:none;}.dd-option:hover{ background:#f3f3f3; color:#000;}.dd-selected-description-truncated { text-overflow: ellipsis; white-space:nowrap; }.dd-option-selected { background:#f6f6f6; }.dd-option-image, .dd-selected-image { vertical-align:middle; float:left; margin-right:5px; max-width: 49px;}.dd-image-right { float:right; margin-right:15px; margin-left:5px;}.dd-container{ position:relative;}â .dd-selected-text { font-weight:bold}â</style>').appendTo("head"),this.each(function(){var i=e(this);if(!i.data("ddslick")){var s=[];t.data,i.find("option").each(function(){var t=e(this),i=t.data();s.push({text:e.trim(t.text()),value:t.val(),selected:t.is(":selected"),description:i.description,imageSrc:i.imagesrc})}),t.keepJSONItemsOnTop?e.merge(t.data,s):t.data=e.merge(s,t.data);var o=i,r=e('<div id="'+i.attr("id")+'"></div>');i.replaceWith(r),(i=r).addClass("dd-container").append('<div class="dd-select"><input class="dd-selected-value" type="hidden" /><a class="dd-selected"></a><span class="dd-pointer dd-pointer-down"></span></div>').append('<ul class="dd-options"></ul>');var s=i.find(".dd-select"),d=i.find(".dd-options");d.css({width:t.width}),s.css({width:t.width,background:t.background}),i.css({width:t.width}),null!=t.height&&d.css({height:t.height,overflow:"auto"}),e.each(t.data,function(e,i){i.selected&&(t.defaultSelectedIndex=e),d.append('<li><a class="dd-option">'+(i.value?' <input class="dd-option-value" type="hidden" value="'+i.value+'" />':"")+(i.imageSrc?' <img class="dd-option-image'+("right"==t.imagePosition?" dd-image-right":"")+'" src="'+i.imageSrc+'" />':"")+(i.text?' <label class="dd-option-text">'+i.text+"</label>":"")+(i.description?' <small class="dd-option-description dd-desc">'+i.description+"</small>":"")+"</a></li>")});var l={settings:t,original:o,selectedIndex:-1,selectedItem:null,selectedData:null};(i.data("ddslick",l),t.selectText.length>0&&null==t.defaultSelectedIndex)?i.find(".dd-selected").html(t.selectText):a(i,null!=t.defaultSelectedIndex&&t.defaultSelectedIndex>=0&&t.defaultSelectedIndex<t.data.length?t.defaultSelectedIndex:0),i.find(".dd-select").on("click.ddslick",function(){n(i)}),i.find(".dd-option").on("click.ddslick",function(){a(i,e(this).closest("li").index())}),t.clickOffToClose&&(d.addClass("dd-click-off-close"),i.on("click.ddslick",function(e){e.stopPropagation()}),e("body").on("click",function(){e(".dd-click-off-close").slideUp(50).siblings(".dd-select").find(".dd-pointer").removeClass("dd-pointer-up")}))}})},t.select=function(t){return this.each(function(){void 0!==t.index&&a(e(this),t.index)})},t.open=function(){return this.each(function(){var t=e(this);t.data("ddslick")&&n(t)})},t.close=function(){return this.each(function(){var t=e(this);t.data("ddslick")&&s(t)})},t.destroy=function(){return this.each(function(){var t=e(this),i=t.data("ddslick");if(i){var a=i.original;t.removeData("ddslick").unbind(".ddslick").replaceWith(a)}})}}(jQuery),$("#newsletter-signup-btn").on("click",function(){if($("#newsletter-message").html(""),newsletter_email=$("#newsletter-email").val().trim(),!/^\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i.test(newsletter_email))return $("#newsletter-message").html('<div class="alert alert-danger" role="alert" style="text-align:right;">Please provide a valid email.</div>'),setTimeout(function(){$("#newsletter-message").html("")},4e3),!1;$.ajax({type:"POST",url:"/app/ajax-front.php",dataType:"json",data:{action:"check-newsletter-email-or-send-otp",newsletter_email:newsletter_email},cache:!1,success:function(e){if(error_msg="",""!=(error_msg=e.newletter_row_count>0?'<div class="alert alert-warning" role="alert" style="text-align:right;">We already have you registered on our mailing list.</div>':0==e.newletter_row_count?'<div class="alert alert-success" role="alert" style="text-align:right;">Thank you very much for joining our newsletter. Please check your email to complete the process.</div>':'<div class="alert alert-warning" role="alert" style="text-align:right;">Something went wrong! Please try again later.</div>'))return $("#newsletter-message").html(error_msg),setTimeout(function(){$("#newsletter-message").html("")},4e3),!1}})}); 2 3function connectSearch(url,searchid,stock=false,force=false) { 4 5 6 $('.search').val(searchid); 7 8 9 if (stock) { 10 var dataString = 's=' + encodeURIComponent(searchid) + '&stock=yes'; 11 } else { 12 if (force) { 13 var dataString = 's=' + encodeURIComponent(searchid) + '&force=yes'; 14 } else { 15 var dataString = 's=' + encodeURIComponent(searchid); 16 } 17 } 18 19 if (searchid.length > 1) { 20 21 if($('#result:visible').length == 0) { 22 $('#result').html('<div style="height:350px;width:100%"><div id="page-mask">\n' + 23 ' <div class=\'fullscreenDiv\'>\n' + 24 ' <div class="center">\n' + 25 ' <div class="loader"></div>\n' + 26 ' <p>Searching...</p>\n' + 27 ' </div>\n' + 28 ' </div>\n' + 29 ' </div></div>').show(); 30 } 31 32 if (timer){ 33 clearTimeout(timer); 34 } 35 timer = setTimeout(function(){ 36 if(searchid!='') 37 { 38 // mini-search loader 39 $('#search-loader').html('<div class="mini-loader"></div>'); 40 $('#page-mask').removeClass('hidden'); 41 42 43 $.ajax({ 44 type: "POST", 45 url: url, 46 data: dataString, 47 cache: false, 48 success: function(html) 49 { 50 $("#result").html(html).show(); 51 // switch off mini-loader 52 $('#search-loader').html('<span class="clear-search">Clear</span><span class="close-search"><i class="icon-cross"></i></span>'); 53 } 54 }); 55 }return false;
56 }, 800); 57 } 58} 59 60function connectSearchModify(url,searchid,stock=false,force=false) { 61 62 $('.search').val(searchid); 63 64 if (stock) { 65 var dataString = 's=' + encodeURIComponent(searchid) + '&stock=yes'; 66 } else { 67 if (force) { 68 var dataString = 's=' + encodeURIComponent(searchid) + '&force=yes'; 69 } else { 70 var dataString = 's=' + encodeURIComponent(searchid); 71 } 72 } 73 74 if (searchid.length > 1) { 75 76 if($('#result:visible').length == 0) { 77 $('#result').html('<div style="height:350px;width:100%"><div id="page-mask">\n' + 78 ' <div class=\'fullscreenDiv\'>\n' + 79 ' <div class="center">\n' + 80 ' <div class="loader"></div>\n' + 81 ' <p>Searching...</p>\n' + 82 ' </div>\n' + 83 ' </div>\n' + 84 ' </div></div>').show(); 85 } 86 87 if (timer){ 88 clearTimeout(timer); 89 } 90 timer = setTimeout(function(){ 91 if(searchid!='') 92 { 93 // mini-search loader 94 $('#search-loader').html('<div class="mini-loader"></div>'); 95 $('#page-mask').removeClass('hidden'); 96 97 98 $.ajax({ 99 type: "POST", 100 url: url, 101 data: dataString, 102 cache: false, 103 success: function(html) 104 { 105 $("#result").html(html).show(); 106 // switch off mini-loader 107 $('#search-loader').html('<span class="clear-search">Clear</span><span class="close-search"><i class="icon-cross"></i></span>'); 108 } 109 }); 110 }return false; 111 }, 800); 112 } 113} 114 115// Function to add call tracking to tel: and mailto: links 116function addCallTracking() { 117 // Helper function to get store ID 118 function getStoreId(link) { 119 // First try to get store_id from data attribute 120 var storeId = link.getAttribute('data-store-id'); 121 if (storeId) return storeId; 122 123 // If not found, try to extract from URL if it follows pattern /store/123/ 124 var urlMatch = window.location.pathname.match(/\/store\/(\d+)\//); 125 if (urlMatch && urlMatch[1]) return urlMatch[1]; 126 127 // If still not found, check if there's a global storeId variable 128 if (typeof window.storeId !== 'undefined') return window.storeId; 129 130 // Default to 0 if no store ID found 131 return '0'; 132 } 133 134 // Helper function to send tracking data to server 135 function sendTrackingData(type, contact, storeId) { 136 // Send tracking data to server via AJAX 137 var xhr = new XMLHttpRequest(); 138 xhr.open('POST', '/app/ajax-track-contact.php', true); 139 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 140 xhr.send('type=' + type + '&contact=' + encodeURIComponent(contact) + '&store_id=' + storeId); 141 142 // Also push to dataLayer for GA4 if available 143 if (typeof dataLayer !== 'undefined') { 144 dataLayer.push({ 145 'event': 'contact_click', 146 'event_category': 'Contact', 147 'event_action': type === 'phone' ? 'Phone Click' : 'Email Click', 148 'event_label': contact 149 }); 150 } 151 } 152 153 // Process telephone links 154 document.querySelectorAll('a[href^="tel:"]').forEach(function(link) { 155 if (!link.getAttribute('data-call-tracking')) { 156 var phoneNumber = link.getAttribute('href').replace('tel:', ''); 157 var storeId = getStoreId(link); 158 159 // Add click event listener 160 link.addEventListener('click', function(e) { 161 sendTrackingData('phone', phoneNumber, storeId); 162 }); 163 164 link.setAttribute('data-call-tracking', 'true'); 165 } 166 }); 167 168 // Process email links 169 document.querySelectorAll('a[href^="mailto:"]').forEach(function(link) { 170 if (!link.getAttribute('data-call-tracking')) { 171 var emailAddress = link.getAttribute('href').replace('mailto:', ''); 172 var storeId = getStoreId(link); 173 174 // Add click event listener 175 link.addEventListener('click', function(e) { 176 sendTrackingData('email', emailAddress, storeId); 177 }); 178 179 link.setAttribute('data-call-tracking', 'true'); 180 } 181 }); 182} 183 184// Run the function when the DOM is fully loaded 185document.addEventListener('DOMContentLoaded', addCallTracking); 186 187// Also run it after AJAX content is loaded or any dynamic content changes 188// You may need to call addCallTracking() manually after any AJAX operations that add new links 189$(document).ajaxComplete(function() { 190 addCallTracking(); 191});
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.