1jQuery(document).ready(function ($) { 2 var window_size = jQuery(window).width(); 3 new WOW().init(); 4 5 var MainBanner = jQuery(".main-banner"); 6 7 if(MainBanner.find("div").hasClass("banner-video")){ 8 /** Video Play on load and Play/Pause on Button click */ 9 $(".banner-video").append('<button class="playPauseBtn" aria-label="Play/Pause Video"><i class="fas fa-pause"></i></button>'); 10 11 let video = $(".banner-video video")[0]; 12 let playPauseBtn = $(".playPauseBtn"); 13 let playPauseBtnIcon = $(playPauseBtn).find("i"); 14 15 video.play(); 16 17 //setTimeout(function () { 18 //video.pause(); 19 // playPauseBtnIcon.removeClass("fas fa-pause").addClass("fas fa-play"); 20 //}, 5000); 21 22 playPauseBtn.on("click", function () { 23 if (video.paused) { 24 video.play(); 25 playPauseBtnIcon.removeClass("fas fa-play").addClass("fas fa-pause"); 26 } else { 27 video.pause(); 28 playPauseBtnIcon.removeClass("fas fa-pause").addClass("fas fa-play"); 29 } 30 }); 31 } 32 33 /* Popup form submit event JS */ 34 var currentRequest = null; 35 jQuery("#discount_form").submit(function (e) { 36 e.preventDefault(); 37 var fname = jQuery('input[name="first-name"]').val(); 38 var lname = jQuery('input[name="last-name"]').val(); 39 var email = jQuery('input[name="email"]').val(); 40 var phone = jQuery('input[name="phone"]').val(); 41 var modal_id = jQuery(this).parents(".modal").attr("id"); 42 var popup_id = jQuery(this).parents(".modal").attr("data-form-id"); 43 jQuery(".wpcf7-spinner").css("visibility", "visible"); 44 if (!validateEmail(email)) { 45 currentRequest = "error"; 46 if (jQuery(".common-popup-text .success").length > 0) { 47 jQuery(".common-popup-text .success").remove(); 48 } 49 if (jQuery(".common-popup-text .error").length > 0) { 50 jQuery(".common-popup-text .error").remove(); 51 } 52 jQuery("#" + modal_id + " #discount_form") 53 .find("div.close-button") 54 .prepend('<p class="error">Please enter valid <b>E-mail Address</b></p>'); 55 jQuery(".wpcf7-spinner").css("visibility", "hidden"); 56 return false; 57 } 58 59 jQuery("#" + modal_id + " #discount_form .success").remove(); 60 jQuery("#" + modal_id + " #discount_form .error").remove(); 61 if (jQuery(".common-popup-text .success").length > 0) { 62 jQuery(".common-popup-text .success").remove(); 63 } 64 if (jQuery(".common-popup-text .error").length > 0) { 65 jQuery(".common-popup-text .error").remove(); 66 } 67 68 currentRequest = $.ajax({ 69 url: custom_call.ajaxurl, 70 data: { 71 action: "discount_form_submit", 72 popup_id: popup_id, 73 fname: fname, 74 lname: lname, 75 email: email, 76 phone: phone, 77 }, 78 type: "post", 79 success: function (res) { 80 if (res != "success") { 81 jQuery(res).insertAfter(".common-popup-form"); 82 } 83 if (jQuery("#" + modal_id).find(".common-popup-text p.success.final").length > 0) { 84 password_reset_email(email); 85 } 86 jQuery(".wpcf7-spinner").css("visibility", "hidden"); 87 }, 88 }); 89 }); 90 91 /* Get Sticky CTA Button */ 92 jQuery("body").on("click", ".get-off-sticky a", function (e) { 93 e.preventDefault(); 94 if (jQuery(".modal").length > 0) { 95 const modal_id = jQuery(".modal").attr("id"); 96 jQuery("#" + modal_id).modal("show"); 97 } else { 98 jQuery(".modal").modal("show"); 99 } 100 jQuery(".get-off-sticky .sticky_discount-container").hide(); 101 jQuery.ajax({ 102 url: custom_call.ajaxurl, 103 type: "post", 104 data: { 105 action: "update_sticky_get_off_count", 106 }, 107 }); 108 }); 109 jQuery("body").on("click", ".get-off-sticky .sticky-close", function (e) { 110 jQuery(".get-off-sticky .sticky_discount-container").hide(); 111 }); 112 /* Desktop and Mobile JS */ 113 jQuery("#discount_modal,#discount_modal_mobile").on("hidden.bs.modal", function () {
114 setCookie("discount_modal", 1, 14); 115 }); 116 117 /* Close popup when press esc key */ 118 jQuery(document).keydown(function (e) { 119 // Check if the pressed key is ESC (key code 27) 120 if (e.keyCode == 27) { 121 // Close the modal 122 jQuery("#discount_modal").modal("hide"); 123 } 124 }); 125 126 /* restuarant page dish slider - page id (28918) */ 127 jQuery(".dish-slider").slick({ 128 slidesToShow: 3, 129 slidesToScroll: 1, 130 infinite: true, 131 dots: true, 132 arrows: true, 133 autoplay: true, 134 autoplaySpeed: 2000, 135 prevArrow: '<button class="slide-arrow prev-arrow"><i class="fa fa-angle-left" aria-hidden="true"></i></button>', 136 nextArrow: '<button class="slide-arrow next-arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></button>', 137 responsive: [ 138 { 139 breakpoint: 992, 140 settings: { 141 slidesToShow: 1, 142 slidesToScroll: 1, 143 infinite: true, 144 dots: false, 145 autoplay: true, 146 autoplaySpeed: 2000, 147 }, 148 }, 149 ], 150 }); 151 152 /* Point Slider Js */ 153 jQuery(".points-slider").slick({ 154 slidesToShow: 1, 155 slidesToScroll: 1, 156 infinite: true, 157 arrows: true, 158 autoplay: true, 159 autoplaySpeed: 2000, 160 prevArrow: '<button class="slide-arrow prev-arrow"><i class="fa fa-angle-left" aria-hidden="true"></i></button>', 161 nextArrow: '<button class="slide-arrow next-arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></button>', 162 responsive: [ 163 { 164 breakpoint: 992, 165 settings: { 166 slidesToShow: 1, 167 slidesToScroll: 1, 168 infinite: true, 169 dots: false, 170 autoplay: true, 171 autoplaySpeed: 2000, 172 }, 173 }, 174 ], 175 }); 176 177 // FAQ Accordian JS Start 178 jQuery(".accordion-box-wp .accordion-content").hide(); 179 jQuery(".accordion-title").click(function (j) { 180 var dropDown = jQuery(this).closest(".accordion-box").find(".accordion-content"); 181 jQuery(this).closest(".accordion-box-wp").find(".accordion-content").not(dropDown).slideUp(); 182 if (jQuery(this).hasClass("active-accordion")) { 183 jQuery(this).removeClass("active-accordion"); 184 } else { 185 jQuery(this).closest(".accordion-box-wp").find(".accordion-title.active-accordion").removeClass("active-accordion"); 186 jQuery(this).addClass("active-accordion"); 187 } 188 dropDown.stop(false, true).slideToggle(); 189 j.preventDefault(); 190 }); 191 192 // Mobile Popup no sms update conversion JS 193 jQuery("body").on("click", "#discount_modal_mobile .submit-button a", function () { 194 var popup_id = jQuery(this).parents(".modal").attr("data-form-id"); 195 jQuery.ajax({ 196 url: custom_call.ajaxurl, 197 type: "post", 198 data: { 199 action: "update_popup_success", 200 popup_id: popup_id, 201 }, 202 success: function (response) { 203 if (response) { 204 jQuery("#discount_modal_mobile").modal("hide"); 205 } 206 }, 207 }); 208 }); 209 210 /*Quote Modal JS */ 211 jQuery("#discount_modal,#discount_modal_mobile").on("show.bs.modal", function () { 212 var scrolly = window.scrollY; 213 jQuery("body").css("top", "-" + scrolly + "px"); 214 jQuery(this).attr("data-top", scrolly); 215 }); 216 jQuery("#discount_modal,#discount_modal_mobile").on("hidden.bs.modal", function () { 217 var scrolly = jQuery(this).attr("data-top"); 218 jQuery("body").css("top", "0px"); 219 window.scrollTo(0, scrolly); 220 }); 221 222 /* If #phoneNumber element exists */ 223 if (document.getElementById("phoneNumber")) { 224 const isNumericInput = (event) => { 225 const key = event.keyCode; 226 return ( 227 (key >= 48 && key <= 57) || // Allow number line 228 (key >= 96 && key <= 105) // Allow number pad 229 ); 230 }; 231 232 const isModifierKey = (event) => {
233 const key = event.keyCode; 234 return ( 235 event.shiftKey === true || 236 key === 35 || 237 key === 36 || // Allow Shift, Home, End 238 key === 8 || 239 key === 9 || 240 key === 13 || 241 key === 46 || // Allow Backspace, Tab, Enter, Delete 242 (key > 36 && key < 41) || // Allow left, up, right, down 243 // Allow Ctrl/Command + A,C,V,X,Z 244 ((event.ctrlKey === true || event.metaKey === true) && (key === 65 || key === 67 || key === 86 || key === 88 || key === 90)) 245 ); 246 }; 247 248 const enforceFormat = (event) => { 249 // Input must be of a valid number format or a modifier key, and not longer than ten digits 250 if (!isNumericInput(event) && !isModifierKey(event)) { 251 event.preventDefault(); 252 } 253 }; 254 255 const formatToPhone = (event) => { 256 if (isModifierKey(event)) { 257 return; 258 } 259 260 // I am lazy and don't like to type things more than once 261 const target = event.target; 262 const input = event.target.value.replace(/\D/g, "").substring(0, 10); // First ten digits of input only 263 const zip = input.substring(0, 3); 264 const middle = input.substring(3, 6); 265 const last = input.substring(6, 10); 266 267 if (input.length > 6) { 268 target.value = `(${zip}) ${middle} - ${last}`; 269 } else if (input.length > 3) { 270 target.value = `(${zip}) ${middle}`; 271 } else if (input.length > 0) { 272 target.value = `(${zip}`; 273 } 274 }; 275 276 const inputElement = document.getElementById("phoneNumber"); 277 inputElement.addEventListener("keydown", enforceFormat); 278 inputElement.addEventListener("keyup", formatToPhone); 279 } 280 281 const validateEmail = (email) => { 282 return email.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/); 283 }; 284}); 285 286/* on window load JS */ 287jQuery(window).on("load", functionTobeLoaded()); 288 289function functionTobeLoaded() { 290 /* dekstop modal show If #discount_modal element exists */ 291 if (jQuery("#discount_modal").length > 0) { 292 var dis_modal_cookie = getCookie("discount_modal"); 293 if (dis_modal_cookie == null || dis_modal_cookie != 1) { 294 jQuery("#discount_modal").modal("show"); 295 } 296 } 297 298 /* mobile modal show If #discount_modal_mobile element exists */ 299 if (jQuery("#discount_modal_mobile").length > 0) { 300 var dis_modal_cookie = getCookie("discount_modal"); 301 if (dis_modal_cookie == null || dis_modal_cookie != 1) { 302 jQuery("#discount_modal_mobile").modal("show"); 303 } 304 } 305 306 setTimeout(() => { 307 if (jQuery(".local_deals_offers").length > 0) { 308 jQuery(".local_deals_offers").find(".accordion-title").trigger("click"); 309 } 310 }, 500); 311} 312 313/* Password reset mail ajax JS */ 314function password_reset_email(email = "") { 315 setTimeout(() => { 316 jQuery.ajax({ 317 data: { 318 action: "password_reset_email", 319 email: email, 320 }, 321 type: "post", 322 url: custom_call.ajaxurl, 323 success: function (res) { 324 if (res != "") { 325 jQuery("#discount_modal").modal("hide"); 326 } 327 }, 328 }); 329 }, 2000); 330} 331 332/* Set Cookie */ 333function setCookie(name, value, days) { 334 var expires = ""; 335 if (days) { 336 var date = new Date(); 337 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 338 expires = "; expires=" + date.toUTCString(); 339 } 340 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 341} 342/* Get Cookie */ 343function getCookie(name) { 344 var nameEQ = name + "="; 345 var ca = document.cookie.split(";"); 346 for (var i = 0; i < ca.length; i++) { 347 var c = ca[i]; 348 while (c.charAt(0) == " ") c = c.substring(1, c.length); 349 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 350 } 351 return null; 352} 353/* Delete Cookie */
354function eraseCookie(name) { 355 setCookie(name, "", -1); 356}
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.